remarkjs / remark-language-server

A language server to lint and format markdown files with remark
MIT License
33 stars 1 forks source link

NeoVim: remark_ls not picking up requireConfig setting #15

Closed kplattret closed 1 month ago

kplattret commented 1 month ago

Initial checklist

Affected packages and versions

remark-language-server@3.0.0

Link to runnable example

No response

Steps to reproduce

Add remark_ls to NeoVim using steps from the README.md (using nvim-lspconfig).

Expected behavior

It should work out of the box and I should be able to set requireConfig = true without any issue.

Actual behavior

I get the following error consistently, no matter what I try:

[ERROR][2024-07-27 20:08:20] .../vim/lsp/rpc.lua:770    "rpc"   "/Users/kevin/.local/share/nvim/mason/bin/remark-language-server"   "stderr"    "file:///Users/kevin/.local/share/nvim/mason/packages/remark-language-server/node_modules/remark-language-server/node_modules/unified-language-server/lib/index.js:172\n          (raw) => ({requireConfig: Boolean(raw.requireConfig)})\n                                                ^\n\nTypeError: Cannot read properties of null (reading 'requireConfig')\n    at file:///Users/kevin/.local/share/nvim/mason/packages/remark-language-server/node_modules/remark-language-server/node_modules/unified-language-server/lib/index.js:172:49\n    at async file:///Users/kevin/.local/share/nvim/mason/packages/remark-language-server/node_modules/remark-language-server/node_modules/unified-language-server/lib/index.js:324:31\n    at async Promise.all (index 0)\n    at async processDocuments (file:///Users/kevin/.local/share/nvim/mason/packages/remark-language-server/node_modules/remark-language-server/node_modules/unified-language-server/lib/index.js:287:5)\n    at async checkDocuments (file:///Users/kevin/.local/share/nvim/mason/packages/remark-language-server/node_modules/remark-language-server/node_modules/unified-language-server/lib/index.js:362:19)\n\nNode.js v18.20.2\n"

Runtime

Other (please specify in steps to reproduce)

Package manager

Other (please specify in steps to reproduce)

OS

macOS

Build and bundle tools

Other (please specify in steps to reproduce)

remcohaszing commented 1 month ago

The requireConfig option was added after the documentation for several editors. Personally I use Visual Studio code. The updated documentation for other editors could be slightly wrong. It uses the requireConfig setting from the remark section. You probably know what that means in NeoVim better than I do. :)

I’m guessing it should look something like this:

require'lspconfig'.remark_ls.setup {
  settings = {
    remark = {
      requireConfig = true
    }
  }
}

Or this:

require'lspconfig'.remark_ls.setup {
  settings = {
    'remark.requireConfig' = true
  }
}
kplattret commented 1 month ago

Thanks @remcohaszing, that first suggestion did the trick! 🙇

github-actions[bot] commented 1 month ago

Hi! This was closed. Team: If this was fixed, please add phase/solved. Otherwise, please add one of the no/* labels.

remcohaszing commented 1 month ago

I’m glad it works! But which suggestion worked? (The first, I didn’t read properly.) We need to update our documentation.

github-actions[bot] commented 1 month ago

Hi! This was marked as ready to be worked on! Note that while this is ready to be worked on, nothing is said about priority: it may take a while for this to be solved.

Is this something you can and want to work on?

Team: please use the area/* (to describe the scope of the change), platform/* (if this is related to a specific one), and semver/* and type/* labels to annotate this. If this is first-timers friendly, add good first issue and if this could use help, add help wanted.