回答編集履歴
1
コードを改善
test
CHANGED
@@ -12,10 +12,20 @@
|
|
12
12
|
|
13
13
|
```js
|
14
14
|
|
15
|
-
vscode.window.onDidChangeTextEditorSelection(event => {
|
15
|
+
const disposable = vscode.window.onDidChangeTextEditorSelection(event => {
|
16
16
|
|
17
|
+
if (event.textEditor.selection.isEmpty) {
|
18
|
+
|
19
|
+
// カーソルを移動するとカーソルの位置で空の選択範囲が変化したイベントが発生する。空なら無視する。
|
20
|
+
|
21
|
+
return
|
22
|
+
|
23
|
+
}
|
24
|
+
|
17
|
-
const str = event.textEditor.document.getText(event.textEditor.selection)
|
25
|
+
const str = event.textEditor.document.getText(event.textEditor.selection)
|
18
26
|
|
19
27
|
})
|
20
28
|
|
29
|
+
context.subscriptions.push(disposable)
|
30
|
+
|
21
31
|
```
|