-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Make filename-base filetype detection independent of working directory #4112
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| filetype: apacheconf | ||
|
|
||
| detect: | ||
| filename: "httpd\\.conf|mime\\.types|vhosts\\.d\\\\*|\\.htaccess" | ||
| filename: "httpd\\.conf|mime\\.types|vhosts\\.d(/|\\\\).*|\\.htaccess" | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
With the addition of |
||
|
|
||
| rules: | ||
| - identifier: "(AcceptMutex|AcceptPathInfo|AccessFileName|Action|AddAlt|AddAltByEncoding|AddAltByType|AddCharset|AddDefaultCharset|AddDescription|AddEncoding)" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| filetype: groff | ||
|
|
||
| detect: | ||
| filename: "\\.m[ems]$|\\.rof|\\.tmac$|^tmac." | ||
| filename: "\\.m[ems]$|\\.rof|\\.tmac$|(^|/|\\\\)tmac." | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This situation covers most of the issues addressed in this commit: start of string. Previously this regex also would've failed if you opened |
||
|
|
||
| rules: | ||
| - statement: "^\\.(ds|nr) [^[[:space:]]]*" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| filetype: ini | ||
|
|
||
| detect: | ||
| filename: "\\.(ini|desktop|lfl|override|tscn|tres)$|(mimeapps\\.list|pinforc|setup\\.cfg|project\\.godot)$|weechat/.+\\.conf$" | ||
| filename: "\\.(ini|desktop|lfl|override|tscn|tres)$|(mimeapps\\.list|pinforc|setup\\.cfg|project\\.godot)$|weechat(/|\\\\).+\\.conf$" | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unrelated: fixing for DOS users. |
||
|
|
||
| rules: | ||
| - constant.bool.true: "\\btrue\\b" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| filetype: nftables | ||
|
|
||
| detect: | ||
| filename: "(nftables\\.(conf|rules)$|nftables(\\.rules)?\\.d/)" | ||
| filename: "(nftables\\.(conf|rules)$|nftables(\\.rules)?\\.d(/|\\\\).+)" | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, note the need for the |
||
| header: "^(#!.*/(env +)?nft( |$)|flush +ruleset)" | ||
|
|
||
| rules: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| filetype: vi | ||
|
|
||
| detect: | ||
| filename: "(^|/|\\.)(ex|vim)rc$|\\.vim" | ||
| filename: "(^|/|\\\\)\\.?(ex|vim)rc$|\\.vim" | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure what the intention here was, but with this change this no longer matches |
||
|
|
||
| rules: | ||
| - identifier: "[A-Za-z_][A-Za-z0-9_]*[(]+[A-Za-z0-9_:.,\\s]*[)]+" | ||
|
|
||
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.
I'm not really convinced, that all of this is really needed.
Using
header.MatchFileName(b.AbsPath)to check againstheader.FileNameRegexseems feasible combined with your syntax files changes, unless proven wrong.Did I oversee something?