-
Notifications
You must be signed in to change notification settings - Fork 29k
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
#84678 add language-specific overrides for breadcrumb and outline settings #85081
#84678 add language-specific overrides for breadcrumb and outline settings #85081
Conversation
}); | ||
} | ||
|
||
return this._configurationService.getValue<boolean>(key); |
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.
You can use the ITextResourceConfigurationService which makes this a lot simpler
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.
How's this? 9d9a99d
Also use the |
…guration overides when reading breadcrumb configurations involving filteredTypes
… corresponding filteredTypes
implementation: 25a1bbb |
A callback is registered here which refilters the outline tree on config reload. Like the similar logic from BreadcrumbsModel, should we try to figure out what language is being used? I'm not sure where to get this information, or if that even makes sense in this context. A temporary fix would be to always filter on configuration change, but that wouldn't be ideal. |
Ideally we get a better API here but what you could try is |
|
…new OutlineFilter implementation
@@ -53,9 +55,9 @@ export class EditorBreadcrumbsModel { | |||
private readonly _uri: URI, | |||
private readonly _editor: ICodeEditor | undefined, | |||
@IConfigurationService private readonly _configurationService: IConfigurationService, | |||
@ITextResourceConfigurationService private readonly _textResourceConfigurationService: ITextResourceConfigurationService, |
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 "normal" ICOnfigurationService shouldn't be needed anymore and everything should be possible using the text resource based service
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.
TextResourceConfigurationService
doesn't appear to be a strict superset of ConfigurationService, and unfortunately BreadcrumbsConfig uses one of the unported methods updateValue
right here in method BreadcrumbsConfig.updateValue
This method is, in turn, bound and used by two breadcrumb configuration options, here and here.
This more directly relates to your other coment on BreadcrumbsControl
since the references to updateValue
are all in there, but I'm guessing we don't want to have to remove BreadcrumbsConfig
as a dependency of either class.
What I have right now definitely isn't the ideal solution though, so I could try to bring TextResourceConfigurationService
in line with ConfigurationService
either in this PR, or get another pr merged first if this issue is too tangential.
I didn't really check to see if I could just use the one config service though, so thanks for pointing it out!
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.
That's for the explaining - I learnt something :-). Yeah, the TextResourceConfigService
seems to be limiting and causing less pretty code /cc @sandy081. Let's keep the PR free from cleaning that up.
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.
Filed #85884 to enhance ITextResourceConfigService
@@ -168,6 +169,7 @@ export class BreadcrumbsControl { | |||
@IThemeService private readonly _themeService: IThemeService, | |||
@IQuickOpenService private readonly _quickOpenService: IQuickOpenService, | |||
@IConfigurationService private readonly _configurationService: IConfigurationService, | |||
@ITextResourceConfigurationService private readonly _textResourceConfigurationService: ITextResourceConfigurationService, |
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.
Don't have two configuration services (see my other comment)
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.
Left a reply over there as well which is relevant here.
This is looking good. @petevdp Can you fix merge conflicts and then I'll bring this in for the Nov release |
…settings-overrides
edit: I think everything still works actually. All tests are passing and after manually testing the feature I added, it all works still. Again, if any automated testing should be included, let me know and I'll see what I can do. |
this._treeFilter.update(); | ||
// This is a temporary solution to try and minimize refilters while | ||
// ConfigurationChangeEvents only provide the first section of the config path. | ||
if (e.affectedKeys.some(key => key.search(/(outline|\[\w+\])/))) { |
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.
fyi - this lacks a check for === 0
. I will fix this one master after merge.
Thanks for everyone's help! |
This PR fixes #84678 by setting the relevant configuration options as overridable and including override details when getting these values from the configuration.
I'm still working on getting the outline settings working the same way, but I'm opening this PR up early for any potential feedback and guidance.
Affected Settings
Affected settings include all of the settings in outline.contribution.tsand breadcrumbs.ts that have a corresponding
filteredTypes
setting.Questions / Guidance
I'm currently trying to find out how to get the class responsible for filtering outlines OutlineFilter to have the correct context when reading the config. It seems like I either have to include a relevant service codeEditorService or pass OutlineFilter.update the necessary context. Does anyone have any thoughts? Currently leaning towards the former but I don't know the full implications that that might have.
When listening for configuration updates in the breadcrumbs model, I'm just checking for changes to configurations with either
breadcrumbs
or[<current language>]
and updating that breadcrumb's outline if those are affected. Is this the way to do it or can I be more specific? It seems like the configuration service can only notify changes from the first layer of the configuration tree.Testing
I haven't written any tests yet because I'm not sure if features like this are supposed to get them, but I can write some if that would be preferred.