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

ltex-ls language server code actions don't work #1942

Closed
David-Else opened this issue Apr 3, 2022 · 6 comments
Closed

ltex-ls language server code actions don't work #1942

David-Else opened this issue Apr 3, 2022 · 6 comments
Labels
A-language-server Area: Language server client C-bug Category: This is a bug

Comments

@David-Else
Copy link
Contributor

Summary

I have added:

languages.toml

[[language]]
name = "markdown"
language-server = { command = "ltex-ls" }

and the language server runs (very slowly, takes ages to get the feedback) and detects errors, but when I select a code action it says no code actions available.

Screenshot from 2022-04-03 12-39-59

It works OK in Neovim:

Screenshot from 2022-04-03 13-17-01

The author of ltex-ls made some comments that you don't need to change any settings in a long discussion on the subject of adding it to Neovim: neovim/nvim-lspconfig#863 (comment)

Reproduction Steps

add:

languages.toml

[[language]]
name = "markdown"
language-server = { command = "ltex-ls" }

load any markdown file with spelling errors, wait a little while for the ltex-ls to analyse the code, place cursor over error and space a

Helix log

~/.cache/helix/helix.log
2022-04-03T12:38:18.842 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"textDocument":{"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}}},"completion":{"completionItem":{"snippetSupport":false},"completionItemKind":{}},"hover":{"contentFormat":["markdown"]},"rename":{"dynamicRegistration":false,"honorsChangeAnnotations":false,"prepareSupport":false}},"window":{"workDoneProgress":true},"workspace":{"configuration":true,"didChangeConfiguration":{"dynamicRegistration":false}}},"processId":293760,"rootUri":"file:///redacted"},"id":0}
2022-04-03T12:38:21.417 helix_lsp::transport [ERROR] err <- "Apr 03, 2022 12:38:21 PM org.bsplines.ltexls.server.LtexLanguageServer initialize\n"
2022-04-03T12:38:21.417 helix_lsp::transport [ERROR] err <- "INFO: ltex-ls 15.2.0 - initializing...\n"
2022-04-03T12:38:21.440 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":0,"result":{"capabilities":{"textDocumentSync":1,"completionProvider":{},"codeActionProvider":{"codeActionKinds":["quickfix.ltex.acceptSuggestions"]},"executeCommandProvider":{"commands":["_ltex.checkDocument","_ltex.getServerStatus"]}}}}
2022-04-03T12:38:21.440 helix_lsp::transport [INFO] <- {"capabilities":{"codeActionProvider":{"codeActionKinds":["quickfix.ltex.acceptSuggestions"]},"completionProvider":{},"executeCommandProvider":{"commands":["_ltex.checkDocument","_ltex.getServerStatus"]},"textDocumentSync":1}}
2022-04-03T12:38:21.440 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"initialized","params":{}}
2022-04-03T12:38:21.440 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"md","text":"---\ntitle: \"CentOS 8 Setup for Developers\"\ndate: \"2020-06-01\"\ncategories:\n  - \"centos\"\n  - \"linux\"\ncoverImage: \"centos_1.png\"\n---\n\nCentOS 8 is a free version of RHEL 8 which was branched from Fedora 28. I consider this new version of CentOS to be the first viable long term support version of Fedora.\n\nIn this article, I will discuss why CentOS 8 is amazing for developers, and walk you through my install script to make downloading all the additional software you need easy and automatic.\n\nMany people consider CentOS to be only for server use. In the past, it has been hard to setup for development and as a general use desktop. This is not true anymore, so follow along and join me on this magical journey into the promised land of stability and up-to-date applications!\n\nThis guide is for developers, so I am assuming you know a bit about computers and operating systems, I am just going to point out the things that are specific to this setup.\n\n### CentOS 8 includes AppStream\n\nPreviously software in CentOS went out of date too quickly for developers, but with AppStream officially supported updated applications can be accessed faster without sacrificing the stability of the OS. Applications like `node.js` can now have multiple officially supported versions, including the latest.\n\n```shell-session\n$ dnf module list nodejs\n\nCentOS-8 - AppStream\nName                                 Stream\nnodejs                               10 [d]\nnodejs                               12 [e\n\nExtra Packages for Enterprise Linux Modular 8 - x86_64\nName                                 Stream\nnodejs                               12 [e]\nnodejs                               13\n\nHint: [d]efault, [e]nabled, [x]disabled, [i]nstalled\n```\n\n## Installation from the ISO image\n\n### Download and Burn the ISO Image to a USB drive\n\n![](images/gnome-disks-restore-disk-image-1-e1570721589859-1024x576.png)\n\nDownload the [official ISO image](https://centos.org/download/) and write it to a USB stick.\n\nIf you have a computer already running Gnome desktop, the _Disks_ utility can write a disk image easily for you. Select the USB drive you want to write to and _Restore Disk Image ..._ from the drop-down menu\n\nIf you are running Windows follow the official guide to [Making Installation USB Media on Windows](https://docs.centos.org/en-US/centos/install-guide/Making_Media_USB_Windows/), and for Mac: [Making Installation USB Media on Mac OS X](https://docs.centos.org/en-US/centos/install-guide/Making_Media_USB_Mac/)\n\n### Backup Everything and Prepare to Beam Yourself into the Future…\n\nIt is possible to run Linux and Windows on the same machine, but that would be a giant waste of time. Windows 10 is awful, and now completely redundant. If you want to get up to that kind of nonsense I suggest you close this tab and never darken my website again :)\n\nI am going assume you have backed up all important data and can wipe the hard drive you wish to install CentOS on.\n\nBoot into the computer and use whatever BIOS options you have available to choose to boot from the USB stick. If you have more options choose UEFI mode. Now the quest for the ultimate desktop developer experience can begin! Let the installer run and follow the options you want.\n\n**Important note** I am assuming that you will choose to select _SOFTWARE / Software Selection / Base Environment > Workstation_ and also when you create user tick *make user administrator*. If you need some help with the installer you can read this [guide](https://www.tecmint.com/centos-8-installation/).\n\n![](images/centos-8-install-options.png)\n\n## Install All the Packages You Need with This Install Script\n\nFollow the instructions in the Github repo to download the install scripts. We will then look at how they work so you can customize them.\n\nhttps://github.com/David-Else/fedora-ultimate-setup-script\n\nNow should by now have CentOS 8 installed in its basic unmodified form. Before you do anything else, it is time to run the [developer-workstation-setup-script](https://github.com/David-Else/developer-workstation-setup-script). I will break down the important parts of the script so you can edit them for your own custom version.\n\n### General Script Setup\n\n```bash\nset -euo pipefail\nexec 2> >(tee \"error_log_$(date -Iseconds).txt\")\n\nGREEN=$(tput setaf 2)\nBOLD=$(tput bold)\nRESET=$(tput sgr0)\n\nif [ \"$(id -u)\" != 0 ]; then\n    echo \"You're not root! Run script with sudo\" && exit 1\nfi\n```\n\nHere we set the script to run with more conservative settings, generate a date stamped error log file, set some text colors and exit if it is not run using `sudo`.\n\n### Packages to Install / Remove\n\n```bash\npackages_to_remove=(\n)\n\npackages_to_install=(\n)\n\nflathub_packages_to_install=(\n)\n```\n\nThese arrays of package titles are self-explanatory.\n\nThere is some logic involved in the script with regard to the packages. For example, if you don't include `code` then it won't install the repository needed to download it. This is located in the _add default and conditional repositories_ section.\n\n```bash\ncase \" ${packages_to_install[*]} \" in\n*' code '*)\n    # only run if code is included in packages to install\n    ;;&\n*' brave-browser '*)\n    # ....\n    ;;\nesac\n```\n\n### Selecting Standard or Web Developer Install\n\n```bash\nread -p \"Are you going to use this machine for web development? (y/n) \" -n 1 webdev\n```\n\nYou have the option of selecting a standard or web development install. It will add a load more packages for web development, and do the additional setup. You can edit these additional package names too.\n\n### Download Binaries for Unavailable Packages\n\n```bash\necho \"${BOLD}Downloading and installing binaries...${RESET}\"\ncurl -Of https://shellcheck.storage.googleapis.com/shellcheck-v0.7.0.linux.x86_64.tar.xz\necho \"84e06bee3c8b8c25f46906350fb32708f4b661636c04e55bd19cdd1071265112d84906055372149678d37f09a1667019488c62a0561b81fe6a6b45ad4fae4ac0 ./shellcheck-v0.7.0.linux.x86_64.tar.xz\" |\n    sha512sum --check\ntar -C /usr/local/bin/ -xf shellcheck-v0.7.0.linux.x86_64.tar.xz --no-anchored 'shellcheck' --strip=1\n```\n\nNot all packages are available at this time, so I manually download and install some binaries to `/usr/local/bin/` Note I have added additional sha512 checks in case the US government is trying to man in the middle your brand new CentOS install. That is not happening using this script!\n\n## Setting Up The Desktop\n\nI have written the [developer-workstation-setup-script](https://github.com/David-Else/developer-workstation-setup-script) to take care of this, there are some general details in the [script repository](https://github.com/David-Else/developer-workstation-setup-script). If you would like another article to cover that then please leave a comment. I will gage the demand... these articles take a long time! :)\n\nEnjoy CentOS 8!\n","uri":"file:///redacted/centos-8-setup-for-developers/index.md","version":0}}}
2022-04-03T12:38:21.448 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":"1","method":"window/workDoneProgress/create","params":{"token":"{\"uri\":\"file:///redacted/centos-8-setup-for-developers/index.md\",\"operation\":\"checkDocument\",\"uuid\":\"0940bc62-bae0-55dd-4e39-05607be195d8\"}"}}
2022-04-03T12:38:21.448 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","result":null,"id":"1"}
2022-04-03T12:38:21.455 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"{\"uri\":\"file:///redacted/centos-8-setup-for-developers/index.md\",\"operation\":\"checkDocument\",\"uuid\":\"0940bc62-bae0-55dd-4e39-05607be195d8\"}","value":{"kind":"begin","title":"Checking document","cancellable":false,"message":"file:///redacted/centos-8-setup-for-developers/index.md"}}}
2022-04-03T12:38:21.456 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":"2","method":"workspace/configuration","params":{"items":[{"scopeUri":"file:///redacted/centos-8-setup-for-developers/index.md","section":"ltex"}]}}
2022-04-03T12:38:21.456 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","result":[null],"id":"2"}
2022-04-03T12:38:21.462 helix_lsp::transport [ERROR] err <- "Apr 03, 2022 12:38:21 PM org.bsplines.ltexls.parsing.CodeFragmentizer$Companion create\n"
2022-04-03T12:38:21.463 helix_lsp::transport [ERROR] err <- "WARNING: Unsupported code language ID 'md', treating text as plaintext\n"
2022-04-03T12:38:21.481 helix_lsp::transport [ERROR] err <- "Apr 03, 2022 12:38:21 PM org.bsplines.ltexls.server.DocumentChecker logTextToBeChecked\n"
2022-04-03T12:38:21.481 helix_lsp::transport [ERROR] err <- "FINE: Checking the following text in language 'en-US' via LanguageTool: \"---\\ntitle: \\\"CentOS 8 Setup for Developers\\\"\\ndate: \\\"2020-06-01\\\"\\ncategories:\\n  - \\\"centos\\\"\\n  - \\\"linux\\\"\\nc\"... (truncated to 100 characters)\n"
2022-04-03T12:38:25.173 helix_lsp::transport [ERROR] err <- "Apr 03, 2022 12:38:25 PM org.bsplines.ltexls.server.DocumentChecker checkAnnotatedTextFragment\n"
2022-04-03T12:38:25.173 helix_lsp::transport [ERROR] err <- "FINE: Obtained 63 rule matches\n"
2022-04-03T12:38:25.174 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"{\"uri\":\"file:///redacted/centos-8-setup-for-developers/index.md\",\"operation\":\"checkDocument\",\"uuid\":\"0940bc62-bae0-55dd-4e39-05607be195d8\"}","value":{"kind":"end"}}}
2022-04-03T12:38:25.185 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///redacted/centos-8-setup-for-developers/index.md","diagnostics":[{"range":{"start":{"line":4,"character":5},"end":{"line":4,"character":11}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027centos\u0027: Possible spelling mistake found."},{"range":{"start":{"line":5,"character":5},"end":{"line":5,"character":10}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027linux\u0027: Possible spelling mistake found."},{"range":{"start":{"line":6,"character":0},"end":{"line":6,"character":10}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027coverImage\u0027: Possible spelling mistake found."},{"range":{"start":{"line":6,"character":13},"end":{"line":6,"character":19}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027centos\u0027: Possible spelling mistake found."},{"range":{"start":{"line":13,"character":88},"end":{"line":13,"character":93}},"severity":3,"code":"SETUP_VERB","codeDescription":{"href":"https://community.languagetool.org/rule/show/SETUP_VERB?lang\u003den-US"},"source":"LTeX","message":"The verb \u0027set up\u0027 is spelled as two words. The noun \u0027setup\u0027 is spelled as one."},{"range":{"start":{"line":17,"character":22},"end":{"line":17,"character":31}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027AppStream\u0027: Possible spelling mistake found."},{"range":{"start":{"line":19,"character":84},"end":{"line":19,"character":93}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027AppStream\u0027: Possible spelling mistake found."},{"range":{"start":{"line":22,"character":2},"end":{"line":22,"character":5}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027dnf\u0027: Possible spelling mistake found."},{"range":{"start":{"line":22,"character":18},"end":{"line":22,"character":24}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027nodejs\u0027: Possible spelling mistake found."},{"range":{"start":{"line":24,"character":11},"end":{"line":24,"character":20}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027AppStream\u0027: Possible spelling mistake found."},{"range":{"start":{"line":25,"character":4},"end":{"line":25,"character":37}},"severity":3,"code":"WHITESPACE_RULE","codeDescription":{"href":"https://community.languagetool.org/rule/show/WHITESPACE_RULE?lang\u003den-US"},"source":"LTeX","message":"Possible typo: you repeated a whitespace"},{"range":{"start":{"line":26,"character":0},"end":{"line":26,"character":6}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027nodejs\u0027: Possible spelling mistake found."},{"range":{"start":{"line":26,"character":6},"end":{"line":26,"character":37}},"severity":3,"code":"WHITESPACE_RULE","codeDescription":{"href":"https://community.languagetool.org/rule/show/WHITESPACE_RULE?lang\u003den-US"},"source":"LTeX","message":"Possible typo: you repeated a whitespace"},{"range":{"start":{"line":27,"character":0},"end":{"line":27,"character":6}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027nodejs\u0027: Possible spelling mistake found."},{"range":{"start":{"line":27,"character":6},"end":{"line":27,"character":37}},"severity":3,"code":"WHITESPACE_RULE","codeDescription":{"href":"https://community.languagetool.org/rule/show/WHITESPACE_RULE?lang\u003den-US"},"source":"LTeX","message":"Possible typo: you repeated a whitespace"},{"range":{"start":{"line":27,"character":40},"end":{"line":27,"character":41}},"severity":3,"code":"EN_UNPAIRED_BRACKETS","codeDescription":{"href":"https://community.languagetool.org/rule/show/EN_UNPAIRED_BRACKETS?lang\u003den-US"},"source":"LTeX","message":"Unpaired symbol: \u0027]\u0027 seems to be missing"},{"range":{"start":{"line":30,"character":4},"end":{"line":30,"character":37}},"severity":3,"code":"WHITESPACE_RULE","codeDescription":{"href":"https://community.languagetool.org/rule/show/WHITESPACE_RULE?lang\u003den-US"},"source":"LTeX","message":"Possible typo: you repeated a whitespace"},{"range":{"start":{"line":31,"character":0},"end":{"line":31,"character":6}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027nodejs\u0027: Possible spelling mistake found."},{"range":{"start":{"line":31,"character":6},"end":{"line":31,"character":37}},"severity":3,"code":"WHITESPACE_RULE","codeDescription":{"href":"https://community.languagetool.org/rule/show/WHITESPACE_RULE?lang\u003den-US"},"source":"LTeX","message":"Possible typo: you repeated a whitespace"},{"range":{"start":{"line":32,"character":0},"end":{"line":32,"character":6}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027nodejs\u0027: Possible spelling mistake found."},{"range":{"start":{"line":32,"character":6},"end":{"line":32,"character":37}},"severity":3,"code":"WHITESPACE_RULE","codeDescription":{"href":"https://community.languagetool.org/rule/show/WHITESPACE_RULE?lang\u003den-US"},"source":"LTeX","message":"Possible typo: you repeated a whitespace"},{"range":{"start":{"line":34,"character":9},"end":{"line":34,"character":15}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027efault\u0027: Possible spelling mistake found."},{"range":{"start":{"line":34,"character":20},"end":{"line":34,"character":26}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027nabled\u0027: Possible spelling mistake found."},{"range":{"start":{"line":34,"character":44},"end":{"line":34,"character":52}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027nstalled\u0027: Possible spelling mistake found."},{"range":{"start":{"line":63,"character":31},"end":{"line":63,"character":37}},"severity":3,"code":"GITHUB","codeDescription":{"href":"https://community.languagetool.org/rule/show/GITHUB?lang\u003den-US"},"source":"LTeX","message":"The official name of this software platform is spelled with a capital \"H\"."},{"range":{"start":{"line":63,"character":59},"end":{"line":63,"character":66}},"severity":3,"code":"A_INSTALL","codeDescription":{"href":"https://community.languagetool.org/rule/show/A_INSTALL?lang\u003den-US"},"source":"LTeX","message":"The word \u0027install\u0027 is not a noun."},{"range":{"start":{"line":63,"character":110},"end":{"line":63,"character":113}},"severity":3,"code":"COMMA_COMPOUND_SENTENCE","codeDescription":{"href":"https://community.languagetool.org/rule/show/COMMA_COMPOUND_SENTENCE?lang\u003den-US"},"source":"LTeX","message":"Use a comma before \u0027so\u0027 if it connects two independent clauses (unless they are closely connected and short)."},{"range":{"start":{"line":67,"character":278},"end":{"line":67,"character":281}},"severity":3,"code":"COMMA_COMPOUND_SENTENCE","codeDescription":{"href":"https://community.languagetool.org/rule/show/COMMA_COMPOUND_SENTENCE?lang\u003den-US"},"source":"LTeX","message":"Use a comma before \u0027so\u0027 if it connects two independent clauses (unless they are closely connected and short)."},{"range":{"start":{"line":72,"character":5},"end":{"line":72,"character":8}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027euo\u0027: Possible spelling mistake found."},{"range":{"start":{"line":72,"character":9},"end":{"line":72,"character":17}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027pipefail\u0027: Possible spelling mistake found."},{"range":{"start":{"line":73,"character":33},"end":{"line":73,"character":41}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027Iseconds\u0027: Possible spelling mistake found."},{"range":{"start":{"line":75,"character":8},"end":{"line":75,"character":12}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027tput\u0027: Possible spelling mistake found."},{"range":{"start":{"line":75,"character":13},"end":{"line":75,"character":18}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027setaf\u0027: Possible spelling mistake found."},{"range":{"start":{"line":76,"character":7},"end":{"line":76,"character":11}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027tput\u0027: Possible spelling mistake found."},{"range":{"start":{"line":77,"character":8},"end":{"line":77,"character":12}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027tput\u0027: Possible spelling mistake found."},{"range":{"start":{"line":79,"character":0},"end":{"line":79,"character":2}},"severity":3,"code":"UPPERCASE_SENTENCE_START","codeDescription":{"href":"https://community.languagetool.org/rule/show/UPPERCASE_SENTENCE_START?lang\u003den-US"},"source":"LTeX","message":"This sentence does not start with an uppercase letter."},{"range":{"start":{"line":79,"character":3},"end":{"line":79,"character":5}},"severity":3,"code":"COMMA_PARENTHESIS_WHITESPACE","codeDescription":{"href":"https://community.languagetool.org/rule/show/COMMA_PARENTHESIS_WHITESPACE?lang\u003den-US"},"source":"LTeX","message":"Don\u0027t put a space after the opening parenthesis."},{"range":{"start":{"line":79,"character":20},"end":{"line":79,"character":22}},"severity":3,"code":"COMMA_PARENTHESIS_WHITESPACE","codeDescription":{"href":"https://community.languagetool.org/rule/show/COMMA_PARENTHESIS_WHITESPACE?lang\u003den-US"},"source":"LTeX","message":"Don\u0027t put a space before the closing parenthesis."},{"range":{"start":{"line":81,"character":0},"end":{"line":81,"character":2}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027fi\u0027: Possible spelling mistake found."},{"range":{"start":{"line":89,"character":19},"end":{"line":90,"character":0}},"severity":3,"code":"COMMA_PARENTHESIS_WHITESPACE","codeDescription":{"href":"https://community.languagetool.org/rule/show/COMMA_PARENTHESIS_WHITESPACE?lang\u003den-US"},"source":"LTeX","message":"Don\u0027t put a space after the opening parenthesis."},{"range":{"start":{"line":92,"character":20},"end":{"line":93,"character":0}},"severity":3,"code":"COMMA_PARENTHESIS_WHITESPACE","codeDescription":{"href":"https://community.languagetool.org/rule/show/COMMA_PARENTHESIS_WHITESPACE?lang\u003den-US"},"source":"LTeX","message":"Don\u0027t put a space after the opening parenthesis."},{"range":{"start":{"line":95,"character":0},"end":{"line":95,"character":7}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027flathub\u0027: Possible spelling mistake found."},{"range":{"start":{"line":95,"character":28},"end":{"line":96,"character":0}},"severity":3,"code":"COMMA_PARENTHESIS_WHITESPACE","codeDescription":{"href":"https://community.languagetool.org/rule/show/COMMA_PARENTHESIS_WHITESPACE?lang\u003den-US"},"source":"LTeX","message":"Don\u0027t put a space after the opening parenthesis."},{"range":{"start":{"line":104,"character":4},"end":{"line":104,"character":7}},"severity":3,"code":"COMMA_PARENTHESIS_WHITESPACE","codeDescription":{"href":"https://community.languagetool.org/rule/show/COMMA_PARENTHESIS_WHITESPACE?lang\u003den-US"},"source":"LTeX","message":"Don\u0027t put a space on both sides of a quote symbol."},{"range":{"start":{"line":104,"character":32},"end":{"line":104,"character":35}},"severity":3,"code":"COMMA_PARENTHESIS_WHITESPACE","codeDescription":{"href":"https://community.languagetool.org/rule/show/COMMA_PARENTHESIS_WHITESPACE?lang\u003den-US"},"source":"LTeX","message":"Don\u0027t put a space on both sides of a quote symbol."},{"range":{"start":{"line":105,"character":10},"end":{"line":105,"character":11}},"severity":3,"code":"EN_UNPAIRED_BRACKETS","codeDescription":{"href":"https://community.languagetool.org/rule/show/EN_UNPAIRED_BRACKETS?lang\u003den-US"},"source":"LTeX","message":"Unpaired symbol: \u0027(\u0027 seems to be missing"},{"range":{"start":{"line":108,"character":19},"end":{"line":108,"character":20}},"severity":3,"code":"EN_UNPAIRED_BRACKETS","codeDescription":{"href":"https://community.languagetool.org/rule/show/EN_UNPAIRED_BRACKETS?lang\u003den-US"},"source":"LTeX","message":"Unpaired symbol: \u0027(\u0027 seems to be missing"},{"range":{"start":{"line":110,"character":0},"end":{"line":110,"character":4}},"severity":3,"code":"WHITESPACE_RULE","codeDescription":{"href":"https://community.languagetool.org/rule/show/WHITESPACE_RULE?lang\u003den-US"},"source":"LTeX","message":"Possible typo: you repeated a whitespace"},{"range":{"start":{"line":110,"character":4},"end":{"line":110,"character":5}},"severity":3,"code":"UNLIKELY_OPENING_PUNCTUATION","codeDescription":{"href":"https://community.languagetool.org/rule/show/UNLIKELY_OPENING_PUNCTUATION?lang\u003den-US"},"source":"LTeX","message":"Loose punctuation mark."},{"range":{"start":{"line":111,"character":0},"end":{"line":111,"character":4}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027esac\u0027: Possible spelling mistake found."},{"range":{"start":{"line":117,"character":69},"end":{"line":117,"character":72}},"severity":3,"code":"COMMA_PARENTHESIS_WHITESPACE","codeDescription":{"href":"https://community.languagetool.org/rule/show/COMMA_PARENTHESIS_WHITESPACE?lang\u003den-US"},"source":"LTeX","message":"Don\u0027t put a space on both sides of a quote symbol."},{"range":{"start":{"line":117,"character":77},"end":{"line":117,"character":83}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027webdev\u0027: Possible spelling mistake found."},{"range":{"start":{"line":127,"character":134},"end":{"line":127,"character":136}},"severity":3,"code":"COMMA_PARENTHESIS_WHITESPACE","codeDescription":{"href":"https://community.languagetool.org/rule/show/COMMA_PARENTHESIS_WHITESPACE?lang\u003den-US"},"source":"LTeX","message":"Don\u0027t put a space before the full stop."},{"range":{"start":{"line":127,"character":155},"end":{"line":127,"character":160}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027linux\u0027: Possible spelling mistake found."},{"range":{"start":{"line":127,"character":172},"end":{"line":127,"character":174}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027xz\u0027: Possible spelling mistake found."},{"range":{"start":{"line":129,"character":8},"end":{"line":129,"character":11}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027usr\u0027: Possible spelling mistake found."},{"range":{"start":{"line":129,"character":24},"end":{"line":129,"character":26}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027xf\u0027: Possible spelling mistake found."},{"range":{"start":{"line":129,"character":45},"end":{"line":129,"character":50}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027linux\u0027: Possible spelling mistake found."},{"range":{"start":{"line":129,"character":62},"end":{"line":129,"character":64}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027xz\u0027: Possible spelling mistake found."},{"range":{"start":{"line":129,"character":80},"end":{"line":129,"character":90}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027shellcheck\u0027: Possible spelling mistake found."},{"range":{"start":{"line":132,"character":99},"end":{"line":132,"character":102}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027usr\u0027: Possible spelling mistake found."},{"range":{"start":{"line":132,"character":220},"end":{"line":132,"character":229}},"severity":3,"code":"CA_BRAND_NEW","codeDescription":{"href":"https://community.languagetool.org/rule/show/CA_BRAND_NEW?lang\u003den-US"},"source":"LTeX","message":"\u0027brand new\u0027 seems to be a compound adjective before a noun. Use a hyphen: \u0027brand-new\u0027."},{"range":{"start":{"line":136,"character":353},"end":{"line":136,"character":357}},"severity":3,"code":"MORFOLOGIK_RULE_EN_US","codeDescription":{"href":"https://community.languagetool.org/rule/show/MORFOLOGIK_RULE_EN_US?lang\u003den-US"},"source":"LTeX","message":"\u0027gage\u0027: Possible spelling mistake found."}]}}
2022-04-03T12:39:52.169 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/codeAction","params":{"context":{"diagnostics":[]},"range":{"end":{"character":1,"line":6},"start":{"character":0,"line":6}},"textDocument":{"uri":"file:///redacted/centos-8-setup-for-developers/index.md"}},"id":1}
2022-04-03T12:39:52.171 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":1,"result":[]}
2022-04-03T12:39:52.171 helix_lsp::transport [INFO] <- []
2022-04-03T12:40:05.816 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"shutdown","params":null,"id":2}
2022-04-03T12:40:05.816 helix_lsp::transport [ERROR] err <- "Apr 03, 2022 12:40:05 PM org.bsplines.ltexls.server.LtexLanguageServer shutdown\n"
2022-04-03T12:40:05.816 helix_lsp::transport [ERROR] err <- "INFO: Shutting down ltex-ls...\n"
2022-04-03T12:40:05.816 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":2,"result":{}}
2022-04-03T12:40:05.816 helix_lsp::transport [INFO] <- {}
2022-04-03T12:40:05.816 helix_lsp::client [WARN] language server failed to terminate gracefully - failed to parse: invalid type: map, expected unit
2022-04-03T12:40:05.816 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"exit","params":null}
2022-04-03T12:40:05.817 helix_lsp::transport [ERROR] err <- "Apr 03, 2022 12:40:05 PM org.bsplines.ltexls.server.LtexLanguageServer exit\n"
2022-04-03T12:40:05.817 helix_lsp::transport [ERROR] err <- "INFO: Exiting ltex-ls...\n"

