]> git.lizzy.rs Git - rust.git/commitdiff
Remove enableEnhancedTyping and type overriding infrastructure.
authorGregoire Geis <git@gregoirege.is>
Mon, 3 Feb 2020 19:24:50 +0000 (20:24 +0100)
committerGregoire Geis <git@gregoirege.is>
Mon, 3 Feb 2020 19:24:50 +0000 (20:24 +0100)
editors/code/package.json
editors/code/src/commands/on_enter.ts
editors/code/src/ctx.ts
editors/code/src/main.ts

index 05f55cb35ceb9187e5be43c6cc27a151c695a8cd..421124764071b8e635822145359a281389acc675 100644 (file)
                     "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"
index 1b3d3d741c33da19bc54a7c8f0e685645327da3b..ac582b4230343c78223f84c2f9c00dcd56d25020 100644 (file)
@@ -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' });
     };
index 05d21ae56f62da85c0fd6f66aad0edbf327c7bce..aa75943bfdb8003f12c3ea24474afa12b4e06c82 100644 (file)
@@ -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;
     }
index 5c061e72fd3cd80a9b98a4f8cd634af754cf4c4d..efc31b2e24507d828c858206151e0274fcbcdbbb 100644 (file)
@@ -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);