From b70ad7e5f3d524204fab88fe2a8c5a6fbef9e88e Mon Sep 17 00:00:00 2001 From: Gregoire Geis Date: Mon, 3 Feb 2020 20:24:50 +0100 Subject: Remove enableEnhancedTyping and type overriding infrastructure. --- editors/code/package.json | 5 ----- editors/code/src/commands/on_enter.ts | 10 +--------- editors/code/src/ctx.ts | 24 ------------------------ editors/code/src/main.ts | 3 --- 4 files changed, 1 insertion(+), 41 deletions(-) (limited to 'editors') diff --git a/editors/code/package.json b/editors/code/package.json index 05f55cb35..421124764 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -167,11 +167,6 @@ "default": {}, "description": "Fine grained feature flags to disable annoying features" }, - "rust-analyzer.enableEnhancedTyping": { - "type": "boolean", - "default": false, - "description": "Enables enhanced typing. NOTE: If using a VIM extension, you should set this to false" - }, "rust-analyzer.raLspServerPath": { "type": [ "string" diff --git a/editors/code/src/commands/on_enter.ts b/editors/code/src/commands/on_enter.ts index 1b3d3d741..ac582b423 100644 --- a/editors/code/src/commands/on_enter.ts +++ b/editors/code/src/commands/on_enter.ts @@ -26,17 +26,9 @@ async function handleKeypress(ctx: Ctx) { return true; } -export function onEnterOverride(ctx: Ctx): Cmd { - return async (event: { text: string }) => { - if (event.text === '\n') { - handleKeypress(ctx); - } - }; -} - export function onEnter(ctx: Ctx): Cmd { return async () => { - if (handleKeypress(ctx)) return; + if (await handleKeypress(ctx)) return; await vscode.commands.executeCommand('default:type', { text: '\n' }); }; diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts index 05d21ae56..aa75943bf 100644 --- a/editors/code/src/ctx.ts +++ b/editors/code/src/ctx.ts @@ -50,30 +50,6 @@ export class Ctx { this.pushCleanup(d); } - overrideCommand(name: string, factory: (ctx: Ctx) => Cmd) { - const defaultCmd = `default:${name}`; - const override = factory(this); - const original = (...args: unknown[]) => - vscode.commands.executeCommand(defaultCmd, ...args); - try { - const d = vscode.commands.registerCommand( - name, - async (...args: unknown[]) => { - if (!(await override(...args))) { - return await original(...args); - } - }, - ); - 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', - ); - } - } - get subscriptions(): Disposable[] { return this.extCtx.subscriptions; } diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts index 5c061e72f..efc31b2e2 100644 --- a/editors/code/src/main.ts +++ b/editors/code/src/main.ts @@ -29,9 +29,6 @@ export async function activate(context: vscode.ExtensionContext) { ctx.registerCommand('applySourceChange', commands.applySourceChange); ctx.registerCommand('selectAndApplySourceChange', commands.selectAndApplySourceChange); - if (ctx.config.enableEnhancedTyping) { - ctx.overrideCommand('type', commands.onEnterOverride); - } activateStatusDisplay(ctx); activateHighlighting(ctx); -- cgit v1.2.3