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): FlyCheck request params #702

Merged
merged 1 commit into from
Mar 25, 2025
Merged

Conversation

fengys1996
Copy link
Contributor

Hi, I encountered a problem and try to solve it.

When I manually trigger a flyCheck via :RustLsp flyCheck, the rust analyzer does not perform the corresponding flyCheck.

The minimal configuration of rust analyzer as follows.

["rust-analyzer"] = {
	check = {
		command = "check",
		workspace = false,
	},
}

Looked through the code of the rust analyzer and found that the serialization of the flycheck_params is problematic. The related code see here.

And this PR fixes the serialization problem of flycheck_params.

Copy link
Contributor

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.

@mrcjkb
Copy link
Owner

mrcjkb commented Mar 25, 2025

Thanks 🙏

This used to work. I wonder if something changed in the nvim function or in rust-analyzer's deserialization that broke this 🤔

@mrcjkb mrcjkb changed the title fix: wrong flyCheck params fix(lsp): FlyCheck request params Mar 25, 2025
@mrcjkb mrcjkb merged commit d85cb81 into mrcjkb:master Mar 25, 2025
6 checks passed
@fengys1996
Copy link
Contributor Author

Thanks 🙏

This used to work. I wonder if something changed in the nvim function or in rust-analyzer's deserialization that broke this 🤔

If worksapce=false is set, flyCheck will execute cargo check -p package, and package is determined based on the passed uri. If serialization fails, flyCheck does nothing, since the passed uri is none.

If worksapce=true is set (default true), flyCheck executes cargo check --workspace, and the success or failure of fly check params serialization does not affect the execution of flyCheck.

😃

@fengys1996 fengys1996 deleted the fix/fly_check branch March 26, 2025 03:46
@mrcjkb
Copy link
Owner

mrcjkb commented Mar 26, 2025

Ah, thanks for the clarification 🙏
Makes sense.

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