Files
rust/editors/code/src/commands/index.ts

53 lines
1.4 KiB
TypeScript
Raw Normal View History

2019-12-30 20:07:04 +01:00
import * as vscode from 'vscode';
import * as lc from 'vscode-languageclient';
2019-12-30 18:31:08 +01:00
import { Ctx, Cmd } from '../ctx';
import * as sourceChange from '../source_change';
2019-12-30 14:53:43 +01:00
2019-12-30 14:42:59 +01:00
import { analyzerStatus } from './analyzer_status';
2019-12-30 15:20:13 +01:00
import { matchingBrace } from './matching_brace';
2019-12-30 15:50:15 +01:00
import { joinLines } from './join_lines';
2019-12-30 16:43:34 +01:00
import { onEnter } from './on_enter';
2019-12-30 17:03:05 +01:00
import { parentModule } from './parent_module';
2019-12-30 19:05:41 +01:00
import { syntaxTree } from './syntax_tree';
2019-12-30 19:30:30 +01:00
import { expandMacro } from './expand_macro';
2019-12-30 19:58:44 +01:00
import { run, runSingle } from './runnables';
2018-10-08 20:18:55 +02:00
2019-12-30 14:53:43 +01:00
function collectGarbage(ctx: Ctx): Cmd {
2019-12-30 18:31:08 +01:00
return async () => {
ctx.client.sendRequest<null>('rust-analyzer/collectGarbage', null);
};
2019-12-30 14:53:43 +01:00
}
2019-12-30 20:07:04 +01:00
function showReferences(ctx: Ctx): Cmd {
return (uri: string, position: lc.Position, locations: lc.Location[]) => {
vscode.commands.executeCommand(
'editor.action.showReferences',
vscode.Uri.parse(uri),
ctx.client.protocol2CodeConverter.asPosition(position),
locations.map(ctx.client.protocol2CodeConverter.asLocation),
);
};
}
function applySourceChange(ctx: Ctx): Cmd {
return async (change: sourceChange.SourceChange) => {
sourceChange.applySourceChange(ctx, change);
}
}
2018-10-08 20:18:55 +02:00
export {
2019-01-23 00:15:03 +03:00
analyzerStatus,
2019-11-18 02:47:50 +08:00
expandMacro,
2018-10-08 20:18:55 +02:00
joinLines,
matchingBrace,
parentModule,
syntaxTree,
2019-07-23 16:38:21 +03:00
onEnter,
2019-12-30 18:31:08 +01:00
collectGarbage,
2019-12-30 19:58:44 +01:00
run,
2019-12-30 20:07:04 +01:00
runSingle,
showReferences,
applySourceChange,
2018-10-08 20:18:55 +02:00
};