Open vhyrro opened 2 years ago
A more formal list of LSP features I can think of (feel free to point out what's missing/unfeasible):
Diagnostics:
Completion:
Hover:
Format:
Code actions:
Others:
GTD:
Another interesting idea (proposed on the discord):
#tangle
is out of sync with the file it should tangle to.I always wanted something like a potential link detection or proactive link completion. Not sure how to call it, so I'll try to give an example.
Imagine you have a file where you described what Foo is, like
* Foo
Foo is blah blah
** Foo use cases
You will use Foo when you want to blah
And then you're brainstorming ideas for something else:
* Bar
Possibly can be achieved with
- Something something
- Maybe can use Foo with blah blah
It will be very nice if Foo on the last line produced a completion/code action/code lense/whatever to turn Foo
in the text into a link to that Foo
header where you previously described what Foo is.
Could be very useful for wiki, knowledge base and zettelkasten workflows.
Ooh a code action along the lines of "xyz can be converted into a link" sonuds like a really cool idea!
I'm actually thinking about how to make something like this. I know obsidian.md
uses exact word match to suggest links, but I wanted to do some more fuzzy matching either based on word/sentence embeddings or n-gram models.
That said, these are all quite high capacity computation, so likely not fast enough to run with LSP on each text insert. Running a command that detects potential links is a bit more feasible, in my opinion...but I might be wrong. I usually work with python NLP packages, and this is usually the speed I expect. Someone please correct me if you can run this with rust crates at text insert speed, that would be really cool.
Something more fuzzy would probably have to be configurable, as it may trigger false positives and users might not like that :sweat_smile:. Neorg already does fuzzy matching for links (using the "fix link" functionality) - that uses the damerau-levenshtein algorithm to determine how similar two strings are. It's very simple but also very effective if you want to do some basic fuzzing. If you wanna go all out with NLP then yeah you might end up getting performance hits unless you run it off-thread with some throttling or something.
True. Now that I think about it these might serve two slightly different purposes. The more accurate and faster algorithm for suggesting exact links, while the more fuzzy one is probably more appropriately used as a note exploration tool, like noduslab?
Providing an adapter to null-ls might be the easiest way to leverage existing neorg code and provide LSP/linting/formatting in an async way. (Just throwing this out there, I'm no expert at null-ls)
Thanks @vhyro and crew for this really cool plugin!
From: Xujin Chris Liu @.>
Sent: Wednesday, July 20, 2022 10:17:29 AM
To: nvim-neorg/neorg @.>
Cc: Subscribed @.***>
Subject: Re: [nvim-neorg/neorg] LSP-like features for .norg
file editing (Issue #513)
True. Now that I think about it these might serve two slightly different purposes. The more accurate and faster algorithm for suggesting exact links, while the more fuzzy one is probably more appropriately used as a note exploration tool, like noduslabhttps://linkprotect.cudasvc.com/url?a=https%3a%2f%2fnoduslabs.com&c=E,1,weZ-HGa88yysjGc-SiQOQMlr_Ntrj4ChE9kzRSEWpFNqFPunjEiQ3HoyMycBSyj6TORTFwm1WzjK7PFTXtcbzo2269HyITihSj96fKrI&typo=1?
— Reply to this email directly, view it on GitHubhttps://github.com/nvim-neorg/neorg/issues/513#issuecomment-1190345452, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACQDVVYA2U33LYTJP2D3A5TVVAC7TANCNFSM53LU3LJQ. You are receiving this because you are subscribed to this thread.Message ID: @.***>
@aareman i don't think using null-ls would be a good idea. Making a generic LSP would nicely help with Neorg adoption outside of Neovim, which is what we want, right? :)
Speaking of which, I've started work on an official LSP implementation here: https://github.com/nvim-neorg/neorg-lsp!
I've only been working on it for a day, so don't expect it to do anything useful :p, but I'm letting y'all know about its existence so people can contribute and so that you're aware that work is being done on it :)
I know I'm late to the party but something I'd like is to be able to update links when a file changes. In Obsidian, when you make a link to a file and change the file's name. All links get updated to match the file getting renamed. In Neorg that doesn't happen and when stuff breaks, I have to change a lot of things manually.
Having that would be very nice. The issue can be mitigated by just using anchors all over the place, so you can just change the path in one spot in a single file. But, it still has the issue of if the anchors are defined in different files.
Discussed in https://github.com/nvim-neorg/neorg/discussions/512
This issue is mostly a reference point for future me on what to implement should I attempt the task of making a Neorg LSP. By all means if there's someone out there with more experience and they want to help out go ahead!