inputEditor allow default contents
This commit is contained in:
@@ -334,12 +334,11 @@
|
||||
(insertAt activeTextEditor.selection.active text))
|
||||
|
||||
// Way to more forgivingly get long text inputs
|
||||
(function :js.lib.Promise<String> inputEditor [:String filename :String prompt]
|
||||
(function :js.lib.Promise<String> inputEditor [:String filename :String prompt &opt :String defaultContent]
|
||||
(let [previousEditor activeTextEditor
|
||||
tempFile (joinPath (userHome) "Documents" filename)
|
||||
uri (if (sys.FileSystem.exists tempFile)
|
||||
(Uri.parse "file:$tempFile")
|
||||
(Uri.parse "untitled:$tempFile"))]
|
||||
tempFile (joinPath (userHome) "Documents" filename)]
|
||||
(sys.io.File.saveContent tempFile (or defaultContent ""))
|
||||
(let [uri (Uri.parse "file:$tempFile")]
|
||||
(new js.lib.Promise
|
||||
->[resolve reject]
|
||||
(awaitLet [doc (openTextDocument uri)
|
||||
@@ -353,7 +352,7 @@
|
||||
(unless (contains visibleEditors editor)
|
||||
(closeEvent.dispose)
|
||||
(awaitLet [_ (showTextDocument previousEditor.document)]
|
||||
(if editor.document.isDirty (let [error "Input editor for $prompt was closed without saving."] (warningMessage error) (reject error)) (resolve (editor.document.getText))))))))))))
|
||||
(if editor.document.isDirty (let [error "Input editor for $prompt was closed without saving."] (warningMessage error) (reject error)) (resolve (editor.document.getText)))))))))))))
|
||||
|
||||
// Open any folder in a fresh VSCode instance.
|
||||
(function openFolder [folder]
|
||||
|
Reference in New Issue
Block a user