Platform

Linux - Rocky Linux 8.5

Terminal Emulator

Kitty

Helix Version

helix 22.03 (d4e45fd)

@David-Else David-Else added the C-bug Category: This is a bug label Apr 3, 2022
@kirawi kirawi added the A-language-server Area: Language server client label Apr 3, 2022
@anzhi0708
Copy link

WARNING: Unsupported code language ID 'md', treating text as plaintext\n

Maybe try

[[language]]
name = "markdown"
language-server = { command = "ltex-ls" }
file-types = ["md"]
scope = "source.markdown"
roots = []

@David-Else
Copy link
Contributor Author

@anzhi0708 You were right it was not selecting it as a markdown file.

With your suggested settings it works faster by parsing it as Markdown, but unfortunately the code actions still don't work.

@sudormrfbin
Copy link
Member

WARNING: Unsupported code language ID 'md', treating text as plaintext\n

Maybe try

[[language]]
name = "markdown"
language-server = { command = "ltex-ls" }
file-types = ["md"]
scope = "source.markdown"
roots = []

Hmm IIRC we should be merging the user language.toml with the default based on name, seems like there might be a bug there.

@David-Else David-Else changed the title ltex-ls language server code actions don't work, and there is a long startup time ltex-ls language server code actions don't work Apr 4, 2022
@David-Else
Copy link
Contributor Author

