use dot access on activeTextEditor
This commit is contained in:
@@ -31,12 +31,11 @@
|
|||||||
* Helper functions
|
* Helper functions
|
||||||
*/
|
*/
|
||||||
(function selectedText []
|
(function selectedText []
|
||||||
(if (and activeTextEditor .selection activeTextEditor)
|
(if (and activeTextEditor activeTextEditor.selection)
|
||||||
(let [document
|
(let [document
|
||||||
// TODO should be able to use activeTextEditor.document and have the alias still work
|
activeTextEditor.document
|
||||||
.document activeTextEditor
|
|
||||||
selection
|
selection
|
||||||
.selection activeTextEditor
|
activeTextEditor.selection
|
||||||
range (new Range selection.start selection.end)]
|
range (new Range selection.start selection.end)]
|
||||||
(document.getText range))
|
(document.getText range))
|
||||||
""))
|
""))
|
||||||
@@ -118,7 +117,9 @@
|
|||||||
(function :Void showShortcutPanel [&opt :Map<String,ShortcutKey> prefixMap]
|
(function :Void showShortcutPanel [&opt :Map<String,ShortcutKey> prefixMap]
|
||||||
// Preserve the selected text and focused document before opening the webview:
|
// Preserve the selected text and focused document before opening the webview:
|
||||||
(whenLet [text (selectedText)] (set selectedTextBeforeShortcut text))
|
(whenLet [text (selectedText)] (set selectedTextBeforeShortcut text))
|
||||||
(when activeTextEditor (set documentBeforeShortcut activeTextEditor.document))
|
(if activeTextEditor
|
||||||
|
(set documentBeforeShortcut activeTextEditor.document)
|
||||||
|
(set documentBeforeShortcut null))
|
||||||
|
|
||||||
// When called without a prefixMap, if a shortcut panel is still open, close it and start over:
|
// When called without a prefixMap, if a shortcut panel is still open, close it and start over:
|
||||||
(unless prefixMap
|
(unless prefixMap
|
||||||
@@ -146,8 +147,10 @@
|
|||||||
(showShortcutPanel innerMap))
|
(showShortcutPanel innerMap))
|
||||||
((Final command)
|
((Final command)
|
||||||
(shortcutPanel.dispose)
|
(shortcutPanel.dispose)
|
||||||
(awaitLet [_ (Vscode.window.showTextDocument documentBeforeShortcut)]
|
(if documentBeforeShortcut
|
||||||
(_runCommand command selectedTextBeforeShortcut))))
|
(awaitLet [_ (Vscode.window.showTextDocument documentBeforeShortcut)]
|
||||||
|
(_runCommand command selectedTextBeforeShortcut)))
|
||||||
|
(_runCommand command selectedTextBeforeShortcut)))
|
||||||
}
|
}
|
||||||
|
|
||||||
(warningMessage "$key is not mapped to a shortcut in this context")))))
|
(warningMessage "$key is not mapped to a shortcut in this context")))))
|
||||||
|
Reference in New Issue
Block a user