-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
add tree-sitter-git-config #1426
Merged
pickfire
merged 2 commits into
helix-editor:master
from
the-mikedavis:md-tree-sitter-git-config
Jan 9, 2022
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule tree-sitter-git-config
added at
0e4f0b
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
((section_name) @keyword.directive | ||
(#eq? @keyword.directive "include")) | ||
|
||
((section_header | ||
(section_name) @keyword.directive | ||
(subsection_name)) | ||
(#eq? @keyword.directive "includeIf")) | ||
|
||
(section_name) @markup.heading | ||
(variable (name) @variable.other.member) | ||
[(true) (false)] @constant.builtin.boolean | ||
(integer) @constant.numeric.integer | ||
|
||
((string) @string.special.path | ||
(#match? @string.special.path "^(~|./|/)")) | ||
|
||
[(string) (subsection_name)] @string | ||
|
||
[ | ||
"[" | ||
"]" | ||
"\"" | ||
] @punctuation.bracket | ||
|
||
"=" @punctuation.delimiter | ||
|
||
(comment) @comment |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is this a good idea? It could be
.git/config
as well. Not sure how we can do it here.@archseer I think we might have to add support to check for the path as well.
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.
Hmm yeah I think if file-types could be a regex or a glob that'd work? We'd want to detect git-config for a few files where the containing directory/ies are important
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.
For git it's actually a little more complicated. Git repositories don't have to be called .git. That is just the default for working trees. There many other possible variations. e.g bare repositories, submodules and git with multiple working trees (see git-worktree).
.git/modules/helix-syntax/languages/tree-sitter-c/config
for example is probably a git config file in your helix working tree.The best way afaik to detect git config files is to check for other items in the same directory. objects and refs for example.
I'm pretty sure other file types will be in a similar situation.
bat seems to have this figured out. Perhaps would be worth looking to see how they do it?
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 am thinking that's better done as plugin or some sort of check then. But right now the simplest would be regex on full path.