aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/commands/on_enter.ts
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-05-21 13:26:44 +0100
committerAleksey Kladov <[email protected]>2020-05-21 14:08:03 +0100
commit4b495da368162a5b373d078be4ff51e55bffdf69 (patch)
treec35bf74905b9f03343fc10d834926e3457bc181c /editors/code/src/commands/on_enter.ts
parenta4e6963a2313971fe7bbec97d03bc67266ef68a9 (diff)
Transition OnEnter to WorkspaceSnippetEdit
This also changes our handiling of snippet edits on the client side. `editor.insertSnippet` unfortunately forces indentation, which we really don't want to have to deal with. So, let's just implement our manual hacky way of dealing with a simple subset of snippets we actually use in rust-analyzer
Diffstat (limited to 'editors/code/src/commands/on_enter.ts')
-rw-r--r--editors/code/src/commands/on_enter.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/editors/code/src/commands/on_enter.ts b/editors/code/src/commands/on_enter.ts
index 285849db7..a7871c31e 100644
--- a/editors/code/src/commands/on_enter.ts
+++ b/editors/code/src/commands/on_enter.ts
@@ -1,8 +1,8 @@
1import * as vscode from 'vscode'; 1import * as vscode from 'vscode';
2import * as ra from '../rust-analyzer-api'; 2import * as ra from '../rust-analyzer-api';
3 3
4import { applySourceChange } from '../source_change';
5import { Cmd, Ctx } from '../ctx'; 4import { Cmd, Ctx } from '../ctx';
5import { applySnippetWorkspaceEdit } from '.';
6 6
7async function handleKeypress(ctx: Ctx) { 7async function handleKeypress(ctx: Ctx) {
8 const editor = ctx.activeRustEditor; 8 const editor = ctx.activeRustEditor;
@@ -21,7 +21,8 @@ async function handleKeypress(ctx: Ctx) {
21 }); 21 });
22 if (!change) return false; 22 if (!change) return false;
23 23
24 await applySourceChange(ctx, change); 24 const workspaceEdit = client.protocol2CodeConverter.asWorkspaceEdit(change);
25 await applySnippetWorkspaceEdit(workspaceEdit);
25 return true; 26 return true;
26} 27}
27 28