-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Improve Plugin Preference Access #11393
Improve Plugin Preference Access #11393
Conversation
@tsmaeder, in the past, I believe you expressed concern about using Monaco code in the plugin host. This PR does so: it uses the Monaco versions of |
@colin-grant-work like all interesting questions, this one does not have a straightforward answer. I don't mind having VS Code stuff in the plugin host per se. The problem is that as we use more code outside the editor proper, the larger the change becomes when we uplift Monaco to a new version. The reason this is more of a problem with Monaco than with other libraries is that we have to update all Monaco modules at the same time. Is this the direction we want to move the code in? The upside is that we can reuse stuff from VS Code. |
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.
Just some comments after a superficial look at the change.
const globalValue = this.inspectInScope<T>(preferenceName, PreferenceScope.User, resourceUri); | ||
const workspaceValue = this.inspectInScope<T>(preferenceName, PreferenceScope.Workspace, resourceUri); | ||
const workspaceFolderValue = this.inspectInScope<T>(preferenceName, PreferenceScope.Folder, resourceUri); | ||
inspect<T>(preferenceName: string, resourceUri?: string, forceLanguageOverride?: boolean): PreferenceInspection<T> | undefined { |
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.
The name forceLanguageOverride
confused me a bit at first. What it means is "don't return the general value if the key is language specific", right? I haven't really thought of a good name, though.
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.
I could reverse the polarity and rename it something like acceptDefault
. There's no exactly antonym for language overridden
, though...
packages/monaco/src/browser/textmate/monaco-textmate-frontend-bindings.ts
Outdated
Show resolved
Hide resolved
- Adjusts PreferenceRegistry to use Monaco code for `Configuration` and `ConfiguratioModel`. - Enables access and setting of language-overridden preferences from plugins according to VSCode API - Updates `affectsConfiguration` check to respect override options (language and URI)
77b0fa6
to
15b4fe2
Compare
@colin-grant-work Is this ready for a re-review? |
@JonasHelming, yes - I believe I have addressed Thomas' comments, apart from the naming, and that review did not check the functionality, as far as I'm aware. |
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.
I'm happy with the changes, good job 👍
- Language scoped preferences work as expected (i.e. doesn't bleed into the "normal" preferences, are applied correctly and instantly)
- Adding a
tasks.json
and changes within are correctly transmitted to the plugin - Running the different plugin commands for (non)-language-override preferences works as expected
What it does
Fixes #10004
Depends on #11331
This PR updates various aspects of preference access and setting from plugins.
Configuration
andConfiguratioModel
.ConfigurationScope
#10004)affectsConfiguration
check to respect override options (language and URI)How to test
affectsConfiguration
has new tests.Listen for config changes
tasks.json
file.tasks
andtasks.tasks
editor.fontSize
in your workspace; modify it for language overrides, including[rust]
editor.fontSize
in your workspace.editor.fontSize
in your workspace and report that the effective value has changed for non-overridden and forrust
.editor.fontSize
for therust
language, and the report should show that onlyrust
and not un-overriddeneditor.fontSize
was affectedrust
after (13), you should see a toast similar to 14 - only the value forrust
should be modified.Review checklist
Reminder for reviewers