Skip to content

Show custom label in quick open#209681

Merged
benibenj merged 14 commits intomicrosoft:mainfrom
jswillard:defiant-perch
Apr 17, 2024
Merged

Show custom label in quick open#209681
benibenj merged 14 commits intomicrosoft:mainfrom
jswillard:defiant-perch

Conversation

@jswillard
Copy link
Contributor

Fixes #209662

Shows the custom labels as defined by workbench.editor.customLabels.patterns in the quick open menu. If no pattern matches or custom labels is disabled, then it shows the original name for the URI (filename.extension).

@TylerLeonhardt
Copy link
Member

Can you attach a screenshot?

@jswillard
Copy link
Contributor Author

Screenshot 2024-04-05 at 14 25 52 Screenshot 2024-04-05 at 14 27 15

with workbench.editor.customLabels.patterns set to this:

"workbench.editor.customLabels.patterns": {
    "src/vs/workbench/services/**": "${filename}.${extname} (workbench/services)"
}

@TylerLeonhardt
Copy link
Member

@benibenj can you review this? Looks ok from quick pick perspective so long as this is performant.

@benibenj
Copy link
Contributor

benibenj commented Apr 5, 2024

Currently, the only consumer of customEditorLabelService is the editor input. As the editor input already had caching and is able to do it much better then the service could, we did not add caching to customEditorLabelService.

In general the performance of custom labels is not very bad as we only support glob patterns, however, with the amount of lookups/renderings that quickpick does, it might be beneficial to add MRU caching to the service. (Quick pick will probably still have high cache miss rate as it looks up many different files once).

@jswillard if you are up to the challenge you can give this a try. I think we should have some type of support for this in map.ts, but if not, I'll look into this.

@jswillard
Copy link
Contributor Author

@benibenj I added a new MRUCache type to map.ts building off the existing LRUCache. I wasn't sure what size of cache to use for this service so I picked 1000, you may want to fiddle with that value. Hopefully this addresses your performance concerns.

Copy link
Contributor

@benibenj benibenj left a comment

Choose a reason for hiding this comment

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

Thanks for the changes! It looks very good. There are just some minor changes required, as soon as these are addressed we can merge this PR :)
Setting the size to 1000 sounds fine for me for the start.

bpasero
bpasero previously requested changes Apr 7, 2024
Copy link
Member

@bpasero bpasero left a comment

Choose a reason for hiding this comment

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

Sorry for late review, I am back from vacation.

benibenj
benibenj previously approved these changes Apr 8, 2024
@benibenj benibenj added this to the April 2024 milestone Apr 8, 2024
description = this.labelService.getUriLabel(dirname(resource), { relative: true });
const customLabel = this.customEditorLabelService.getName(resource);
label = customLabel || basenameOrAuthority(resource);
description = this.labelService.getUriLabel(!!customLabel ? resource : dirname(resource), { relative: true });
Copy link
Contributor

Choose a reason for hiding this comment

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

@TylerLeonhardt I propose including the original file name in the description when the label is custom. This allows searching for both original and custom name/label.

@benibenj benibenj requested a review from TylerLeonhardt April 8, 2024 15:32
@benibenj benibenj dismissed bpasero’s stale review April 8, 2024 15:33

We decided we will add it to quick pick but want to support searching for both

benibenj
benibenj previously approved these changes Apr 8, 2024
@benibenj benibenj enabled auto-merge April 8, 2024 15:34
@jswillard
Copy link
Contributor Author

@TylerLeonhardt is there anything else that needs to be done for this to be merged?

@benibenj benibenj merged commit ad220f4 into microsoft:main Apr 17, 2024
@microsoft microsoft locked and limited conversation to collaborators Jun 10, 2024
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.

Show Custom Labels in Go to file panel (Ctrl+P)

5 participants