mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Remove enableEnhancedTyping and type overriding infrastructure.
This commit is contained in:
parent
58c007674b
commit
b70ad7e5f3
4 changed files with 1 additions and 41 deletions
|
@ -167,11 +167,6 @@
|
||||||
"default": {},
|
"default": {},
|
||||||
"description": "Fine grained feature flags to disable annoying features"
|
"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": {
|
"rust-analyzer.raLspServerPath": {
|
||||||
"type": [
|
"type": [
|
||||||
"string"
|
"string"
|
||||||
|
|
|
@ -26,17 +26,9 @@ async function handleKeypress(ctx: Ctx) {
|
||||||
return true;
|
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 {
|
export function onEnter(ctx: Ctx): Cmd {
|
||||||
return async () => {
|
return async () => {
|
||||||
if (handleKeypress(ctx)) return;
|
if (await handleKeypress(ctx)) return;
|
||||||
|
|
||||||
await vscode.commands.executeCommand('default:type', { text: '\n' });
|
await vscode.commands.executeCommand('default:type', { text: '\n' });
|
||||||
};
|
};
|
||||||
|
|
|
@ -50,30 +50,6 @@ export class Ctx {
|
||||||
this.pushCleanup(d);
|
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[] {
|
get subscriptions(): Disposable[] {
|
||||||
return this.extCtx.subscriptions;
|
return this.extCtx.subscriptions;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,9 +29,6 @@ export async function activate(context: vscode.ExtensionContext) {
|
||||||
ctx.registerCommand('applySourceChange', commands.applySourceChange);
|
ctx.registerCommand('applySourceChange', commands.applySourceChange);
|
||||||
ctx.registerCommand('selectAndApplySourceChange', commands.selectAndApplySourceChange);
|
ctx.registerCommand('selectAndApplySourceChange', commands.selectAndApplySourceChange);
|
||||||
|
|
||||||
if (ctx.config.enableEnhancedTyping) {
|
|
||||||
ctx.overrideCommand('type', commands.onEnterOverride);
|
|
||||||
}
|
|
||||||
activateStatusDisplay(ctx);
|
activateStatusDisplay(ctx);
|
||||||
|
|
||||||
activateHighlighting(ctx);
|
activateHighlighting(ctx);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue