diff options
-rw-r--r-- | crates/ra_ide/src/completion/complete_snippet.rs | 8 | ||||
-rw-r--r-- | docs/user/README.md | 6 | ||||
-rw-r--r-- | editors/code/.vscodeignore | 1 | ||||
-rw-r--r-- | editors/code/icon.png | bin | 0 -> 17918 bytes | |||
-rw-r--r-- | editors/code/package-lock.json | 4 | ||||
-rw-r--r-- | editors/code/package.json | 7 | ||||
-rw-r--r-- | xtask/src/install.rs | 33 |
7 files changed, 42 insertions, 17 deletions
diff --git a/crates/ra_ide/src/completion/complete_snippet.rs b/crates/ra_ide/src/completion/complete_snippet.rs index 1f2988b36..731b4fd82 100644 --- a/crates/ra_ide/src/completion/complete_snippet.rs +++ b/crates/ra_ide/src/completion/complete_snippet.rs | |||
@@ -36,6 +36,7 @@ fn ${1:feature}() { | |||
36 | .lookup_by("tfn") | 36 | .lookup_by("tfn") |
37 | .add_to(acc); | 37 | .add_to(acc); |
38 | 38 | ||
39 | snippet(ctx, "macro_rules", "macro_rules! $1 {\n\t($2) => {\n\t\t$0\n\t};\n}").add_to(acc); | ||
39 | snippet(ctx, "pub(crate)", "pub(crate) $0").add_to(acc); | 40 | snippet(ctx, "pub(crate)", "pub(crate) $0").add_to(acc); |
40 | } | 41 | } |
41 | 42 | ||
@@ -107,6 +108,13 @@ mod tests { | |||
107 | lookup: "tfn", | 108 | lookup: "tfn", |
108 | }, | 109 | }, |
109 | CompletionItem { | 110 | CompletionItem { |
111 | label: "macro_rules", | ||
112 | source_range: [78; 78), | ||
113 | delete: [78; 78), | ||
114 | insert: "macro_rules! $1 {\n\t($2) => {\n\t\t$0\n\t};\n}", | ||
115 | kind: Snippet, | ||
116 | }, | ||
117 | CompletionItem { | ||
110 | label: "pub(crate)", | 118 | label: "pub(crate)", |
111 | source_range: [78; 78), | 119 | source_range: [78; 78), |
112 | delete: [78; 78), | 120 | delete: [78; 78), |
diff --git a/docs/user/README.md b/docs/user/README.md index fa202f06c..d17108788 100644 --- a/docs/user/README.md +++ b/docs/user/README.md | |||
@@ -44,7 +44,7 @@ $ cargo xtask install | |||
44 | The automatic installation is expected to *just work* for common cases, if it | 44 | The automatic installation is expected to *just work* for common cases, if it |
45 | doesn't, report bugs! | 45 | doesn't, report bugs! |
46 | 46 | ||
47 | **Note** [#1831](https://github.com/rust-analyzer/rust-analyzer/issues/1831): If you are using the popular | 47 | **Note** [#1831](https://github.com/rust-analyzer/rust-analyzer/issues/1831): If you are using the popular |
48 | [Vim emulation plugin](https://github.com/VSCodeVim/Vim), you will likely | 48 | [Vim emulation plugin](https://github.com/VSCodeVim/Vim), you will likely |
49 | need to turn off the `rust-analyzer.enableEnhancedTyping` setting. | 49 | need to turn off the `rust-analyzer.enableEnhancedTyping` setting. |
50 | 50 | ||
@@ -58,7 +58,7 @@ $ cargo install --path ./crates/ra_lsp_server/ --force --locked | |||
58 | $ cd ./editors/code | 58 | $ cd ./editors/code |
59 | $ npm install | 59 | $ npm install |
60 | $ ./node_modules/vsce/out/vsce package | 60 | $ ./node_modules/vsce/out/vsce package |
61 | $ code --install-extension ./ra-lsp-0.0.1.vsix | 61 | $ code --install-extension ./rust-analyzer-0.1.0.vsix |
62 | ``` | 62 | ``` |
63 | 63 | ||
64 | It's better to remove existing Rust plugins to avoid interference. | 64 | It's better to remove existing Rust plugins to avoid interference. |
@@ -83,7 +83,7 @@ manually install the `.vsix` package: | |||
83 | 3. Open the Extensions View (`View > Extensions`, keyboard shortcut: `Ctrl+Shift+X`). | 83 | 3. Open the Extensions View (`View > Extensions`, keyboard shortcut: `Ctrl+Shift+X`). |
84 | 4. From the top-right kebab menu (`···`) select `Install from VSIX...` | 84 | 4. From the top-right kebab menu (`···`) select `Install from VSIX...` |
85 | 5. Inside the `rust-analyzer` directory find the `editors/code` subdirectory and choose | 85 | 5. Inside the `rust-analyzer` directory find the `editors/code` subdirectory and choose |
86 | the `ra-lsp-0.0.1.vsix` file. | 86 | the `rust-analyzer-0.1.0.vsix` file. |
87 | 6. Restart Visual Studio Code and re-establish the connection to the remote host. | 87 | 6. Restart Visual Studio Code and re-establish the connection to the remote host. |
88 | 88 | ||
89 | In case of errors please make sure that `~/.cargo/bin` is in your `PATH` on the remote | 89 | In case of errors please make sure that `~/.cargo/bin` is in your `PATH` on the remote |
diff --git a/editors/code/.vscodeignore b/editors/code/.vscodeignore index 9bcd28e61..3d1156d3b 100644 --- a/editors/code/.vscodeignore +++ b/editors/code/.vscodeignore | |||
@@ -2,3 +2,4 @@ | |||
2 | !out/main.js | 2 | !out/main.js |
3 | !package.json | 3 | !package.json |
4 | !package-lock.json | 4 | !package-lock.json |
5 | !icon.png | ||
diff --git a/editors/code/icon.png b/editors/code/icon.png new file mode 100644 index 000000000..992aee4bd --- /dev/null +++ b/editors/code/icon.png | |||
Binary files differ | |||
diff --git a/editors/code/package-lock.json b/editors/code/package-lock.json index adb01760a..3059323aa 100644 --- a/editors/code/package-lock.json +++ b/editors/code/package-lock.json | |||
@@ -1,6 +1,6 @@ | |||
1 | { | 1 | { |
2 | "name": "ra-lsp", | 2 | "name": "rust-analyzer", |
3 | "version": "0.0.1", | 3 | "version": "0.1.0", |
4 | "lockfileVersion": 1, | 4 | "lockfileVersion": 1, |
5 | "requires": true, | 5 | "requires": true, |
6 | "dependencies": { | 6 | "dependencies": { |
diff --git a/editors/code/package.json b/editors/code/package.json index e7fc314f3..7c22d21d3 100644 --- a/editors/code/package.json +++ b/editors/code/package.json | |||
@@ -1,10 +1,11 @@ | |||
1 | { | 1 | { |
2 | "name": "ra-lsp", | 2 | "name": "rust-analyzer", |
3 | "displayName": "ra-lsp", | 3 | "displayName": "rust-analyzer", |
4 | "description": "An alternative rust language server to the RLS", | 4 | "description": "An alternative rust language server to the RLS", |
5 | "preview": true, | 5 | "preview": true, |
6 | "private": true, | 6 | "private": true, |
7 | "version": "0.0.1", | 7 | "icon": "icon.png", |
8 | "version": "0.1.0", | ||
8 | "publisher": "matklad", | 9 | "publisher": "matklad", |
9 | "repository": { | 10 | "repository": { |
10 | "url": "https://github.com/matklad/rust-analyzer/" | 11 | "url": "https://github.com/matklad/rust-analyzer/" |
diff --git a/xtask/src/install.rs b/xtask/src/install.rs index fa82633de..bffd91af1 100644 --- a/xtask/src/install.rs +++ b/xtask/src/install.rs | |||
@@ -107,29 +107,44 @@ fn install_client(ClientOpt::VsCode: ClientOpt) -> Result<()> { | |||
107 | }; | 107 | }; |
108 | 108 | ||
109 | Cmd { | 109 | Cmd { |
110 | unix: &format!(r"{} --install-extension ./ra-lsp-0.0.1.vsix --force", code_binary), | 110 | unix: &format!(r"{} --install-extension ./rust-analyzer-0.1.0.vsix --force", code_binary), |
111 | windows: &format!( | 111 | windows: &format!( |
112 | r"cmd.exe /c {}.cmd --install-extension ./ra-lsp-0.0.1.vsix --force", | 112 | r"cmd.exe /c {}.cmd --install-extension ./rust-analyzer-0.1.0.vsix --force", |
113 | code_binary | 113 | code_binary |
114 | ), | 114 | ), |
115 | work_dir: "./editors/code", | 115 | work_dir: "./editors/code", |
116 | } | 116 | } |
117 | .run()?; | 117 | .run()?; |
118 | 118 | ||
119 | let output = Cmd { | 119 | let installed_extensions = { |
120 | unix: &format!(r"{} --list-extensions", code_binary), | 120 | let output = Cmd { |
121 | windows: &format!(r"cmd.exe /c {}.cmd --list-extensions", code_binary), | 121 | unix: &format!(r"{} --list-extensions", code_binary), |
122 | work_dir: ".", | 122 | windows: &format!(r"cmd.exe /c {}.cmd --list-extensions", code_binary), |
123 | } | 123 | work_dir: ".", |
124 | .run_with_output()?; | 124 | } |
125 | .run_with_output()?; | ||
126 | String::from_utf8(output.stdout)? | ||
127 | }; | ||
125 | 128 | ||
126 | if !str::from_utf8(&output.stdout)?.contains("ra-lsp") { | 129 | if !installed_extensions.contains("rust-analyzer") { |
127 | anyhow::bail!( | 130 | anyhow::bail!( |
128 | "Could not install the Visual Studio Code extension. \ | 131 | "Could not install the Visual Studio Code extension. \ |
129 | Please make sure you have at least NodeJS 10.x together with the latest version of VS Code installed and try again." | 132 | Please make sure you have at least NodeJS 10.x together with the latest version of VS Code installed and try again." |
130 | ); | 133 | ); |
131 | } | 134 | } |
132 | 135 | ||
136 | if installed_extensions.contains("ra-lsp") { | ||
137 | Cmd { | ||
138 | unix: &format!(r"{} --uninstall-extension matklad.ra-lsp", code_binary), | ||
139 | windows: &format!( | ||
140 | r"cmd.exe /c {}.cmd --uninstall-extension matklad.ra-lsp", | ||
141 | code_binary | ||
142 | ), | ||
143 | work_dir: "./editors/code", | ||
144 | } | ||
145 | .run()?; | ||
146 | } | ||
147 | |||
133 | Ok(()) | 148 | Ok(()) |
134 | } | 149 | } |
135 | 150 | ||