Skip to content

#85858 Allow breadcrumbs.symbolSortOrder per language - #86430

Merged
Johannes Rieken (jrieken) merged 2 commits into
microsoft:masterfrom
jzyrobert:85858-breadcrumbs
Dec 9, 2019
Merged

Johannes Rieken (jrieken) merged 2 commits into
microsoft:masterfrom
jzyrobert:85858-breadcrumbs

Conversation

@jzyrobert

Copy link
Copy Markdown
Contributor

This PR fixes #85858
Johannes Rieken (@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:
Code_-_OSS_rrrSXIlmlN
Javascript file without override uses default order:
Code_-_OSS_Ynj8nrJE6G
Typescript files use the overriden name order:
Code_-_OSS_vsHlKyvgAr

}

protected _createTree(container: HTMLElement) {
protected _createTree(container: HTMLElement, element: BreadcrumbElement) {

Copy link
Copy Markdown
Contributor

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

@jzyrobert Robert Jin (jzyrobert) Dec 6, 2019 •

Copy link
Copy Markdown
Contributor Author

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

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor Author

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?

@jrieken Johannes Rieken (jrieken) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looking good. thanks

@jrieken
Johannes Rieken (jrieken) merged commit 7c18341 into microsoft:master Dec 9, 2019
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable setting "breadcrumbs.symbolSortOrder" to be specific to languages

2 participants