artempyanykh / marksman

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

File names are not used in completions even though they are recognized in links (with `wiki.style = "file-stem"`) #255

Open Gelio opened 11 months ago

Gelio commented 11 months ago

Hey! First, thanks for this great LSP! It is the cornerstone of my Neovim/Obsidian workflow.

Status quo

For Marksman to play nicely with Obsidian, my .marksman.toml is:

[completion]
wiki.style = "file-stem"

Links are correctly referenced by their names. For example:

I am using [[XState]] for this project.

correctly points to XState.md and I can go do that file using "Go to reference".

image

Current behavior

When I then ask for completions for [[XS, I get nothing.

image

This is because XState.md does not have an h1 heading. In Obsidian, file names are used as document titles, so beginning a document with the same heading as the file name is redundant.

When I add the # XState heading at the top of XState.md, I do get XState.md as a suggestion:

image

Expected behavior

I would love it if marksman also included file names as completions. In this case, I would want XState.md to appear as a completion even if there is no # XState at the top of that file.

This would make the link resolution/autocomplete behave the same way. At the moment, the autocomplete does not show completions, but if I type the file name manually, the link is resolved correctly by marksman.

Related issues

Possibly related to https://github.com/artempyanykh/marksman/issues/122

artempyanykh commented 11 months ago

Thanks for reporting @Gelio! I think this is perfectly reasonable and will improve the UX.