aboutsummaryrefslogtreecommitdiff
path: root/code
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-16 11:46:31 +0100
committerAleksey Kladov <[email protected]>2018-08-16 11:46:31 +0100
commite0a43a159d03a91d8cce07003d427df4f3d6966d (patch)
treedf27d9ea58452d447ad6614134f91fad9a583e8d /code
parenteda52cbc348f37c1ae4391da901b2d605e161716 (diff)
vscode moves cursor
Diffstat (limited to 'code')
-rw-r--r--code/.vscode/launch.json4
-rw-r--r--code/src/extension.ts10
2 files changed, 12 insertions, 2 deletions
diff --git a/code/.vscode/launch.json b/code/.vscode/launch.json
index 64f2c3693..5e615ad4c 100644
--- a/code/.vscode/launch.json
+++ b/code/.vscode/launch.json
@@ -9,10 +9,10 @@
9 "type": "extensionHost", 9 "type": "extensionHost",
10 "request": "launch", 10 "request": "launch",
11 "runtimeExecutable": "${execPath}", 11 "runtimeExecutable": "${execPath}",
12 "args": ["--extensionDevelopmentPath=${workspaceRoot}"], 12 "args": ["--extensionDevelopmentPath='./'"],
13 "stopOnEntry": false, 13 "stopOnEntry": false,
14 "sourceMaps": true, 14 "sourceMaps": true,
15 "outFiles": [ "${workspaceRoot}/out/src/**/*.js" ], 15 "outFiles": [ "./out/src/**/*.js" ],
16 "preLaunchTask": "npm" 16 "preLaunchTask": "npm"
17 }, 17 },
18 ] 18 ]
diff --git a/code/src/extension.ts b/code/src/extension.ts
index afcbccf63..95305db2d 100644
--- a/code/src/extension.ts
+++ b/code/src/extension.ts
@@ -111,6 +111,16 @@ function startServer() {
111 ) 111 )
112 } 112 }
113 ) 113 )
114 client.onRequest(
115 new lc.RequestType<lc.Position, void, any, any>("m/moveCursor"),
116 (params: lc.Position, token: lc.CancellationToken) => {
117 let editor = vscode.window.activeTextEditor;
118 if (editor == null) return
119 if (!editor.selection.isEmpty) return
120 let position = client.protocol2CodeConverter.asPosition(params)
121 editor.selection = new vscode.Selection(position, position);
122 }
123 )
114 }) 124 })
115 client.start(); 125 client.start();
116} 126}