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

Apply formatter selected in initialization options #1886

Merged
merged 1 commit into from
Apr 5, 2024

Conversation

vinistock
Copy link
Member

Motivation

Closes #1884

The global state refactor introduced a regression. We were eagerly detecting the formatter and then never taking into consideration initialization options coming from editors, which makes it impossible to use our rubyLsp.formatter option to select which formatter you want to use.

Implementation

We can't detect the formatter eagerly, that can only happen if the formatter is set to auto after we already applied the user's configurations.

So we initialize it to auto, override it if something is coming from configurations and then only detect the formatter if after all that it is still set to auto.

Automated Tests

Added a couple of new tests.

@vinistock vinistock added bugfix This PR will fix an existing bug server This pull request should be included in the server gem's release notes labels Apr 4, 2024
@vinistock vinistock self-assigned this Apr 4, 2024
@vinistock vinistock requested a review from a team as a code owner April 4, 2024 20:59
@vinistock vinistock requested review from andyw8 and aryan-soni April 4, 2024 20:59
@vinistock vinistock merged commit 1bb9fe0 into main Apr 5, 2024
41 checks passed
@vinistock vinistock deleted the vs/apply_selected_formatter branch April 5, 2024 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This PR will fix an existing bug server This pull request should be included in the server gem's release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ruby LSP Formatter changes not matching with syntax_tree write
2 participants