Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
feat(vscode-plugin): prompt to save untitled when adding to file dict
Matthew Espinof3aaf37f373f
diff --git a/packages/vscode-plugin/src/extension.ts b/packages/vscode-plugin/src/extension.tsindex e57150fe8..d3d0afec3 100644--- a/packages/vscode-plugin/src/extension.ts+++ b/packages/vscode-plugin/src/extension.ts@@ -109,6 +109,28 @@ async function startLanguageServer(): Promise<void> {},};+ client.middleware.executeCommand = (command, args, next) => {+ if (+ command === 'HarperAddToFileDict' &&+ args.find((a) => typeof a === 'string' && a.startsWith('untitled:'))+ ) {+ window+ .showInformationMessage(+ 'Save the file to add words to its file dictionary.',+ 'Save File',+ 'Dismiss',+ )+ .then((selected) => {+ if (selected === 'Save File') {+ commands.executeCommand('workbench.action.files.save');+ }+ });+ return;+ }++ next(command, args);+ };+await client.start();} catch (error) {showError('Failed to start harper-ls', error);