diff options
author | Phil Ellison <[email protected]> | 2021-01-01 19:35:10 +0000 |
---|---|---|
committer | Phil Ellison <[email protected]> | 2021-01-01 19:35:10 +0000 |
commit | 609a069757aa071c377c0e02d7b18b4ff7b32631 (patch) | |
tree | edc2b964bc5e3a00a02e68cadc43f4626505f269 /editors/code | |
parent | db53db804604574337f80a614565fb964403a654 (diff) |
Remove some unnecessary code copied from the Syntax Tree command
Diffstat (limited to 'editors/code')
-rw-r--r-- | editors/code/src/commands.ts | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/editors/code/src/commands.ts b/editors/code/src/commands.ts index 21b0c27f3..2911bccd5 100644 --- a/editors/code/src/commands.ts +++ b/editors/code/src/commands.ts | |||
@@ -340,7 +340,7 @@ export function syntaxTree(ctx: Ctx): Cmd { | |||
340 | }; | 340 | }; |
341 | } | 341 | } |
342 | 342 | ||
343 | // Opens the virtual file that will show hir | 343 | // Opens the virtual file that will show the HIR of the function containing the cursor position |
344 | // | 344 | // |
345 | // The contents of the file come from the `TextDocumentContentProvider` | 345 | // The contents of the file come from the `TextDocumentContentProvider` |
346 | export function viewHir(ctx: Ctx): Cmd { | 346 | export function viewHir(ctx: Ctx): Cmd { |
@@ -384,25 +384,11 @@ export function viewHir(ctx: Ctx): Cmd { | |||
384 | } | 384 | } |
385 | }; | 385 | }; |
386 | 386 | ||
387 | void new AstInspector(ctx); | ||
388 | |||
389 | ctx.pushCleanup(vscode.workspace.registerTextDocumentContentProvider('rust-analyzer', tdcp)); | 387 | ctx.pushCleanup(vscode.workspace.registerTextDocumentContentProvider('rust-analyzer', tdcp)); |
390 | ctx.pushCleanup(vscode.languages.setLanguageConfiguration("ra_syntax_tree", { | ||
391 | brackets: [["[", ")"]], | ||
392 | })); | ||
393 | 388 | ||
394 | return async () => { | 389 | return async () => { |
395 | const editor = vscode.window.activeTextEditor; | 390 | const document = await vscode.workspace.openTextDocument(tdcp.uri); |
396 | const rangeEnabled = !!editor && !editor.selection.isEmpty; | 391 | tdcp.eventEmitter.fire(tdcp.uri); |
397 | |||
398 | const uri = rangeEnabled | ||
399 | ? vscode.Uri.parse(`${tdcp.uri.toString()}?range=true`) | ||
400 | : tdcp.uri; | ||
401 | |||
402 | const document = await vscode.workspace.openTextDocument(uri); | ||
403 | |||
404 | tdcp.eventEmitter.fire(uri); | ||
405 | |||
406 | void await vscode.window.showTextDocument(document, { | 392 | void await vscode.window.showTextDocument(document, { |
407 | viewColumn: vscode.ViewColumn.Two, | 393 | viewColumn: vscode.ViewColumn.Two, |
408 | preserveFocus: true | 394 | preserveFocus: true |