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

Can not add words to dictionary #286

Open
FalcoGer opened this issue Nov 16, 2023 · 0 comments
Open

Can not add words to dictionary #286

FalcoGer opened this issue Nov 16, 2023 · 0 comments
Labels
1-bug 🐛 Issue type: Bug report (something isn't working as expected) 2-unconfirmed Issue status: Bug that needs to be reproduced (all new bugs have this label)

Comments

@FalcoGer
Copy link

Describe the bug
When using coc.nvim with the coc-ltex module, I can not add words to the user's dictionary.

I usually run vim from whatever path I'm currently in, and I don't want random .vscode directories pop up all over my filesystem, so I have set the configuration targets to be user.

    "ltex.configurationTarget": {
        "dictionary": "user",
        "disabledRules": "user",
        "hiddenFalsePositives": "user"
    },

But then when I try to add a word to the dictionary, I get this exception:

2023-11-16T22:53:44.833 ERROR (pid:1287619) [server] - unhandledRejection  Promise {
  �[36m<rejected>�[39m TypeError: Cannot add property en-US, object is not extensible
      at CommandHandler.<anonymous> (/home/user/.config/coc/extensions/node_modules/�[4mcoc-ltex�[24m/dist/extension.js:17685:40)
      at Generator.next (<anonymous>)
      at /home/user/.config/coc/extensions/node_modules/�[4mcoc-ltex�[24m/dist/extension.js:17111:71
      at new Promise (<anonymous>)
      at __webpack_modules__.1216.__awaiter (/home/user/.config/coc/extensions/node_modules/�[4mcoc-ltex�[24m/dist/extension.js:17107:12)
      at CommandHandler.addToLanguageSpecificSettingInternalSetting (/home/user/.config/coc/extensions/node_modules/�[4mcoc-ltex�[24m/dist/extension.js:17671:16)
      at CommandHandler.addToLanguageSpecificSetting (/home/user/.config/coc/extensions/node_modules/�[4mcoc-ltex�[24m/dist/extension.js:17647:18)
      at CommandHandler.addToDictionary (/home/user/.config/coc/extensions/node_modules/�[4mcoc-ltex�[24m/dist/extension.js:17609:14)
      at HR.execute (/home/user/.vim/plugged/coc.nvim/build/index.js:66:3095)
      at BR.executeCommand (/home/user/.vim/plugged/coc.nvim/build/index.js:66:4200)
} TypeError: Cannot add property en-US, object is not extensible
    at CommandHandler.<anonymous> (/home/user/.config/coc/extensions/node_modules/�[4mcoc-ltex�[24m/dist/extension.js:17685:40)
    at Generator.next (<anonymous>)
    at /home/user/.config/coc/extensions/node_modules/�[4mcoc-ltex�[24m/dist/extension.js:17111:71
    at new Promise (<anonymous>)
    at __webpack_modules__.1216.__awaiter (/home/user/.config/coc/extensions/node_modules/�[4mcoc-ltex�[24m/dist/extension.js:17107:12)
    at CommandHandler.addToLanguageSpecificSettingInternalSetting (/home/user/.config/coc/extensions/node_modules/�[4mcoc-ltex�[24m/dist/extension.js:17671:16)
    at CommandHandler.addToLanguageSpecificSetting (/home/user/.config/coc/extensions/node_modules/�[4mcoc-ltex�[24m/dist/extension.js:17647:18)
    at CommandHandler.addToDictionary (/home/user/.config/coc/extensions/node_modules/�[4mcoc-ltex�[24m/dist/extension.js:17609:14)
    at HR.execute (/home/user/.vim/plugged/coc.nvim/build/index.js:66:3095)
    at BR.executeCommand (/home/user/.vim/plugged/coc.nvim/build/index.js:66:4200)

I have tried setting an external file to be used with

    "ltex.dictionary": {
        "en-US": [
            ":~/.vim/ltex/dict/en_US.txt"
        ],
        "de-DE": [
            ":~/.vim/ltex/dict/de_DE.txt"
        ],
        "en-GB": [
            ":~/.vim/ltex/dict/en_GB.txt"
        ]
    },
    "ltex.enabledRules": {
        "en-US": [
            ":~/.vim/ltex/enabled/en_US.txt"
        ],
        "de-DE": [
            ":~/.vim/ltex/enabled/de_DE.txt"
        ],
        "en-GB": [
            ":~/.vim/ltex/enabled/en_GB.txt"
        ]
    },
    "ltex.disabledRules": {
        "en-US": [
            ":~/.vim/ltex/disabled/en_US.txt"
        ],
        "de-DE": [
            ":~/.vim/ltex/disabled/de_DE.txt"
        ],
        "en-GB": [
            ":~/.vim/ltex/disabled/en_GB.txt"
        ]
    },
    "ltex.hiddenFalsePositives": {
        "en-US": [
            ":~/.vim/ltex/hidden/en_US.txt"
        ],
        "de-DE": [
            ":~/.vim/ltex/hidden/de_DE.txt"
        ],
        "en-GB": [
            ":~/.vim/ltex/hidden/en_GB.txt"
        ]
    },

but then I get a different exception

2023-11-16T22:54:45.990 ERROR (pid:1287619) [server] - unhandledRejection  Promise {
  �[36m<rejected>�[39m TypeError: Cannot assign to read only property 'en-US' of object '[object Object]'
      at CommandHandler.<anonymous> (/home/user/.config/coc/extensions/node_modules/�[4mcoc-ltex�[24m/dist/extension.js:17685:40)
      at Generator.next (<anonymous>)
      at /home/user/.config/coc/extensions/node_modules/�[4mcoc-ltex�[24m/dist/extension.js:17111:71
      at new Promise (<anonymous>)
      at __webpack_modules__.1216.__awaiter (/home/user/.config/coc/extensions/node_modules/�[4mcoc-ltex�[24m/dist/extension.js:17107:12)
      at CommandHandler.addToLanguageSpecificSettingInternalSetting (/home/user/.config/coc/extensions/node_modules/�[4mcoc-ltex�[24m/dist/extension.js:17671:16)
      at CommandHandler.addToLanguageSpecificSetting (/home/user/.config/coc/extensions/node_modules/�[4mcoc-ltex�[24m/dist/extension.js:17647:18)
      at CommandHandler.addToDictionary (/home/user/.config/coc/extensions/node_modules/�[4mcoc-ltex�[24m/dist/extension.js:17609:14)
      at HR.execute (/home/user/.vim/plugged/coc.nvim/build/index.js:66:3095)
      at BR.executeCommand (/home/user/.vim/plugged/coc.nvim/build/index.js:66:4200)
} TypeError: Cannot assign to read only property 'en-US' of object '[object Object]'
    at CommandHandler.<anonymous> (/home/user/.config/coc/extensions/node_modules/�[4mcoc-ltex�[24m/dist/extension.js:17685:40)
    at Generator.next (<anonymous>)
    at /home/user/.config/coc/extensions/node_modules/�[4mcoc-ltex�[24m/dist/extension.js:17111:71
    at new Promise (<anonymous>)
    at __webpack_modules__.1216.__awaiter (/home/user/.config/coc/extensions/node_modules/�[4mcoc-ltex�[24m/dist/extension.js:17107:12)
    at CommandHandler.addToLanguageSpecificSettingInternalSetting (/home/user/.config/coc/extensions/node_modules/�[4mcoc-ltex�[24m/dist/extension.js:17671:16)
    at CommandHandler.addToLanguageSpecificSetting (/home/user/.config/coc/extensions/node_modules/�[4mcoc-ltex�[24m/dist/extension.js:17647:18)
    at CommandHandler.addToDictionary (/home/user/.config/coc/extensions/node_modules/�[4mcoc-ltex�[24m/dist/extension.js:17609:14)
    at HR.execute (/home/user/.vim/plugged/coc.nvim/build/index.js:66:3095)
    at BR.executeCommand (/home/user/.vim/plugged/coc.nvim/build/index.js:66:4200)
2023-11-16T22:54:46.258 INFO (pid:1287619) [attach] - receive notification: highlight []

Stepse to reproduce
Steps to reproduce the behavior:

  1. Open file with grammar mistake in nvim
  2. If required, enable coc-ltex with CocList extensions, select coc-ltex and enter
  3. Wait for the diagnostics to populate
  4. Do a coc-code action at cursor
  5. Select Add to dictionary

Expected behavior
One of the following:

  • The external file listed in CocConfig is changed
  • CocConfig is changed
  • A file in ~/.config/Code/User/globalStorage/valentjn.vscode-ltex/ is created and changed

Sample document

This is a unknownword.

LTeX configuration

```json
    "ltex.enabled": [
        "bibtex",
        "context",
        "context.tex",
        "html",
        "latex",
        "markdown",
        "org",
        "restructuredtext",
        "rsweave",

        "text",

        "shellscript",
        "c",
        "csharp",
        "cpp",
        "javascript",
        "lua",
        "perl",
        "php",
        "powershell",
        "python",
        "ruby",
        "rust",
        "sql",
        "verilog",
        "vb"
    ],
    "ltex.language": "en-US",
    "ltex.sentenceCacheSize": 2000,
    "ltex.dictionary": {
        "en-US": [
            ":~/.vim/ltex/dict/en_US.txt"
        ],
        "de-DE": [
            ":~/.vim/ltex/dict/de_DE.txt"
        ],
        "en-GB": [
            ":~/.vim/ltex/dict/en_GB.txt"
        ]
    },
    "ltex.enabledRules": {
        "en-US": [
            ":~/.vim/ltex/enabled/en_US.txt"
        ],
        "de-DE": [
            ":~/.vim/ltex/enabled/de_DE.txt"
        ],
        "en-GB": [
            ":~/.vim/ltex/enabled/en_GB.txt"
        ]
    },
    "ltex.disabledRules": {
        "en-US": [
            ":~/.vim/ltex/disabled/en_US.txt"
        ],
        "de-DE": [
            ":~/.vim/ltex/disabled/de_DE.txt"
        ],
        "en-GB": [
            ":~/.vim/ltex/disabled/en_GB.txt"
        ]
    },
    "ltex.hiddenFalsePositives": {
        "en-US": [
            ":~/.vim/ltex/hidden/en_US.txt"
        ],
        "de-DE": [
            ":~/.vim/ltex/hidden/de_DE.txt"
        ],
        "en-GB": [
            ":~/.vim/ltex/hidden/en_GB.txt"
        ]
    },
    "ltex.configurationTarget": {
        "dictionary": "user",
        "disabledRules": "user",
        "hiddenFalsePositives": "user"
    },
    "ltex.additionalRules.enablePickyRules": true,
    "ltex.additionalRules.motherTongue": "de-DE",
    "ltex.ltex-ls.logLevel": "warning",
    "ltex.completionEnabled": true,
    "ltex.diagnosticSeverity": {"PASSIVE_VOICE": "hint", "default": "information"},
    "ltex.checkFrequency": "edit",
    "ltex.clearDiagnosticsWhenClosingFile": true,
    "ltex.statusBarItem": false,
    "ltex.trace.server": "off",

LTeX LS log
Paste the log (output) of LTeX LS here:

See above

Version information
List here the version information of the relevant software.

  • Operating system: Linux <hostname> 5.15.0-84-generic #93-Ubuntu SMP Tue Sep 5 17:16:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux (Ubuntu Mate 22.04)
  • ltex-ls: 13.1.0 (according to ~/.config/coc/extensions/node_modules/coc-ltex/package.json)
  • Java:
openjdk 18.0.2-ea 2022-07-19
OpenJDK Runtime Environment (build 18.0.2-ea+9-Ubuntu-222.04)
OpenJDK 64-Bit Server VM (build 18.0.2-ea+9-Ubuntu-222.04, mixed mode, sharing)

Additional context/information
Would enjoy documentation on how to set the path for the settings file.

@FalcoGer FalcoGer added 1-bug 🐛 Issue type: Bug report (something isn't working as expected) 2-unconfirmed Issue status: Bug that needs to be reproduced (all new bugs have this label) labels Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1-bug 🐛 Issue type: Bug report (something isn't working as expected) 2-unconfirmed Issue status: Bug that needs to be reproduced (all new bugs have this label)
Projects
None yet
Development

No branches or pull requests

1 participant