Skip to content

Commit b70ad7e

Browse files
committed
Remove enableEnhancedTyping and type overriding infrastructure.
1 parent 58c0076 commit b70ad7e

File tree

4 files changed

+1
-41
lines changed

4 files changed

+1
-41
lines changed

editors/code/package.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,6 @@
167167
"default": {},
168168
"description": "Fine grained feature flags to disable annoying features"
169169
},
170-
"rust-analyzer.enableEnhancedTyping": {
171-
"type": "boolean",
172-
"default": false,
173-
"description": "Enables enhanced typing. NOTE: If using a VIM extension, you should set this to false"
174-
},
175170
"rust-analyzer.raLspServerPath": {
176171
"type": [
177172
"string"

editors/code/src/commands/on_enter.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,9 @@ async function handleKeypress(ctx: Ctx) {
2626
return true;
2727
}
2828

29-
export function onEnterOverride(ctx: Ctx): Cmd {
30-
return async (event: { text: string }) => {
31-
if (event.text === '\n') {
32-
handleKeypress(ctx);
33-
}
34-
};
35-
}
36-
3729
export function onEnter(ctx: Ctx): Cmd {
3830
return async () => {
39-
if (handleKeypress(ctx)) return;
31+
if (await handleKeypress(ctx)) return;
4032

4133
await vscode.commands.executeCommand('default:type', { text: '\n' });
4234
};

editors/code/src/ctx.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -50,30 +50,6 @@ export class Ctx {
5050
this.pushCleanup(d);
5151
}
5252

53-
overrideCommand(name: string, factory: (ctx: Ctx) => Cmd) {
54-
const defaultCmd = `default:${name}`;
55-
const override = factory(this);
56-
const original = (...args: unknown[]) =>
57-
vscode.commands.executeCommand(defaultCmd, ...args);
58-
try {
59-
const d = vscode.commands.registerCommand(
60-
name,
61-
async (...args: unknown[]) => {
62-
if (!(await override(...args))) {
63-
return await original(...args);
64-
}
65-
},
66-
);
67-
this.pushCleanup(d);
68-
} catch (_) {
69-
vscode.window.showWarningMessage(
70-
'Enhanced typing feature is disabled because of incompatibility ' +
71-
'with VIM extension, consider turning off rust-analyzer.enableEnhancedTyping: ' +
72-
'https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/README.md#settings',
73-
);
74-
}
75-
}
76-
7753
get subscriptions(): Disposable[] {
7854
return this.extCtx.subscriptions;
7955
}

editors/code/src/main.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ export async function activate(context: vscode.ExtensionContext) {
2929
ctx.registerCommand('applySourceChange', commands.applySourceChange);
3030
ctx.registerCommand('selectAndApplySourceChange', commands.selectAndApplySourceChange);
3131

32-
if (ctx.config.enableEnhancedTyping) {
33-
ctx.overrideCommand('type', commands.onEnterOverride);
34-
}
3532
activateStatusDisplay(ctx);
3633

3734
activateHighlighting(ctx);

0 commit comments

Comments
 (0)