-
Notifications
You must be signed in to change notification settings - Fork 29.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
Test: Custom Editor Labels #208388
Labels
Milestone
Comments
Super nice feature! |
Nifty feature! |
Nice work 👍 ❤️ |
If I want my vscode extension to set the workbench.editor.customLabels.enabled setting to true, and more importantly, the workbench.editor.customLabels.patterns setting inside its contribution point in package.json, how would I go about doing it? |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Refs: #41909
Complexity: 5
Create Issue
In this iteration we added support to change the labels of open editors (Name displayed in the tabs and open editors view). Users can do this by adding an entry in the
workbench.editor.customLabels.patterns
setting. An entry consists of:${extname}
: The file extension of the current editor (txt
,py
,ts
).${filename}
: The name of the file of the current editor. Does not include the extension. (root/parentFolder/folder/file.txt
=>file
)${dirname}
: The name of the folder the file of the current editor is placed in. (root/parentFolder/folder/file.txt
=>folder
)${dirname(N)}
: The name of the nth parent folder in which the file is located:${dirname(0)}
is the same as${dirname}
: (root/parentFolder/folder/file.txt
=>folder
)${dirname(1)}
is the parent folder of${dirname(0)}
:root/parentFolder/folder/file.txt
=>parentFolder
${dirname(2)}
is the parent folder of${dirname(1)}
:root/parentFolder/folder/file.txt
=>root
${dirname(3)}
is the parent folder of${dirname(2)}
: For the file pathroot/parentFolder/folder/file.txt
,root
is at level 2 and does not have a parent folder. In this case there is no value we can replace${dirname(3)}
with so we render the variable name as is. The reason we render the variable in the name is so that the user is aware that his template doesn't properly work for his case and hence should fix it.Testing:
**
, Template:Hello World
:**
pattern will match with every single editor. This means no matter which editor you open it will be calledHello World
. Check both the name rendered in the tab and the name rendered in the open editors viewworkbench.editor.customLabels.enabled
tofalse
: All editors will have the REAL name again.workbench.editor.customLabels.enabled
back totrue
: All editor will have theHello World
name againAbstractTree.ts
file in thevscode
repository located atsrc/vs/base/browser/ui/tree/abstractTree.ts
. Open the file and add the pattern, see how it will be renamed.src/**/abstractTree.ts
, Template:${dirname}/${filename}
:tree/abstractTree
. As this is the only editor that matches with the pattern, no other editor is renamed.src/vs/base/**/abstractTree.ts
, Template:${dirname(1)}/${dirname}/${filename}
:ui/tree/abstractTree
because this pattern is more specific compared to the pattern previouslyThe text was updated successfully, but these errors were encountered: