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

Avoid indexing the project if configurationPreference is editorOnly #16381

Merged
merged 3 commits into from
Feb 27, 2025

Conversation

dcarrier
Copy link
Contributor

@dcarrier dcarrier commented Feb 25, 2025

Summary

Closes: #16267

This change skips building the index in RuffSettingsIndex when the configuration preference, in the editor settings, is set to editorOnly. This is appropriate due to the fact that the indexes will go unused as long as the configuration preference persists.

Test Plan

I have tested this in VSCode and can confirm that we skip indexing when editorOnly is set. Upon switching back to editorFirst or filesystemFirst we index the settings as normal.

I don't seen any unit tests for setting indexing at the moment, but I am happy to give it a shot if that is something we want.

Copy link
Contributor

github-actions bot commented Feb 25, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@ntBre ntBre added the server Related to the LSP server label Feb 26, 2025
Copy link
Member

@dhruvmanila dhruvmanila 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 taking a look at this. I think we should avoid considering the user settings and only use the default configuration.

dcarrier and others added 2 commits February 26, 2025 13:12
Introduce a dedicated `editor_only` method to avoid considering user defined settings when configuration preference is EditorOnly.
Copy link
Member

@dhruvmanila dhruvmanila left a comment

Choose a reason for hiding this comment

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

Thank you! I made couple of tweaks:

  • Changed the debug message to include the workspace path
  • Used .ok().map(...) instead of explicit match in fallback

@dhruvmanila dhruvmanila changed the title Skip RuffSettings indexing during editorOnly Avoid settings indexing if configurationPreference is editorOnly Feb 27, 2025
@dhruvmanila dhruvmanila changed the title Avoid settings indexing if configurationPreference is editorOnly Avoid indexing the project if configurationPreference is editorOnly Feb 27, 2025
@dhruvmanila dhruvmanila merged commit 7dad0c4 into astral-sh:main Feb 27, 2025
20 checks passed
dcreager added a commit that referenced this pull request Feb 28, 2025
* main:
  [red-knot] Switch to a handwritten parser for mdtest error assertions (#16422)
  [red-knot] Disallow more invalid type expressions (#16427)
  Bump version to Ruff 0.9.9 (#16434)
  Check `LinterSettings::preview` for version-related syntax errors (#16429)
  Avoid caching files with unsupported syntax errors (#16425)
  Prioritize "bug" label for changelog sections (#16433)
  [`flake8-copyright`] Add links to applicable options (`CPY001`) (#16421)
  Fix string-length limit in documentation for PYI054 (#16432)
  Show version-related syntax errors in the playground (#16419)
  Allow passing `ParseOptions` to inline tests (#16357)
  Bump version to 0.9.8 (#16414)
  [red-knot] Ignore surrounding whitespace when looking for `<!-- snapshot-diagnostics -->` directives in mdtests (#16380)
  Notify users for invalid client settings (#16361)
  Avoid indexing the project if `configurationPreference` is `editorOnly` (#16381)
dcreager added a commit that referenced this pull request Feb 28, 2025
* dcreager/alist-type:
  Remove unneeded shear override
  Update property test CI
  Move alist into red_knot_python_semantic
  [red-knot] Switch to a handwritten parser for mdtest error assertions (#16422)
  [red-knot] Disallow more invalid type expressions (#16427)
  Bump version to Ruff 0.9.9 (#16434)
  Check `LinterSettings::preview` for version-related syntax errors (#16429)
  Avoid caching files with unsupported syntax errors (#16425)
  Prioritize "bug" label for changelog sections (#16433)
  [`flake8-copyright`] Add links to applicable options (`CPY001`) (#16421)
  Fix string-length limit in documentation for PYI054 (#16432)
  Show version-related syntax errors in the playground (#16419)
  Allow passing `ParseOptions` to inline tests (#16357)
  Bump version to 0.9.8 (#16414)
  [red-knot] Ignore surrounding whitespace when looking for `<!-- snapshot-diagnostics -->` directives in mdtests (#16380)
  Notify users for invalid client settings (#16361)
  Avoid indexing the project if `configurationPreference` is `editorOnly` (#16381)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
server Related to the LSP server
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Avoid indexing the project if config preference is editorOnly
3 participants