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(rust): preserve loading of rust-analyzer.json #977

Merged
merged 1 commit into from
May 19, 2024

Conversation

Ryex
Copy link
Contributor

@Ryex Ryex commented May 19, 2024

📑 Description

merge astrolsp settings in such a way as to preserve the default behavior of loading local project settings from rust-analyzer.json

ℹ Additional Information

The default behavior of rustaceanvim is to load a rust-analyzer.json at the project root to load rust-anlyzer settings
see:
rustaceanvim/config/server.lua#L15
rustaceanvim/config/internal.lua#L287

this file can have any of the keys defined in https://rust-analyzer.github.io/manual.html#configuration
either at the top level of the json or under a 'rust-analyzer' top level key

This is done by having server.settings be a function that takes the project root path and the default settings configured at server.default_settings and calling rustaceanvim's rustaceanvim.config.server.load_rust_analyzer_settings(root, opts) function.

This change configures rustaceanvim by merging the astrolsp configured opts around a similar function that itself merges the astrolsp configured settings table with the defaults before loading the rust-analyzer.json

image

as you can see, it's working as expected

merge astrolsp settings in such a way as to preserve the default behavior
of loading local project settings from rust-analyzer.json
Copy link

github-actions bot commented May 19, 2024

Review Checklist

Does this PR follow the [Contribution Guidelines](development guidelines)? Following is a partial checklist:

Proper conventional commit scoping:

  • If you are adding a new plugin, the scope would be the name of the category it is being added into. ex. feat(utility): added noice.nvim plugin

  • If you are modifying a pre-existing plugin or pack, the scope would be the name of the plugin folder. ex. fix(noice-nvim): fix LSP handler error

  • Pull request title has the appropriate conventional commit type and scope where the scope is the name of the pre-existing directory in the project as described above

  • README is properly formatted and uses fenced in links with <url> unless they are inside a [title](url)

  • Proper usage of opts table rather than setting things up with the config function.

Copy link
Member

@mehalter mehalter left a comment

Choose a reason for hiding this comment

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

Looks great!

@mehalter mehalter merged commit 33d4209 into AstroNvim:main May 19, 2024
13 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.

2 participants