-
-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Neovim Lua API #48
base: main
Are you sure you want to change the base?
Conversation
It will take some time since this update didn't work in my environment. Please wait for the review. |
@mrcjkb I would speculate that 99% of Neovim users that use language servers use nvim-lspconfig (if they're not using coc.nvim), so I think it would be a very small win to remove it. That being said, I'm not against removing the dependency, but I think that should be done in a different PR. Also, the nightly Neovim 0.11 adds |
That's not a good reason to depend on it.
For the "wins" of removing it, see the points outlined in #57, as well as the initialisation section in the neorocks/nvim-best-practices guide. nvim-lspconfig is quite an old plugin (from the nvim 0.5 days), does not have a good UX and does not lazy-load its LSP client configurations (you need to rely on a plugin manager for that). In fact, nvim-lspconfig is intended to be a "data only" repo (see its readme), not to be used as a dependency/library. And the
Yes, the fact that this is being implemented in core means it is more likely that lspconfig will remove internal APIs once it's released.
Sure, but as I mentioned, that would mean churn for users of the rustowl plugin. Edit: @mawkler I went ahead and opened a PR based on what I did in rustaceanvim: |
Sorry for our late review. This PR has conflicts now, so please resolve conflicts first, And I will review it. @mawkler @mrcjkb if you resolve problems in other repository, please feel free to close this PR and open new PRs in our repository. |
No worries @cordx56! @mrcjkb has added a bunch of improvements in their PR to my branch. I'm guessing that the plan is to merge that PR into my branch that makes up this PR (mawkler:lua-api), and then we can merge this PR after it's been approved here. |
Can I review it? I'm ready to review. It looks like there are some conflicts. Are you planning to fix them? |
This reverts commit c5cd9cd.
lsp.lua -> highlight.lua hover.lua -> show-on-hover.lua
Passing `default = true` to `vim.api.nvim_set_hl` ensures that the highlight group only gets created if none already exists
The `:!` is redundant
I have now pushed a new rebase on main with the conflicts resolved. However, I'm having issues with your commit f92d528, @mrcjkb, since no highlights appear after doing {
decorations = {},
is_analyzed = false,
path = "..."
} The previous commit e073eed works. I'm not sure what's up with that. |
@mawkler I had the same issue (thought it might be my nix rustowl build). |
In f92d528#diff-2b57fb92c0e089d41e642bb34539d18884921ba9832d47500cfaf3d447be9bb0L22 , root dirs are specified to send workspace init command to the LSP server. |
@cordx56 I've added support for |
@mrcjkb I tried using RustOwl from your new PR and it does work in a smaller Rust codebase (I tried my advent-of-code repo). However, I keep getting |
RustOwl does not have timeout itself. In my environment, RustOwl code itself can be visualized. |
That could be because of the simple root directory detection, which only searches upwards for a Cargo.toml or .git directory. rustaceanvim uses cargo to determine the root manifest in a multi workspace project. Perhaps we should use the same logic here. Edit: 🤔 rustowl doesn't appear to be a multi workspace project. |
The LSP server searches |
Co-authored-by: Melker Ulander <melker.ulander@pm.me>
🤔 @mawkler does it work with the rustowl codebase if you override the |
@mrcjkb I get the same behaviour regardless of whether I include the An example of a variable that doesn't work is the |
Yes. It is difficult to say that this behavior is a bug. However, in this case, variable |
Hi! This PR improves the Neovim Lua API by exposing the functions
rustowl.enable()
,rustowl.disable()
andrustowl.toggle()
so that the user can, for instance, map those to keymaps that they desire. It also automatically does the configuration for the user in a more conventional manner, so that they don't have to explicitly callrequire('lspconfig').setup()
themselves. It also exposes options for configuring whether to auto-enable RustOwl on startup, and lets the user set the idle time. Moreover, I added more extensive documentation for how the user can automatically build rustowl from source on installation from inside Neovim.I started working on this last week, and since then c5cd9cd got merged. Since my PR does kind of the same thing, but a little more extensively I found the easiest way was to simply revert that commit.