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

Handle Language Overrides in setPreference #10665

Merged
merged 2 commits into from
Feb 7, 2022

Conversation

colin-grant-work
Copy link
Contributor

What it does

Fixes #10663 by checking whether the preference name passed to setPreference contains a language override identifier and handling that case appropriately.

How to test

  1. Check out this branch, which is this branch with one additional commit for demonstration purposes.
  2. Open Theia with the Theia repo as your workspace.
  3. Open a TS file.
  4. Open the workspace preferences (.theia/settings.json), if you'd like.
  5. Run the command Overrides: Set language overrides
  6. You should end up with this in your settings.json
"[typescript]": {
    "editor.tabSize": 3,
    "editor.fontSize": 18
}

and those settings should take effect in the TS file.
7. Run the command Overrides: Remove tabsize override
8. It should remove "editor.tabSize" from the [typescript] object in the settings.json, and you should get the default tabSize in your TS file.
9. Run the command Overrides: Remove Typescript overrides.
10. It should delete the [typescript] section entirely, and you should get default behavior for both preferences.
11. If the tests in this PR pass, it shows basically the same thing as those steps do manually.

Review checklist

Reminder for reviewers

@colin-grant-work colin-grant-work force-pushed the bugfix/delete-pref-overrides branch 2 times, most recently from b1004aa to 62b6fa8 Compare January 24, 2022 23:03
@colin-grant-work colin-grant-work added the preferences issues related to preferences label Jan 25, 2022
@colin-grant-work colin-grant-work force-pushed the bugfix/delete-pref-overrides branch from 62b6fa8 to fa2cab2 Compare January 25, 2022 22:44
@colin-grant-work colin-grant-work force-pushed the bugfix/delete-pref-overrides branch from fa2cab2 to c1d8306 Compare January 25, 2022 23:47
@msujew msujew self-requested a review January 26, 2022 10:50
Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

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

The changes look good to me!

  • Running the Set language overrides command changes the settings.json file as expected and the changes are instantly applied to the editor
  • Resetting each of the preferences apply the change correctly to the settings.json and editor

@colin-grant-work colin-grant-work merged commit cfc7296 into master Feb 7, 2022
@colin-grant-work colin-grant-work deleted the bugfix/delete-pref-overrides branch February 7, 2022 21:36
@github-actions github-actions bot added this to the 1.23.0 milestone Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preferences issues related to preferences
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot set or delete language-overridden preferences using PreferenceService
2 participants