Closed ray-x closed 6 months ago
I'm sorry that you are experiencing this! It shouldn't happen, however. Make sure that you have nvim-cmp configured properly, as this would cause the issue. Also make sure you have the latest version
{
name = 'nvim_lsp',
option = {
markdown_oxide = {
keyword_pattern = [[\(\k\| \|\/\|#\)\+]]
}
}
},
Thanks, after updating the nvim-cmp setup. It works now.
Just wondering why extra config is necessary in this case. But I am happy to close the issue.
(Wierdly) Unlike other completion engines (VSCode, Zed, ...), nvim-cmp will end a completion after you type a space. I think it assumes that only keywords (variable names, constants, ...) will be completed, and so any characters that are not typical of a keyword will cause completions to end. One of these characters is #
and another is space
. Others relevant to this are in that keyword_pattern.
It is very odd behavior and is made even worse by having to use a vim pattern (which is not very intuitive to me). The creator of Obsidian.nvim had a similar struggle, which he helped me with a few months ago. Also, be on the lookout for an RFC proposing markdown-oxide as a backend for Obsidian.nvim -- offloading performance-intensive tasks like completions etc. I have been in contact with the creator recently, and he gave me the go-ahead to make the proposal!
In addition to this, nvim-cmp has odd behavior with tags for some reason #17 . I really think that it is a bottleneck for neovim LSP ecosystem (and beyond) and it deserves a rewrite.
Just some thoughts!
I think this is a setup on the lsp side. The specification has this:
/**
* How a completion was triggered
*/
export namespace [CompletionTriggerKind](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#completionTriggerKind) {
/**
* Completion was triggered by typing an identifier (24x7 code
* complete), manual invocation (e.g Ctrl+Space) or via API.
*/
export const Invoked: 1 = 1;
/**
* Completion was triggered by a trigger character specified by
* the `triggerCharacters` properties of the
* `CompletionRegistrationOptions`.
*/
export const TriggerCharacter: 2 = 2;
/**
* Completion was re-triggered as the current completion list is incomplete.
*/
export const TriggerForIncompleteCompletions: 3 = 3;
}
export type [CompletionTriggerKind](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#completionTriggerKind) = 1 | 2 | 3;
e.g.
[[another-notes#_]]
when cursor on_
, it should list all headlines in another-notes, bellow is marksman behaviorWhile oxide treats
#
inside a wiki link astag
, so the result is a bit confusing