Skip to content
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

feat(lsp): add command to reload lsp settings #309

Merged
merged 3 commits into from
Mar 23, 2024

Conversation

GuillaumeLagrange
Copy link
Contributor

Following the discussion we had in #286, I found out how to reload settings using workspace/didChangeConfiguration.

Turns out the lsp server responds by a workspace/configuration where the server actually pulls the new configuration, since the server can cache configuration and decides whether it needs to actually pull the config.

nvim handles it, but we need to set the client.settings table to the new configuration before sending the workspace/didChangeConfiguration because it seems to be the one used by nvim to send the actual config.

I added this feature as a command because it made sense to me, let me know if it does not for you.

Once again, tested the changes on https://github.com/GuillaumeLagrange/neoconf-repro and it works for me.

Cheers

Copy link
Contributor

github-actions bot commented Mar 21, 2024

Review Checklist

Does this PR follow the Contribution Guidelines? Following is a partial checklist:

Proper conventional commit scoping:

  • For example, fix(lsp): some lsp-related bugfix

  • Pull request title has the appropriate conventional commit prefix.

If applicable:

  • Tested
    • Tests have been added.
    • Tested manually (Steps to reproduce in PR description).
  • Updated documentation.
  • Updated CHANGELOG.md

Copy link
Owner

@mrcjkb mrcjkb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR 😄

This seems like a good approach.
I'll see it I can find some time to test it soon.

lua/rustaceanvim/lsp.lua Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@GuillaumeLagrange
Copy link
Contributor Author

@mrcjkb I'm having troubles with the lua type checker, the CI build fails, and I can reproduce locally by running

nix flake check --print-build-logs

For some reason, it has trouble detecting that client is an lsp.Client class, but my lsp in nvim detects it properly with the cast.
I'm not experienced with nix at all so I cannot dig deeper that this :(

@mrcjkb
Copy link
Owner

mrcjkb commented Mar 22, 2024

@mrcjkb I'm having troubles with the lua type checker, the CI build fails, and I can reproduce locally by running

nix flake check --print-build-logs

For some reason, it has trouble detecting that client is an lsp.Client class, but my lsp in nvim detects it properly with the cast. I'm not experienced with nix at all so I cannot dig deeper that this :(

Don't worry about that. I'll fix it before merging 😀

lua/rustaceanvim/lsp.lua Outdated Show resolved Hide resolved
lua/rustaceanvim/lsp.lua Show resolved Hide resolved
Copy link
Owner

@mrcjkb mrcjkb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested it, and it seems to be working well 😄

@mrcjkb mrcjkb merged commit 04dc55d into mrcjkb:master Mar 23, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants