-
Notifications
You must be signed in to change notification settings - Fork 17
Simplify LSP settings #865
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
base: feature/top-level-assign-symbols
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blocking because this strips out per document config in favor of global config, which I think is incorrect
use crate::lsp::config::SETTINGS; | ||
|
||
for setting in SETTINGS { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use crate::lsp::config::SETTINGS; | |
for setting in SETTINGS { | |
for setting in crate::lsp::config::SETTINGS { |
That feels very AI 😆
@@ -284,121 +275,35 @@ pub(crate) fn did_change_formatting_options( | |||
// `insert_final_newline` | |||
} | |||
|
|||
use crate::lsp::config::SETTINGS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh god please don't put a use declaration here
if this is ai please update the ai instructions md file
// For document configs we collect all pairs of URIs and config keys of | ||
// interest in a flat vector | ||
let document_keys = VscDocumentConfig::FIELD_NAMES_AS_ARRAY; | ||
let mut document_items: Vec<ConfigurationItem> = | ||
itertools::iproduct!(uris.iter(), document_keys.iter()) | ||
.map(|(uri, key)| ConfigurationItem { | ||
scope_uri: Some(uri.clone()), | ||
section: Some(VscDocumentConfig::section_from_key(key).into()), | ||
}) | ||
.collect(); | ||
items.append(&mut document_items); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm isn't this important? I'm pretty sure we collected document config on a per open document basis and now we just collect it once with a scope_uri: None
which doesn't seem right
if changed { | ||
lsp::spawn_diagnostics_refresh_all(state.clone()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We dropped a refresh here
let config: DocumentConfig = config.into(); | ||
|
||
// Finally, update the document's config | ||
state.get_document_mut(&uri)?.config = config; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea see we dropped the per document config update
I think you'll like this one @DavisVaughan.
Branched from #859. I was concerned at how hard it was to add a new setting and section. I think the refactor in this PR will make things much simpler and easier:
Add a generic
Setting
type that allows us to flatten a representation of all our settings in a flat arraySETTINGS
that is easy to loop over. This drastically simplify the updating logic where we send all keys of interest to the client in a flat array, as we no longer need any bookkeeping.The setting objects in this array contain the conversion-from-json logic as simple methods assigned to a closure field. The default handling is still delegated to
Default
methods in our setting types.Remove the split between VS Code and LSP settings. If we want to add vscode agnostic settings in the future, we could add editor aliases in the
SETTINGS
array..