diff --git a/editors/code/src/commands/index.ts b/editors/code/src/commands/index.ts index 4501809e2e..5a4c1df5e0 100644 --- a/editors/code/src/commands/index.ts +++ b/editors/code/src/commands/index.ts @@ -4,22 +4,22 @@ import * as lc from 'vscode-languageclient'; import { Ctx, Cmd } from '../ctx'; import * as sourceChange from '../source_change'; -import { analyzerStatus } from './analyzer_status'; -import { matchingBrace } from './matching_brace'; -import { joinLines } from './join_lines'; -import { onEnter } from './on_enter'; -import { parentModule } from './parent_module'; -import { syntaxTree } from './syntax_tree'; -import { expandMacro } from './expand_macro'; -import { run, runSingle } from './runnables'; +export * from './analyzer_status'; +export * from './matching_brace'; +export * from './join_lines'; +export * from './on_enter'; +export * from './parent_module'; +export * from './syntax_tree'; +export * from './expand_macro'; +export * from './runnables'; -function collectGarbage(ctx: Ctx): Cmd { +export function collectGarbage(ctx: Ctx): Cmd { return async () => { ctx.client?.sendRequest('rust-analyzer/collectGarbage', null); }; } -function showReferences(ctx: Ctx): Cmd { +export function showReferences(ctx: Ctx): Cmd { return (uri: string, position: lc.Position, locations: lc.Location[]) => { const client = ctx.client; if (client) { @@ -33,13 +33,13 @@ function showReferences(ctx: Ctx): Cmd { }; } -function applySourceChange(ctx: Ctx): Cmd { +export function applySourceChange(ctx: Ctx): Cmd { return async (change: sourceChange.SourceChange) => { sourceChange.applySourceChange(ctx, change); }; } -function selectAndApplySourceChange(ctx: Ctx): Cmd { +export function selectAndApplySourceChange(ctx: Ctx): Cmd { return async (changes: sourceChange.SourceChange[]) => { if (changes.length === 1) { await sourceChange.applySourceChange(ctx, changes[0]); @@ -51,26 +51,9 @@ function selectAndApplySourceChange(ctx: Ctx): Cmd { }; } -function reload(ctx: Ctx): Cmd { +export function reload(ctx: Ctx): Cmd { return async () => { vscode.window.showInformationMessage('Reloading rust-analyzer...'); await ctx.restartServer(); }; } - -export { - analyzerStatus, - expandMacro, - joinLines, - matchingBrace, - parentModule, - syntaxTree, - onEnter, - collectGarbage, - run, - runSingle, - showReferences, - applySourceChange, - selectAndApplySourceChange, - reload -}; diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts index b882a8e52f..094566d09f 100644 --- a/editors/code/src/ctx.ts +++ b/editors/code/src/ctx.ts @@ -66,7 +66,9 @@ export class Ctx { this.pushCleanup(d); } catch (_) { vscode.window.showWarningMessage( - 'Enhanced typing feature is disabled because of incompatibility with VIM extension, consider turning off rust-analyzer.enableEnhancedTyping: https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/README.md#settings', + 'Enhanced typing feature is disabled because of incompatibility ' + + 'with VIM extension, consider turning off rust-analyzer.enableEnhancedTyping: ' + + 'https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/README.md#settings', ); } } diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts index 0494ccf63f..de45f660bf 100644 --- a/editors/code/src/main.ts +++ b/editors/code/src/main.ts @@ -11,7 +11,7 @@ let ctx!: Ctx; export async function activate(context: vscode.ExtensionContext) { ctx = new Ctx(context); - // Commands which invokes manually via command pallet, shortcut, etc. + // Commands which invokes manually via command pallete, shortcut, etc. ctx.registerCommand('analyzerStatus', commands.analyzerStatus); ctx.registerCommand('collectGarbage', commands.collectGarbage); ctx.registerCommand('matchingBrace', commands.matchingBrace);