artempyanykh / marksman

Write Markdown with code assist and intelligence in the comfort of your favourite editor.
MIT License
1.93k stars 35 forks source link

Completions by Marksman dont't work at all in Neovim (macOS) #204

Open mnddm opened 1 year ago

mnddm commented 1 year ago

Hello there!

I try to use Marksman in Neovim 0.9. I've configured cmp and LSP correctly (tested on other filetypes), but marksman don't want to show me the completions from the LSP. And looks like hover doesn't work too.

How I tested:

  1. I've created two files test1.md and test2.md; both placed in the same directory with .git.
  2. Add the header "##header" to test1 and try to make a link to it in test2.
  3. All these completions didn't work (|—the cursor): 3.1. [[te|]] 3.2. [[test1#h|]] 3.4. [my-link](te|) 3.5. [my-link](test1#h|)

Here is example that shows no completions by LSP (the should be in the first place). 1

What work:

  1. In the same time the diagnostics works: when I delete any symbol from correct link I receive the warning about incorrect link (sorry but not sure it's because of marksman or other linter I use).
  2. And following by the link by (vim.lsp.buf.definition()).
artempyanykh commented 1 year ago

Hi @mnddm! Thanks for trying out marksman. Based on what you wrote above, I can assume that the problem is that you need/expect a different completion style.

By default Marksman uses level 1 header as a link to the document, e.g.

# This is the title

Foo bar

## Subtitle

What you want is probably a completion by file name. See the Configuration section in the README on how to configure completion style: https://github.com/artempyanykh/marksman/blob/main/docs/configuration.md

LMK if it helps!

mnddm commented 1 year ago

Hi, @artempyanykh, thanks for help. Unfortunately it didn't help. I've followed the instructions and changed the wiki.style to file-stem in project .marksman.toml but completions still don't work. Link diagnostics (i.e. is it correct link?/is it correct link with header?) and vim.lsp.buf.definition() work as expected.

BingCoke commented 1 year ago

sound like this issue #160 ?

mnddm commented 1 year ago

Hi @BingCoke. Tested without spaces, completions provider by LSP still didn't work.

BingCoke commented 1 year ago

Hi @BingCoke. Tested without spaces, completions provider by LSP still didn't work.

I mean this looks like a bug waiting to be fixed

mnddm commented 1 year ago

I mean this looks like a bug waiting to be fixed

Tested these scenarios and all works except completions:

  1. Create "f1.md" with ## Header with spaces and second file with link [[f1#Header with spaces]] (diagnostics and navigate into works, completions not).
  2. Create "f2 with spaces filename.md" with ## Header and second file with link [[f2 with spaces filename#Header]] (diagnostics and navigate into works, completions not).
mediapathic commented 1 year ago

I believe I am having the same, or similar, issue. Also on mac, using the Astronvim framework, new install, so fairly clean. I know marksman is installed and working generally because I can do symbol searches, but no completions (spaces or no) seem to work.

@mnddm this doesn't solve the issue, but a workaround I've found: starting a link with ./, in my setup, triggers a completion based on filepath, unrelated to marksman. This might help you till we figure out this issue.

Feel-ix-343 commented 1 year ago

Same here on arch and config https://github.com/Feel-ix-343/Neovim-Config

artempyanykh commented 1 year ago

@Feel-ix-343 thanks for posting you config! What would also be really helpful is if you could run marksman with verbose logs marksman server -v=5 (or something along this lines) and paste the server and LSP logs here. It seems that the problem affects a few people but I so far couldn't reproduce.

artempyanykh commented 11 months ago

@mnddm do you by any chance have something like this in your nvim config? I recently had a quick debug session with @antonk52 who had a similar problem (no completions) and the culprit was that extra candidate filtering on the neovim's side.

tetsugakusha256 commented 10 months ago

@mnddm do you by any chance have something like this in your nvim config? I recently had a quick debug session with @antonk52 who had a similar problem (no completions) and the culprit was that extra candidate filtering on the neovim's side.

I had this exact issue, and this fixed it for me. Thank you !

vcavallo commented 5 months ago

I'm having no luck with NVIM 0.9.5 and coc.vim version 0.0.82.

dnjp commented 1 month ago

Same here on arch and config https://github.com/Feel-ix-343/Neovim-Config

I just ran into this issue myself. It turns out the cause of the issue is due was due to a configuration error on my end. As you can see in the example config that @Feel-ix-343 shared, the attach and capabilities options are set for other LSP servers, but not for marksman. The solution is thankfully as simple as making sure these options are set in the setup config like this:

lspconfig.marksman.setup{
  on_attach = LspOnAttach,
  capabilities = LspCapabilities,
}