diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-07-29 10:23:33 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-07-29 10:23:33 +0100 |
commit | 9a9ddcc29793e5ba3bfece096e222736e2172555 (patch) | |
tree | 929b74f0646996d84351dfbc1974ed762eaa847b /editors/code/src | |
parent | 04d2b7b256657f8e6816f8ed67aa5608bfe9e261 (diff) | |
parent | fcb6b166fbc506950dc2689adfa4d0b728d1a745 (diff) |
Merge #5564
5564: SSR: Restrict to current selection if any r=davidlattimore a=davidlattimore
The selection is also used to avoid unnecessary work, but only to the file level. Further restricting unnecessary work is left for later.
Co-authored-by: David Lattimore <[email protected]>
Diffstat (limited to 'editors/code/src')
-rw-r--r-- | editors/code/src/commands.ts | 5 | ||||
-rw-r--r-- | editors/code/src/lsp_ext.ts | 1 |
2 files changed, 4 insertions, 2 deletions
diff --git a/editors/code/src/commands.ts b/editors/code/src/commands.ts index c21e5597c..d0faf4745 100644 --- a/editors/code/src/commands.ts +++ b/editors/code/src/commands.ts | |||
@@ -190,6 +190,7 @@ export function ssr(ctx: Ctx): Cmd { | |||
190 | if (!editor || !client) return; | 190 | if (!editor || !client) return; |
191 | 191 | ||
192 | const position = editor.selection.active; | 192 | const position = editor.selection.active; |
193 | const selections = editor.selections; | ||
193 | const textDocument = { uri: editor.document.uri.toString() }; | 194 | const textDocument = { uri: editor.document.uri.toString() }; |
194 | 195 | ||
195 | const options: vscode.InputBoxOptions = { | 196 | const options: vscode.InputBoxOptions = { |
@@ -198,7 +199,7 @@ export function ssr(ctx: Ctx): Cmd { | |||
198 | validateInput: async (x: string) => { | 199 | validateInput: async (x: string) => { |
199 | try { | 200 | try { |
200 | await client.sendRequest(ra.ssr, { | 201 | await client.sendRequest(ra.ssr, { |
201 | query: x, parseOnly: true, textDocument, position, | 202 | query: x, parseOnly: true, textDocument, position, selections, |
202 | }); | 203 | }); |
203 | } catch (e) { | 204 | } catch (e) { |
204 | return e.toString(); | 205 | return e.toString(); |
@@ -215,7 +216,7 @@ export function ssr(ctx: Ctx): Cmd { | |||
215 | cancellable: false, | 216 | cancellable: false, |
216 | }, async (_progress, _token) => { | 217 | }, async (_progress, _token) => { |
217 | const edit = await client.sendRequest(ra.ssr, { | 218 | const edit = await client.sendRequest(ra.ssr, { |
218 | query: request, parseOnly: false, textDocument, position | 219 | query: request, parseOnly: false, textDocument, position, selections, |
219 | }); | 220 | }); |
220 | 221 | ||
221 | await vscode.workspace.applyEdit(client.protocol2CodeConverter.asWorkspaceEdit(edit)); | 222 | await vscode.workspace.applyEdit(client.protocol2CodeConverter.asWorkspaceEdit(edit)); |
diff --git a/editors/code/src/lsp_ext.ts b/editors/code/src/lsp_ext.ts index 149f9a0d6..494d51c83 100644 --- a/editors/code/src/lsp_ext.ts +++ b/editors/code/src/lsp_ext.ts | |||
@@ -95,6 +95,7 @@ export interface SsrParams { | |||
95 | parseOnly: boolean; | 95 | parseOnly: boolean; |
96 | textDocument: lc.TextDocumentIdentifier; | 96 | textDocument: lc.TextDocumentIdentifier; |
97 | position: lc.Position; | 97 | position: lc.Position; |
98 | selections: lc.Range[]; | ||
98 | } | 99 | } |
99 | export const ssr = new lc.RequestType<SsrParams, lc.WorkspaceEdit, void>('experimental/ssr'); | 100 | export const ssr = new lc.RequestType<SsrParams, lc.WorkspaceEdit, void>('experimental/ssr'); |
100 | 101 | ||