diff options
Diffstat (limited to 'xtask/src')
-rw-r--r-- | xtask/src/codegen/gen_syntax.rs | 2 | ||||
-rw-r--r-- | xtask/src/install.rs | 33 | ||||
-rw-r--r-- | xtask/src/lib.rs | 1 |
3 files changed, 26 insertions, 10 deletions
diff --git a/xtask/src/codegen/gen_syntax.rs b/xtask/src/codegen/gen_syntax.rs index 19fea67d8..db05dcebb 100644 --- a/xtask/src/codegen/gen_syntax.rs +++ b/xtask/src/codegen/gen_syntax.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | //! This module generate AST datatype used by rust-analyzer. | 1 | //! This module generates AST datatype used by rust-analyzer. |
2 | //! | 2 | //! |
3 | //! Specifically, it generates the `SyntaxKind` enum and a number of newtype | 3 | //! Specifically, it generates the `SyntaxKind` enum and a number of newtype |
4 | //! wrappers around `SyntaxNode` which implement `ra_syntax::AstNode`. | 4 | //! wrappers around `SyntaxNode` which implement `ra_syntax::AstNode`. |
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 | ||
diff --git a/xtask/src/lib.rs b/xtask/src/lib.rs index 0a569cf5d..9b0afe8e0 100644 --- a/xtask/src/lib.rs +++ b/xtask/src/lib.rs | |||
@@ -53,6 +53,7 @@ fn reformat(text: impl std::fmt::Display) -> Result<String> { | |||
53 | write!(rustfmt.stdin.take().unwrap(), "{}", text)?; | 53 | write!(rustfmt.stdin.take().unwrap(), "{}", text)?; |
54 | let output = rustfmt.wait_with_output()?; | 54 | let output = rustfmt.wait_with_output()?; |
55 | let stdout = String::from_utf8(output.stdout)?; | 55 | let stdout = String::from_utf8(output.stdout)?; |
56 | // TODO: update the preable: replace ra_tools with the relevant path | ||
56 | let preamble = "Generated file, do not edit by hand, see `crate/ra_tools/src/codegen`"; | 57 | let preamble = "Generated file, do not edit by hand, see `crate/ra_tools/src/codegen`"; |
57 | Ok(format!("//! {}\n\n{}", preamble, stdout)) | 58 | Ok(format!("//! {}\n\n{}", preamble, stdout)) |
58 | } | 59 | } |