mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
Remove some unnecessary code copied from the Syntax Tree command
This commit is contained in:
parent
db53db8046
commit
609a069757
1 changed files with 3 additions and 17 deletions
|
@ -340,7 +340,7 @@ export function syntaxTree(ctx: Ctx): Cmd {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Opens the virtual file that will show hir
|
// Opens the virtual file that will show the HIR of the function containing the cursor position
|
||||||
//
|
//
|
||||||
// The contents of the file come from the `TextDocumentContentProvider`
|
// The contents of the file come from the `TextDocumentContentProvider`
|
||||||
export function viewHir(ctx: Ctx): Cmd {
|
export function viewHir(ctx: Ctx): Cmd {
|
||||||
|
@ -384,25 +384,11 @@ export function viewHir(ctx: Ctx): Cmd {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void new AstInspector(ctx);
|
|
||||||
|
|
||||||
ctx.pushCleanup(vscode.workspace.registerTextDocumentContentProvider('rust-analyzer', tdcp));
|
ctx.pushCleanup(vscode.workspace.registerTextDocumentContentProvider('rust-analyzer', tdcp));
|
||||||
ctx.pushCleanup(vscode.languages.setLanguageConfiguration("ra_syntax_tree", {
|
|
||||||
brackets: [["[", ")"]],
|
|
||||||
}));
|
|
||||||
|
|
||||||
return async () => {
|
return async () => {
|
||||||
const editor = vscode.window.activeTextEditor;
|
const document = await vscode.workspace.openTextDocument(tdcp.uri);
|
||||||
const rangeEnabled = !!editor && !editor.selection.isEmpty;
|
tdcp.eventEmitter.fire(tdcp.uri);
|
||||||
|
|
||||||
const uri = rangeEnabled
|
|
||||||
? vscode.Uri.parse(`${tdcp.uri.toString()}?range=true`)
|
|
||||||
: tdcp.uri;
|
|
||||||
|
|
||||||
const document = await vscode.workspace.openTextDocument(uri);
|
|
||||||
|
|
||||||
tdcp.eventEmitter.fire(uri);
|
|
||||||
|
|
||||||
void await vscode.window.showTextDocument(document, {
|
void await vscode.window.showTextDocument(document, {
|
||||||
viewColumn: vscode.ViewColumn.Two,
|
viewColumn: vscode.ViewColumn.Two,
|
||||||
preserveFocus: true
|
preserveFocus: true
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue