bartosz-antosik / vscode-spellright

Multilingual, Offline and Lightweight Spellchecker for Visual Studio Code
Other
360 stars 37 forks source link

SpellRight doesn't work: dictionary.replace is not a function #342

Open Tututuu opened 4 years ago

Tututuu commented 4 years ago

After the recent update of vscode, spellright does not work on my computer on which it works perfectly previously. I tried reinstall the dictionary and the extension but none of them works. Do you have any idea what I can do? Thank you very much!

I use the latest version of spellright and vscode on windows. The language I want to do spell check is English.

The message in the developer tool is:

workbench.desktop.main.js:3628 [[object Object]]dictionary.replace is not a function

TypeError: dictionary.replace is not a function at c:\Users\瀚垚.vscode\extensions\ban.spellright-3.0.50\src\spellright.js:504:42 at Array.forEach () at SpellRight.checkDictionary (c:\Users\瀚垚.vscode\extensions\ban.spellright-3.0.50\src\spellright.js:502:22) at c:\Users\瀚垚.vscode\extensions\ban.spellright-3.0.50\src\spellright.js:1463:27 at LaTeX._parse (c:\Users\瀚垚.vscode\extensions\ban.spellright-3.0.50\lib\parsers\latex.js:199:21) at LaTeX.parseForCommands (c:\Users\瀚垚.vscode\extensions\ban.spellright-3.0.50\lib\parser.js:73:21) at SpellRight.doInitiateSpellCheck (c:\Users\瀚垚.vscode\extensions\ban.spellright-3.0.50\src\spellright.js:1427:27) at SpellRight. (c:\Users\瀚垚.vscode\extensions\ban.spellright-3.0.50\src\spellright.js:129:18) at l.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:48:561) at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:561:488 at l.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:48:541) at g.$acceptDocumentsAndEditorsDelta (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:565:720) at p._doInvokeHandler (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:676:202) at p._invokeHandler (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:675:901) at p._receiveRequest (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:674:545) at p.receiveOneMessage (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:673:373) at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:671:588 at l.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:48:541) at .fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:190:934) at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:838:649 at l.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:48:541) at _.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:190:934) at t.PersistentProtocol._receiveMessage (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:195:277) at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:192:459 at l.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:48:541) at p.acceptChunk (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:188:445) at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:187:796 at Socket.t (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:196:732) at Socket.emit (events.js:200:13) at addChunk (_stream_readable.js:294:12) at readableAddChunk (_stream_readable.js:275:11) at Socket.Readable.push (_stream_readable.js:210:10) at Pipe.onStreamRead (internal/stream_base_commons.js:166:17) $onExtensionRuntimeError @ workbench.desktop.main.js:3628

memeplex commented 4 years ago

I'm having the same problem, the extension is not working at all. I'm using latest vscode version as of today.

memeplex commented 4 years ago

Ok, I think my issue was https://github.com/bartosz-antosik/vscode-spellright/issues/340 instead. (maybe this should be documented very clearly because it's a very confusing behavior)

bartosz-antosik commented 4 years ago

Hi @Tututuu! Could you tell me whether you use SpellRight with windows spelling backend (I mean you do not have Hunspell forced)? If so could you please tell me what languages you have installed in Windows speller?

Tututuu commented 4 years ago

Thanks @bartosz-antosik . I don't know what you're exactly talking about. But I assume I don't use Hunspell as I don't even know what it is. I have installed English and Chinese language package on my os.

Tututuu commented 4 years ago

Update: SpellRight seems only to not work on some LaTeX files, while for other ones it works perfectly. And if I open a new LaTeX file (under the same directory of that not working), it seems to be always working, and those not working are only some of the old files.

Tututuu commented 4 years ago

I tested this error again, and find that one I type a % into vscode, the console will elicit the above error, and SpellRight will not work any more. I think this could be useful for you @bartosz-antosik .

crystalfp commented 2 years ago

Same problem for me, but manifests itself by not spelling Typescript comment or everything in Vue components. Instead, it works perfectly in markdown files. Languages installed are Italian and English. The stack trace is:

[2022-01-27 05:30:27.768] [exthost] [error] Activating extension ban.spellright failed due to an error:
[2022-01-27 05:30:27.768] [exthost] [error] TypeError: dictionary.replace is not a function
    at c:\Users\mvalle\.vscode\extensions\ban.spellright-3.0.60\src\spellright.js:504:42
    at Array.forEach (<anonymous>)
    at SpellRight.checkDictionary (c:\Users\mvalle\.vscode\extensions\ban.spellright-3.0.60\src\spellright.js:502:22)
    at c:\Users\mvalle\.vscode\extensions\ban.spellright-3.0.60\src\spellright.js:1463:27
    at Code._parse (c:\Users\mvalle\.vscode\extensions\ban.spellright-3.0.60\lib\parsers\code.js:118:9)
    at Code.parseForCommands (c:\Users\mvalle\.vscode\extensions\ban.spellright-3.0.60\lib\parser.js:73:21)
    at SpellRight.doInitiateSpellCheck (c:\Users\mvalle\.vscode\extensions\ban.spellright-3.0.60\src\spellright.js:1427:27)
    at SpellRight.doInitiateSpellCheckVisible (c:\Users\mvalle\.vscode\extensions\ban.spellright-3.0.60\src\spellright.js:1348:22)
    at SpellRight.activate (c:\Users\mvalle\.vscode\extensions\ban.spellright-3.0.60\src\spellright.js:156:14)
    at activate (c:\Users\mvalle\.vscode\extensions\ban.spellright-3.0.60\src\extension.js:38:16)
    at Function._callActivateOptional (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:100:15293)
    at Function._callActivate (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:100:14966)
    at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:100:13144
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Promise.all (index 3)
    at async Promise.all (index 0)

Ad the relevant (I think) part of the configuration is:

"spellright.documentTypes": [
        "latex",
        "plaintext",
        "typescript",
        "jsonc",
        "markdown",
        "todo",
        "vue"
    ],
    "spellright.spellContextByClass": {
        "typescript": "comments",
        "vue": "comments"
    },
    "spellright.languageContextByClass": {
        "typescript": {
            "comments": ["en"]
        },
        "jsonc": {
            "comments": ["en"]
        },
        "vue": {
            "comments": ["en"]
        }
    },

I'm running latest extension version (3.0.60) on Windows 11 and VSC 1.63.2 Thanks for looking! mario

crystalfp commented 2 years ago

BTW, why the line 504 of spellright.js, where the problem happens, is inside the forEach?

            var _dictionary = dictionary.replace(/_/g, '-');

I know with var the variable definition is moved at the beginning of the function, but it mildly disturbs me. Have a nice day! mario

crystalfp commented 2 years ago

The problem is still with us with ban.spellright-3.0.64 not spelling comments in typescript and Vue comments.