Luke-Callaghan23 / VSCode-Tab-Labels

Adds the ability to rename tabs in VSCode
MIT License
2 stars 0 forks source link

Fails on file paths that include brackets ([]) #2

Open seanahrens opened 5 days ago

seanahrens commented 5 days ago

if the tab's filename has brackets, eg. "/src/app/topic/[id]/page.tsx", the tab renaming does not take effect. the custom tab name is stored but not displayed.

using brackets in folder names is a convention in NextJS.

seanahrens commented 5 days ago

upon further attempts to resolve this myself and make a pull request, this appears to be a bug in VSCode's interpretation of it's "workbench.editor.customLabels.patterns" object in it's settings json file, not in your extension.

however, there may be a potential workaround possible in this extension, such as replacing folder names that contain brackets with a * -- it's blunt kludge that may cause more problems than solutions though.

for any NextJS developers that stumble upon this ticket, I ended up doing the following (in my workspace or user settings in VSCode) to achieve my goals of better NextJS tab naming without the extension:

{ "folders": [ { "path": "." } ], "settings": { "workbench.editor.customLabels.enabled": true, "workbench.editor.customLabels.patterns": { "**/app/page.tsx": "¶ Home", "**/app/**/new/page.tsx": "¶ ${dirname(1)} new", "**/app/**/*/page.tsx": "¶ ${dirname(1)} show", "**/**.tsx": "${filename}", "**/components/**.tsx": "© ${filename}", "**/actions/**.ts": "@ ${filename}", "**/**.ts": "${filename}", "**/index.ts": "${dirname(0)}", } } }