-
Notifications
You must be signed in to change notification settings - Fork 28.1k
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
allow usage of extname(N)
template in custom labels
#213033
allow usage of extname(N)
template in custom labels
#213033
Conversation
@microsoft-github-policy-service agree |
c441332
to
3ce177e
Compare
Thank you for creating a PR for this. I think it makes sense to tackle this case. I would propose the following:
Example path:
|
3ce177e
to
ed1e1da
Compare
@benibenj Thanks for the reply and the suggestions! |
Thanks for making the changes! |
filenamePart
template in custom labelsextname(N)
template in custom labels
Heii @bsShoham, PR looks mostly good. What I've noticed:
|
src/vs/workbench/services/editor/common/customEditorLabelService.ts
Outdated
Show resolved
Hide resolved
@benibenj Hi, thanks for the reply and the comments, fixed the match return at N larger than extensions amount, and repaired to regex to fix As far as the behavior for The normal case
I believe this is the most common use case, no need to debate there. The hidden / 3rd party tool files
This is a more complex case, of files that start with The tests
Also a debatable case, though not as much, since capturing those through pattern ( I kept the filename as is in the meanwhile, I'll add the changes for it after the discussion is done. |
First of all, I think the following should always hold:
I think
|
7980403
to
a58d188
Compare
@bsShoham I added test so we can make sure the behaviour works as described |
Return match when N in `extname(N)` is larger than extensions amount
431d255
to
138f183
Compare
have filename return the file name from the start until the first non-leading `.`
@benibenj |
Thanks @bsShoham for working on this! |
* allow usage of `filenamePart` template in custom labels * use extname(n) instead of filename part * change extname to return the full extensions and not just the last file extension * Fix regex to match extname Return match when N in `extname(N)` is larger than extensions amount * Add tests * Fix `.file` label assertion * Make sure `extname` doesn't include leading dots have filename return the file name from the start until the first non-leading `.` * 💄 --------- Co-authored-by: BeniBenj <besimmonds@microsoft.com> Co-authored-by: Benjamin Christopher Simmonds <44439583+benibenj@users.noreply.github.com>
great very nice, for nested ext , but what about nested folders and dynamic folders in nextjs for example , like i have folders
|
@Ardian-Hoti similar to |
This pull requests add to the custom label service the option to accept a new template variable in the patterns, which allows to insert into the label each of the parts of the full file name (including the extension) separated by
.
usage example:
settings.json
:The results would be:
WORKSPACE/units-tests/users.spec.ts
->Test users
WORKSPACE/e2e/users.e2e.spec.ts
->Test e2e users
fixes #210166
also fixes some small spelling mistakes.