-
Notifications
You must be signed in to change notification settings - Fork 183
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
fix: support ext convention #199
fix: support ext convention #199
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your timing is excellent; I've just been testing #197
This one's a bug, not a feature and doesn't break anything.
Tested OK for cases you referenced, as well as regular cases.
We'll merge that one first.
lua/nvim-web-devicons.lua
Outdated
@@ -1736,7 +1736,7 @@ local function get_default_icon() | |||
end | |||
|
|||
local function get_icon(name, ext, opts) | |||
ext = ext or name:match("^.*%.(.*)$") or "" | |||
ext = ext or name:match("^.*%.(.*%..*)$") or name:match("^.*%.(.*)$") or "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we simply match "^.*%.(.*%..*)$"
without "^.*%.(.*)$"
? Greedy match should cover all existing cases...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alex-courtis Thanks for your feedback. I've updated the regexp pattern to match both 'foo.test.js' and 'foo.js'. Could you double check?
2d2985a
to
1614238
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merged master, retested OK.
Many thanks for your contribution.
But then again it breaks other types. For example, I have a file called I would suggest adding another variable to this case and checking it first before the actual extension. |
Reported #205 Reverting. |
This reverts commit bd7a222.
I saw this #191 and I like the idea of supporting
*.test.js
,*.stories.tsx
, etc because these are quite common conventions.The problem is currently this is not working as intended. (Only
test.js
highlights but notfoo.test.js
)This PR is to fix this issue.
![image](https://user-images.githubusercontent.com/3371732/218235390-d20149a4-3933-438b-a7a2-c9bd8967ade8.png)
Note
Whether a plugin can reflect this change depends on the plugin's implementation.
(I see some attempt to support option to switch the way to get icons like this PR: akinsho/bufferline.nvim#669)