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

fix(lsp/windows): path normalisation preventing lsp to work after gd to std lib #285

Merged

Conversation

tangtang95
Copy link
Contributor

Issue

Lsp does not work in a simple cargo project when you jump into standard library multiple times by using gd (go to definition). Basically, rustaceanvim is not able to identify the buffer path as being inside the standard library, therefore, it launches a new instance of rust-analyzer. This happens because the path of rustup home toolchains is like C:\path\to\rustup-home/.toolchains while the buffer path is c:\path\to\rustup-home\.toolchains\to\std\lib.

Solution

Substitute all patterns /+ with \ and also use os.normalize_path_on_windows due to lowercase partition drive letter.

I also thought of modifying the joinpath function in compat.lua, but it won't work with neovim 0.10.

Settings

OS: Windows
Neovim: 0.9.5
Neovim config: custom LazyVim with default rustaceanvim config

Copy link
Contributor

github-actions bot commented Mar 10, 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 😄

LGTM!

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.

2 participants