swyphcosmo / vscode-spellchecker

Spell check extension for Visual Studio Code
MIT License
16 stars 10 forks source link

Adding word to dictionary resets word wrapping setting #24

Closed joshilewis closed 7 years ago

joshilewis commented 7 years ago

I have word wrapping enabled. If I add a word to the dictionary, the word wrapping gets reset to no word wrapping. I'm on version 1.2.5 VSCode 1.7.2 on Windows 10

swyphcosmo commented 7 years ago

@joshilewis Can you attach a copy of your settings.json file before and after adding a word to be always ignored?

joshilewis commented 7 years ago

@swyphcosmo before and after 'always ignore' or 'add to dictionary'?

swyphcosmo commented 7 years ago

Which one are you having problems with? It should only be always ignore that changes your user settings.

joshilewis commented 7 years ago

having issues when I add a word to the dictionary, using the light bulb

swyphcosmo commented 7 years ago

That's weird. Can you send your user settings file and the spell check files before and after adding a word to the dictionary? I have word wrapping set as well, but I haven't had this issue.

joshilewis commented 7 years ago

ok, will do

rotemdan commented 7 years ago

I'm consistently experiencing this issue, but only after using "Always ignore". Using "Add to dictionary" doesn't seem to trigger it. I tried to clear all custom settings from settings.json (apart from the extension's own settings) and reopening VSCode several times but it didn't make any difference.

swyphcosmo commented 7 years ago

To help track this down, would you send me your settings files as well as the debug output from the extension? Here's how you get that:

rotemdan commented 7 years ago

I can reproduce the problem on latest VSCode insiders (Windows 10 x64), with an empty settings.json looking like this:

// Place your settings in this file to overwrite the default settings
{
}

The only extension installed is this one. Color scheme is "quite light" but I tried other ones and it didn't seem to make much difference.

Just trying typing different random long words on a workspace with a single text file. Deleting the workspace settings and bringing it back, adding random words to the ignore list. I also got to a state where the light bulb stopped showing entirely, even after closing all instances of VSCode and reopening again several times.

There are multiple error messages in the console happening at various occasions:

This:

shell.ts:423 Cannot read property 'forEach' of null: TypeError: Cannot read property 'forEach' of null
    at SpellCheckerProvider.provideCodeActions (C:\Users\X\.vscode-insiders\extensions\swyphcosmo.spellchecker-1.2.6\out\src\features\SpellCheckerProvider.js:341:18)
    at c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:11:20278
    at c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:6:8985
    at new n.Class.derive._oncancel (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:6:5089)
    at Object.f [as asWinJsPromise] (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:6:8948)
    at e.provideCodeActions (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:11:20232)
    at c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:11:29355
    at t._withAdapter (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:11:26601)
    at t.$provideCodeActions (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:11:29317)
    at t.e.handle (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:10:3406)e.onUnexpectedError @ shell.ts:423(anonymous function) @ shell.ts:378e.onUnexpectedExternalError @ errors.ts:74s @ errors.ts:96(anonymous function) @ quickFix.ts:27v @ winjs.base.raw.js:1209enter @ winjs.base.raw.js:901_run @ winjs.base.raw.js:1068_error @ winjs.base.raw.js:1041v @ winjs.base.raw.js:1209enter @ winjs.base.raw.js:901_run @ winjs.base.raw.js:1068_error @ winjs.base.raw.js:1041(anonymous function) @ async.ts:359done @ winjs.base.raw.js:1378v @ winjs.base.raw.js:1224enter @ winjs.base.raw.js:901_run @ winjs.base.raw.js:1068_error @ winjs.base.raw.js:1041e.resolveErr @ ipcRemoteCom.ts:110f @ ipcRemoteCom.ts:198_combinedTickCallback @ internal/process/next_tick.js:67_tickCallback @ internal/process/next_tick.js:98

And this:

shell.ts:423 Cannot read property 'message' of undefined: TypeError: Cannot read property 'message' of undefined
    at SpellCheckerProvider.provideCodeActions (C:\Users\X\.vscode-insiders\extensions\swyphcosmo.spellchecker-1.2.6\out\src\features\SpellCheckerProvider.js:324:31)
    at c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:11:20278
    at c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:6:8985
    at new n.Class.derive._oncancel (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:6:5089)
    at Object.f [as asWinJsPromise] (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:6:8948)
    at e.provideCodeActions (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:11:20232)
    at c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:11:29355
    at t._withAdapter (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:11:26601)
    at t.$provideCodeActions (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:11:29317)
    at t.e.handle (c:\Program Files (x86)\Microsoft VS Code Insiders\resources\app\out\vs\workbench\node\extensionHostProcess.js:10:3406)e.onUnexpectedError @ shell.ts:423(anonymous function) @ shell.ts:378e.onUnexpectedExternalError @ errors.ts:74s @ errors.ts:96(anonymous function) @ quickFix.ts:27v @ winjs.base.raw.js:1209enter @ winjs.base.raw.js:901_run @ winjs.base.raw.js:1068_error @ winjs.base.raw.js:1041v @ winjs.base.raw.js:1209enter @ winjs.base.raw.js:901_run @ winjs.base.raw.js:1068_error @ winjs.base.raw.js:1041(anonymous function) @ async.ts:359done @ winjs.base.raw.js:1378v @ winjs.base.raw.js:1224enter @ winjs.base.raw.js:901_run @ winjs.base.raw.js:1068_error @ winjs.base.raw.js:1041e.resolveErr @ ipcRemoteCom.ts:110f @ ipcRemoteCom.ts:198_combinedTickCallback @ internal/process/next_tick.js:67_tickCallback @ internal/process/next_tick.js:98

I'm not sure these error messages are related to this particular issue. I've also seen the wrapping issue happening without any error message at all. It may be that the insiders build is buggy but I've seen at least one of these error messages in the latest stable VSCode as well.

swyphcosmo commented 7 years ago

@rotemdan Can you attach the entire error output? If you enable the DEBUG setting like I mentioned above, it'll show me the text that you're using so that I can try stepping through to find the issue.

What version of the plugin are you using? I updated it today to 1.2.6. From the output you provided, it looks like you're using that version, but I want to make sure.

For the lines there, I can certainly add in some checks to make sure these errors don't happen (they're edge cases that I missed), but I'm not sure how you were able to pull up codeAction menu when a diagnostic doesn't exist (the first error). I'll have to think on that one.

rotemdan commented 7 years ago

I'm using 1.2.6 on latest stable VSCode here:

Here's a file with random words: a.txt

Here's the console log: -1483654506805.txt

This one doesn't seem to get the light bulb at all when clicking the long word, even after VSCode is restarted: b.txt

It seems very easy to reproduce by playing around. Though when wrapping is reset after clicking "always ignore" I can't see any special error message in the console.

swyphcosmo commented 7 years ago

I just pushed version 1.2.8 (in 1.2.7, I forgot to disable debugging before pushing).

This will fix both the errors that you showed a couple messages above.

With b.txt, the plugin was crashing when trying to print suggested words, when none existed. This only appeared after debugging is enabled. That's why the lightbulb never showed up.

In -14836545006805.txt, I found this line:

[Extension Host] Object {language: "en_US", ignoreWordsList: Array[18], documentTypes: Array[3], ignoreRegExp: Array[0], ignoreFileExtensions: Array[0]…}

The second parameter ignoreWordsList shows that you have 18 words ignored somewhere. Whether in the workspace settings file (from "Add to dictionary") or in the user settings (from "always ignore").

I still haven't been able to reproduce the word wrapping issues. What settings are you using for word wrapping? These are the default values for wrapping:

  // Controls after how many characters the editor will wrap to the next line. Setting this to 0 turns on viewport width wrapping (word wrapping). Setting this to -1 forces the editor to never wrap.
  "editor.wrappingColumn": 300,

  // Controls if lines should wrap. The lines will wrap at min(editor.wrappingColumn, viewportWidthInColumns).
  "editor.wordWrap": false,

  // Controls the indentation of wrapped lines. Can be one of 'none', 'same' or 'indent'.
  "editor.wrappingIndent": "same",

Here is my settings.json:

// Place your settings in this file to overwrite the default settings
{
    "editor.wrappingColumn": 0,
    "editor.insertSpaces": false,
    "files.autoSave": "onFocusChange",
    "editor.tabSize": 4,
    "editor.autoClosingBrackets": false,
    "editor.renderWhitespace": "boundary",
    "spellchecker.ignoreWordsList": [
        "pandoc",
        "Pandoc",
        "VSCode",
        "sdffffffffffsdfsssssssssssssfsdffffffffffffffffffffffffffffffffffffff"
    ]
}

Can you be more specific about how wrapping goes away? Does text not wrap at all? Does the wrapping column change? Does the wrapping indent change?

If you're willing, we could do a Google Hangout or something similar so that you can demonstrate what is happening. Seeing it might be easier than describing it.

Thank you for your help while I try diagnosing this issue.

rotemdan commented 7 years ago

It is consistently happening both on VSCode and VSCode insider, where it is an (almost) clean install with no custom settings at all.

I don't have word wrapping set as a permanent configuration. I simply go to View, Toggle Word Wrap in the menu when I need it. I should have mentioned that before!

If this doesn't help I'll send a screen recording.

swyphcosmo commented 7 years ago

Ahhh, I see. I don't know that it's an issue caused by the plugin. There are a bunch of issues on the vscode repo (https://github.com/Microsoft/vscode) about Word Wrap Toggle being turned off when normal editor actions happen.

You might want to file an issue with them to see if they can solve the issue. I'll keep looking at it, but I'm not sure that I'll be able to fix it from my end.

rotemdan commented 7 years ago

Thanks for your help.

It seems like turning word-wrap on temporarily from the VSCode menu and then manually editing settings.json would reset word wrapping as well. Indeed that might not be related to this particular extention. I'll report it if it hasn't been reported before.

rotemdan commented 7 years ago

I couldn't find a similar issue in the VSCode bug tracker so I opened this one.

swyphcosmo commented 7 years ago

@joshilewis Were you also enabling word wrap through the Toggle Word Wrap command? If so, I'm going to close this issue since @rotemdan created the issue with the vscode repo.

rotemdan commented 7 years ago

I'm testing with the latest VSCode Insider and the issue now seems resolved, at least in the way that I experienced it.

They now added a new global setting editor.wordWrap that is updated whenever the wrapping option is toggled using the menu.

It also turned out that Toggle Render Whitespace and Toggle Control Characters exhibited that same behavior so I reported them as well and they now also update the editor.renderWhitespace, editor.renderControlCharacters global settings correspondingly.

I can't know for sure, though, if @joshilewis is describing the same issue.

swyphcosmo commented 7 years ago

I'm closing this issue due to in activity. If you're still having the issue, feel free to reopen it.