Add use_local setting#299
Open
mstarodub wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new use_local configuration setting to control whether project-local Codebook configuration (and related LSP quick-fix suggestions) should be used, analogous to the existing use_global behavior.
Changes:
- Introduces
use_local: boolinConfigSettingswith serde defaults. - Extends
CodebookConfigwith ause_local()accessor and implements it for file/memory configs. - Updates LSP code actions to only offer project-local “add to dictionary” / “ignore file” actions when
use_localis enabled.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| crates/codebook-lsp/src/lsp.rs | Gates project-local code actions behind config_handle().use_local(). |
| crates/codebook-config/src/settings.rs | Adds the use_local setting to the serialized config model with defaults. |
| crates/codebook-config/src/lib.rs | Adds use_local() to the config trait and applies use_local during effective-settings calculation. |
Comment on lines
+289
to
+293
| if !project.use_local { | ||
| return if project.use_global { | ||
| global_config | ||
| .content() | ||
| .cloned() |
| fn should_flag_word(&self, word: &str) -> bool; | ||
| fn get_ignore_patterns(&self) -> Vec<Regex>; | ||
| fn get_min_word_length(&self) -> usize; | ||
| fn use_local(&self) -> bool; |
Comment on lines
+289
to
+293
| if !project.use_local { | ||
| return if project.use_global { | ||
| global_config | ||
| .content() | ||
| .cloned() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I did not like [1] the presence of suggestions to create project-local dictionaries or exclusion lists, so I thought this could be a useful feature (analogous to
use_global) to allow disabling them.[1] I think this post by Andrew Kelley explains the reasoning best.