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,6 +1,6 @@
|
|||
import * as vscode from 'vscode';
|
||||
|
||||
import { TextDocumentIdentifier, Range } from "vscode-languageclient";
|
||||
import { Range, TextDocumentIdentifier } from 'vscode-languageclient';
|
||||
import { Server } from '../server';
|
||||
|
||||
interface ExtendSelectionParams {
|
||||
|
@ -13,17 +13,17 @@ interface ExtendSelectionResult {
|
|||
}
|
||||
|
||||
export async function handle() {
|
||||
let editor = vscode.window.activeTextEditor
|
||||
if (editor == null || editor.document.languageId != "rust") return
|
||||
let request: ExtendSelectionParams = {
|
||||
textDocument: { uri: editor.document.uri.toString() },
|
||||
const editor = vscode.window.activeTextEditor;
|
||||
if (editor == null || editor.document.languageId != 'rust') { return; }
|
||||
const request: ExtendSelectionParams = {
|
||||
selections: editor.selections.map((s) => {
|
||||
return Server.client.code2ProtocolConverter.asRange(s)
|
||||
})
|
||||
}
|
||||
let response = await Server.client.sendRequest<ExtendSelectionResult>("m/extendSelection", request)
|
||||
return Server.client.code2ProtocolConverter.asRange(s);
|
||||
}),
|
||||
textDocument: { uri: editor.document.uri.toString() },
|
||||
};
|
||||
const response = await Server.client.sendRequest<ExtendSelectionResult>('m/extendSelection', request);
|
||||
editor.selections = response.selections.map((range: Range) => {
|
||||
let r = Server.client.protocol2CodeConverter.asRange(range)
|
||||
return new vscode.Selection(r.start, r.end)
|
||||
})
|
||||
const r = Server.client.protocol2CodeConverter.asRange(range);
|
||||
return new vscode.Selection(r.start, r.end);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue