mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
Apply tslint suggestions, round one
This commit is contained in:
parent
69de7e2fd7
commit
4d62cfccbb
16 changed files with 257 additions and 241 deletions
|
@ -1,22 +1,22 @@
|
|||
import * as vscode from 'vscode';
|
||||
|
||||
import { TextDocumentIdentifier, Location } from "vscode-languageclient";
|
||||
import { Location, TextDocumentIdentifier } from 'vscode-languageclient';
|
||||
import { Server } from '../server';
|
||||
|
||||
export async function handle() {
|
||||
let editor = vscode.window.activeTextEditor
|
||||
if (editor == null || editor.document.languageId != "rust") return
|
||||
let request: TextDocumentIdentifier = {
|
||||
uri: editor.document.uri.toString()
|
||||
}
|
||||
let response = await Server.client.sendRequest<Location[]>("m/parentModule", request)
|
||||
let loc = response[0]
|
||||
if (loc == null) return
|
||||
let uri = Server.client.protocol2CodeConverter.asUri(loc.uri)
|
||||
let range = Server.client.protocol2CodeConverter.asRange(loc.range)
|
||||
const editor = vscode.window.activeTextEditor;
|
||||
if (editor == null || editor.document.languageId != 'rust') { return; }
|
||||
const request: TextDocumentIdentifier = {
|
||||
uri: editor.document.uri.toString(),
|
||||
};
|
||||
const response = await Server.client.sendRequest<Location[]>('m/parentModule', request);
|
||||
const loc = response[0];
|
||||
if (loc == null) { return; }
|
||||
const uri = Server.client.protocol2CodeConverter.asUri(loc.uri);
|
||||
const range = Server.client.protocol2CodeConverter.asRange(loc.range);
|
||||
|
||||
let doc = await vscode.workspace.openTextDocument(uri)
|
||||
let e = await vscode.window.showTextDocument(doc)
|
||||
e.selection = new vscode.Selection(range.start, range.start)
|
||||
e.revealRange(range, vscode.TextEditorRevealType.InCenter)
|
||||
const doc = await vscode.workspace.openTextDocument(uri);
|
||||
const e = await vscode.window.showTextDocument(doc);
|
||||
e.selection = new vscode.Selection(range.start, range.start);
|
||||
e.revealRange(range, vscode.TextEditorRevealType.InCenter);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue