diff options
Diffstat (limited to 'editors/code')
-rw-r--r-- | editors/code/rust.tmGrammar.json | 4 | ||||
-rw-r--r-- | editors/code/src/commands.ts | 12 | ||||
-rw-r--r-- | editors/code/src/lsp_ext.ts | 1 | ||||
-rw-r--r-- | editors/code/src/run.ts | 6 |
4 files changed, 17 insertions, 6 deletions
diff --git a/editors/code/rust.tmGrammar.json b/editors/code/rust.tmGrammar.json index ab87cd39f..0be2583db 100644 --- a/editors/code/rust.tmGrammar.json +++ b/editors/code/rust.tmGrammar.json | |||
@@ -268,7 +268,7 @@ | |||
268 | "match": "\\b(log|error|warn|info|debug|trace|log_enabled)!" | 268 | "match": "\\b(log|error|warn|info|debug|trace|log_enabled)!" |
269 | }, | 269 | }, |
270 | { | 270 | { |
271 | "comment": "Invokation of a macro", | 271 | "comment": "Invocation of a macro", |
272 | "match": "\\b([a-zA-Z_][a-zA-Z0-9_]*\\!)\\s*[({\\[]", | 272 | "match": "\\b([a-zA-Z_][a-zA-Z0-9_]*\\!)\\s*[({\\[]", |
273 | "captures": { | 273 | "captures": { |
274 | "1": { | 274 | "1": { |
@@ -683,4 +683,4 @@ | |||
683 | ] | 683 | ] |
684 | } | 684 | } |
685 | } | 685 | } |
686 | } \ No newline at end of file | 686 | } |
diff --git a/editors/code/src/commands.ts b/editors/code/src/commands.ts index 8c9d7802f..0e78f5101 100644 --- a/editors/code/src/commands.ts +++ b/editors/code/src/commands.ts | |||
@@ -158,7 +158,7 @@ export function ssr(ctx: Ctx): Cmd { | |||
158 | 158 | ||
159 | const options: vscode.InputBoxOptions = { | 159 | const options: vscode.InputBoxOptions = { |
160 | value: "() ==>> ()", | 160 | value: "() ==>> ()", |
161 | prompt: "Enter request, for example 'Foo($a:expr) ==> Foo::new($a)' ", | 161 | prompt: "Enter request, for example 'Foo($a) ==> Foo::new($a)' ", |
162 | validateInput: async (x: string) => { | 162 | validateInput: async (x: string) => { |
163 | try { | 163 | try { |
164 | await client.sendRequest(ra.ssr, { query: x, parseOnly: true }); | 164 | await client.sendRequest(ra.ssr, { query: x, parseOnly: true }); |
@@ -171,9 +171,15 @@ export function ssr(ctx: Ctx): Cmd { | |||
171 | const request = await vscode.window.showInputBox(options); | 171 | const request = await vscode.window.showInputBox(options); |
172 | if (!request) return; | 172 | if (!request) return; |
173 | 173 | ||
174 | const edit = await client.sendRequest(ra.ssr, { query: request, parseOnly: false }); | 174 | vscode.window.withProgress({ |
175 | location: vscode.ProgressLocation.Notification, | ||
176 | title: "Structured search replace in progress...", | ||
177 | cancellable: false, | ||
178 | }, async (_progress, _token) => { | ||
179 | const edit = await client.sendRequest(ra.ssr, { query: request, parseOnly: false }); | ||
175 | 180 | ||
176 | await vscode.workspace.applyEdit(client.protocol2CodeConverter.asWorkspaceEdit(edit)); | 181 | await vscode.workspace.applyEdit(client.protocol2CodeConverter.asWorkspaceEdit(edit)); |
182 | }); | ||
177 | }; | 183 | }; |
178 | } | 184 | } |
179 | 185 | ||
diff --git a/editors/code/src/lsp_ext.ts b/editors/code/src/lsp_ext.ts index e16ea799c..fdb99956b 100644 --- a/editors/code/src/lsp_ext.ts +++ b/editors/code/src/lsp_ext.ts | |||
@@ -60,6 +60,7 @@ export interface Runnable { | |||
60 | workspaceRoot?: string; | 60 | workspaceRoot?: string; |
61 | cargoArgs: string[]; | 61 | cargoArgs: string[]; |
62 | executableArgs: string[]; | 62 | executableArgs: string[]; |
63 | expectTest?: boolean; | ||
63 | }; | 64 | }; |
64 | } | 65 | } |
65 | export const runnables = new lc.RequestType<RunnablesParams, Runnable[], void>("experimental/runnables"); | 66 | export const runnables = new lc.RequestType<RunnablesParams, Runnable[], void>("experimental/runnables"); |
diff --git a/editors/code/src/run.ts b/editors/code/src/run.ts index 766b05112..e1430e31f 100644 --- a/editors/code/src/run.ts +++ b/editors/code/src/run.ts | |||
@@ -108,12 +108,16 @@ export async function createTask(runnable: ra.Runnable, config: Config): Promise | |||
108 | if (runnable.args.executableArgs.length > 0) { | 108 | if (runnable.args.executableArgs.length > 0) { |
109 | args.push('--', ...runnable.args.executableArgs); | 109 | args.push('--', ...runnable.args.executableArgs); |
110 | } | 110 | } |
111 | const env: { [key: string]: string } = { "RUST_BACKTRACE": "short" }; | ||
112 | if (runnable.args.expectTest) { | ||
113 | env["UPDATE_EXPECT"] = "1"; | ||
114 | } | ||
111 | const definition: tasks.CargoTaskDefinition = { | 115 | const definition: tasks.CargoTaskDefinition = { |
112 | type: tasks.TASK_TYPE, | 116 | type: tasks.TASK_TYPE, |
113 | command: args[0], // run, test, etc... | 117 | command: args[0], // run, test, etc... |
114 | args: args.slice(1), | 118 | args: args.slice(1), |
115 | cwd: runnable.args.workspaceRoot, | 119 | cwd: runnable.args.workspaceRoot, |
116 | env: Object.assign({}, process.env as { [key: string]: string }, { "RUST_BACKTRACE": "short" }), | 120 | env: Object.assign({}, process.env as { [key: string]: string }, env), |
117 | }; | 121 | }; |
118 | 122 | ||
119 | const target = vscode.workspace.workspaceFolders![0]; // safe, see main activate() | 123 | const target = vscode.workspace.workspaceFolders![0]; // safe, see main activate() |