Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Location of the remote workspace/folder dictionary. #566

Open
kkm000 opened this issue Nov 23, 2023 · 2 comments
Open

Location of the remote workspace/folder dictionary. #566

kkm000 opened this issue Nov 23, 2023 · 2 comments

Comments

@kkm000
Copy link

kkm000 commented Nov 23, 2023

I'm running VSCode on Windows 11 v10.0.22621.2715, but developing on a remote Linux machine over a devtunnel (Debian 12, x64). The README says:

All the extension's commands add words to two main files, user and workspace dictionaries, both contained in spellright.dict files, one located in user settings folder and the other in workspace settings folder (.vscode). I'm using an implicit, single-folder workspace (i.e, "Open folder", not "Open workspace").

Indeed, when I added an empty spellright.dict file under .vscode/, a new menu option appeared: in addition to "Add XXX to user dictionary", there is also "Add XXX to workspace dictionary". However, when I'm trying to add a word to workspace dictionary, I'm getting an error banner in the lower-right corner of VSCode frame, with the red circled ×: "A system error occurred (ENOENT: no such file or directory, open)".

The Extension Host output logs the following stack trace, twice (I cleared the window before selecting the "add ... to workspace ..." menu item):

2023-11-22 19:20:04.908 [error] Error: ENOENT: no such file or directory, open
	at Object.openSync (node:fs:603:3)
	at Object.func [as openSync] (node:electron/js2c/asar_bundle:2:1869)
	at SpellRight.addWordToDictionary (c:\Users\kkm\.vscode\extensions\ban.spellright-3.0.118\src\spellright.js:1832:29)
	at SpellRight.addWordToWorkspaceDictionary (c:\Users\kkm\.vscode\extensions\ban.spellright-3.0.118\src\spellright.js:1843:22)
	at SpellRight.addToWorkspaceDictionaryCodeAction (c:\Users\kkm\.vscode\extensions\ban.spellright-3.0.118\src\spellright.js:1737:19)
	at i.h (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:125:139669)
	at i.g (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:125:138661)
	at i.executeCommand (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:125:138568)
	at s.h (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:125:142019)
	at i.h (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:125:139669)
	at i.$executeContributedCommand (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:125:140529)
	at n.S (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:134:10836)
	at n.Q (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:134:10602)
	at n.M (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:134:9686)
	at n.L (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:134:8762)
	at h.value (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:134:7565)
	at c.y (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:80:1902)
	at c.fire (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:80:2119)
	at d.fire (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:96:14047)
	at h.value (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:153:7918)
	at c.y (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:80:1902)
	at c.fire (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:80:2119)
	at d.fire (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:96:14047)
	at MessagePortMain.<anonymous> (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:153:6198)
	at MessagePortMain.emit (node:events:513:28)
	at MessagePortMain._internalPort.emit (node:electron/js2c/utility_init:2:367) spellright.addToWorkspaceDictionaryCodeAction {"value":"ban.spellright","_lower":"ban.spellright"}
2023-11-22 19:20:04.908 [error] Error: ENOENT: no such file or directory, open
	at Object.openSync (node:fs:603:3)
	at Object.func [as openSync] (node:electron/js2c/asar_bundle:2:1869)
	at SpellRight.addWordToDictionary (c:\Users\kkm\.vscode\extensions\ban.spellright-3.0.118\src\spellright.js:1832:29)
	at SpellRight.addWordToWorkspaceDictionary (c:\Users\kkm\.vscode\extensions\ban.spellright-3.0.118\src\spellright.js:1843:22)
	at SpellRight.addToWorkspaceDictionaryCodeAction (c:\Users\kkm\.vscode\extensions\ban.spellright-3.0.118\src\spellright.js:1737:19)
	at i.h (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:125:139669)
	at i.g (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:125:138661)
	at i.executeCommand (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:125:138568)
	at s.h (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:125:142019)
	at i.h (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:125:139669)
	at i.$executeContributedCommand (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:125:140529)
	at n.S (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:134:10836)
	at n.Q (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:134:10602)
	at n.M (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:134:9686)
	at n.L (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:134:8762)
	at h.value (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:134:7565)
	at c.y (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:80:1902)
	at c.fire (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:80:2119)
	at d.fire (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:96:14047)
	at h.value (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:153:7918)
	at c.y (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:80:1902)
	at c.fire (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:80:2119)
	at d.fire (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:96:14047)
	at MessagePortMain.<anonymous> (u:\kkm\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:153:6198)
	at MessagePortMain.emit (node:events:513:28)
	at MessagePortMain._internalPort.emit (node:electron/js2c/utility_init:2:367) spellright.addToWorkspaceDictionaryCodeAction undefined

Unfortunately, there is no clue as to what exact file the extension is trying to open.

Adding words to the user dictionary (on the local Windows machine) works just fine.

What surprised me was that the extension is hosted in the local Extension Host. As expected, the "Extension Host (Remote)" output logged nothing. But I don't really understand how extensions work, and whether local extensions have access to remote files. Looks like they do, as adding the workspace empty dictionary resulted in adding a new menu item.

Am I doing anything wrong?


UPDATE:

I rigged the function `addWordToDictionary(word, filename) at line 1830 to log arguments. The filename argument ended up empty.

    SpellRight.prototype.addWordToDictionary = function (word, filename) {
        console.log("addWordToDictionary(", word, filename, ")")
        if (!fs.existsSync(filename)) {
            console.log("addWordToDictionary thinks fs.existsSync(filename) is false")
            fs.closeSync(fs.openSync(filename, 'w'));
        }

        fs.appendFileSync(filename, word + os.EOL);
    }

Output to dev tools console (the word I tried to add was "tf"):

console.ts:137 [Extension Host] addWordToDictionary( tf  )
console.ts:137 [Extension Host] addWordToDictionary thinks fs.existsSync(filename) is false
notificationsAlerts.ts:42 A system error occurred (ENOENT: no such file or directory, open)

Tangentially, os.EOL refers to which os? I think that '\n' works on any os. I long ago set all defaults (VSCode, Visual Studio 2022, Notepad++) on Windows to LF line ending, never saw any issues. But Linux gets very angry at "\r\n".

@dzerrenner
Copy link

I'm running into this too. Same setup: VSCode remote ssh and trying to add a word to the workspace dictionary.
To me it seems too that the extension is run locally and thus tries to access the linux path on the windows host. It determines the path in

SpellRight.prototype.getWorkspaceDictionaryPath = function () {
But I don't know why the path is not correct.

@kkm000
Copy link
Author

kkm000 commented Dec 9, 2023

@dzerrenner Yeah possibly. There appears to be the remote fs API, but it's extremely poor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants