1 import * as vscode from 'vscode';
2 import * as lc from 'vscode-languageclient';
3 import { Server } from '../server';
5 handle as applySourceChange,
7 } from './apply_source_change';
9 interface OnEnterParams {
10 textDocument: lc.TextDocumentIdentifier;
11 position: lc.Position;
14 export async function handle(event: { text: string }): Promise<boolean> {
15 const editor = vscode.window.activeTextEditor;
18 editor.document.languageId !== 'rust' ||
23 const request: OnEnterParams = {
24 textDocument: { uri: editor.document.uri.toString() },
25 position: Server.client.code2ProtocolConverter.asPosition(
26 editor.selection.active
29 const change = await Server.client.sendRequest<undefined | SourceChange>(
36 await applySourceChange(change);