The code actions now work since an update, probably #2005

The 'add to dictionary' function does not yet work, but in Neovim this needed to be added with some extra code.

@weakish
Copy link

weakish commented Jan 26, 2024

The 'add to dictionary' function does not yet work, but in Neovim this needed to be added with some extra code.

Because _ltex.addToDictionary is not implemented in the server side (ltex-ls).
the client need to implement them itself.
I guess this is unlikely to be implemented in Helix core, in other words, blocked until Helix releases a plugin system.

@ferntheplant
Copy link

ferntheplant commented Mar 22, 2024

My work around was writing a quick script called ltex-add that takes stdin and appends it to the end of the ltex.dictionary array. Then whenever I encounter a false positive misspelling like on "dotfiles" I can just select the word and pipe it to my script with :pipe-to ltex-add. The goal was to run :config-reload and :lsp-restart to get ltex-ls to pick up on the updated dictionary but the reloads/restarts don't appear to be working correctly.

If Helix supported sending workspace/didChangeConfiguration notifications on :config-reload then we wouldn't need a whole plugin to handle updating the LSP server config - assuming the LSP server was capable of handling those config update notifications (unfortunately ltex-ls currently is not)

Anyways my ChatGPT generated script isn't particularly "fault tolerant" but does the job for how I have my languages.toml formatted:

#!/bin/bash

read -r word
toml_file="/path/to/languages.toml"

# Add word to dictionary using awk
awk -v word="$word" '/ltex\.dictionary/ && /en-US/ {gsub(/\]/, ", \"" word "\"]")} 1' "$toml_file" > tmpfile && mv tmpfile "$toml_file"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-language-server Area: Language server client C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

6 participants