-
Notifications
You must be signed in to change notification settings - Fork 28.7k
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
#85858 Allow breadcrumbs.symbolSortOrder per language #86430
Conversation
@@ -440,7 +440,7 @@ export class BreadcrumbsOutlinePicker extends BreadcrumbsPicker { | |||
this._symbolSortOrder = BreadcrumbsConfig.SymbolSortOrder.bindTo(this._configurationService); | |||
} | |||
|
|||
protected _createTree(container: HTMLElement) { | |||
protected _createTree(container: HTMLElement, element: BreadcrumbElement) { |
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.
Not so nice - given that there is _setInput
. Why not update/modify the filter in there
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 don't think that works.
I tried:
protected _setInput(input: BreadcrumbElement): Promise<void> {
const element = input as TreeElement;
const model = OutlineModel.get(element)!;
const textModel = model.textModel;
this._overrideConfiguration = {
resource: textModel.uri,
overrideIdentifier: textModel.getLanguageIdentifier().language
};
and
private _getOutlineItemCompareType(): OutlineSortOrder {
switch (this._symbolSortOrder.getValue(this._overrideConfiguration)) {
However in testing, _getOutlineItemCompareType
gets called before _setInput
, making the override undefined.
This makes sense as _createTree
is called before _setInput
, and OutlineComparator
only takes a value rather than a function, so you have to have the override ready at the time of _createTree
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 store the sorter in a property when _createTree is called and update it when _setInput is called
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 see what you mean, like this?
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.
looking good. thanks
This PR fixes #85858
@jrieken Is this fine? I looked at how the other function uses
OutlineModel
, and it seems like it needs the input element, so I modified the function signature.Example:
Javascript file without override uses default order:
Typescript files use the overriden name order: