Skip to content
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

[Git Files] Add Git Files package #1126

Merged
merged 106 commits into from
Mar 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
b44fe8f
Add git package
ryboe Aug 27, 2017
d802d3a
[Git] Commit: rename source.gitcommit to source.git.commit
deathaxe Sep 16, 2017
9ad0f06
[Git] Commit: Sort blocks by top-down
deathaxe Sep 17, 2017
ea2ac5a
[Git] Commit: Refactor commit message
deathaxe Sep 17, 2017
f257c68
[Git] Commit: Refactor changed files list
deathaxe Sep 17, 2017
43e11f3
[Git] Commit: Refactor branch-line
deathaxe Sep 17, 2017
d97a1ab
[Git] Commit: Refactor date line
deathaxe Sep 17, 2017
9404e60
[Git] Commit: Add scopes for username and issue references
deathaxe Sep 17, 2017
d01adf5
[Git] Commit: scope email addresses
deathaxe Sep 17, 2017
2a119a9
[Git] Link: Add syntax for .git files
deathaxe Sep 17, 2017
f938bd1
[Git] Link: rename syntax file to achieve unique names
deathaxe Sep 17, 2017
ec509be
[Git] Commit: rename syntax file to achieve unique names
deathaxe Sep 17, 2017
16cf43b
[Git] Commit: fix syntax_test file headers
deathaxe Sep 18, 2017
bff54a5
[Git] Rebase: Rename .gitrebase top-level scope to .git.rebase
deathaxe Sep 18, 2017
9dc50fb
[Git] Rebase: Add illegal syntax check to commit command lines
deathaxe Sep 18, 2017
98116c9
[Git] Rebase: Update rebase message to highlight commands
deathaxe Sep 18, 2017
3863bf2
[Git] Rebase: Resort rebase code to put associated blocks together
deathaxe Sep 18, 2017
27363ca
[Git] Rebase: Scope some rebase comment lines as headlines
deathaxe Sep 18, 2017
1e6d44d
[Git] Rebase: Match comments at line start only
deathaxe Sep 18, 2017
13897a1
[Git] Rebase: rename syntax file to achieve unique names
deathaxe Sep 18, 2017
2ecbf9e
[Git] Rebase: Add issue/user/email reference highlighting
deathaxe Sep 18, 2017
4752d69
[Git] Commit: Add support for git translations
deathaxe Sep 19, 2017
28d8bb2
Add git package
ryboe Aug 27, 2017
a69b86d
Refactor [section] contexts
ryboe Sep 16, 2017
cacce71
[Git] Commit: Fix syntax tests to match translations
deathaxe Sep 19, 2017
4d7b60e
[Git] Commit: Rename source.git.commit to text.git.commit
deathaxe Sep 19, 2017
92763c4
[Git] Rebase: Rename source.git.rebase to text.git.rebase
deathaxe Sep 19, 2017
52343d1
[Git] Link: Rename source.git.link to text.git.link
deathaxe Sep 19, 2017
f35380e
[Git] Commit: Remove text.plain.message scope
deathaxe Sep 20, 2017
9596e7c
Refactor and simplify commit syntax
ryboe Sep 20, 2017
86efdd6
[Git] Config: Sort sections from top-to down
deathaxe Sep 21, 2017
940d1bf
[Git] Config: Merge some unique atomic sections with their parents
deathaxe Sep 21, 2017
c4d6758
[Git] Config: Disallow any string after section header
deathaxe Sep 21, 2017
16fb208
[Git] Config: Reduce pattern repetitions
deathaxe Sep 21, 2017
a8be2f0
[Git] Config: Simplify constant patterns
deathaxe Sep 21, 2017
0f5fd79
[Git] Commit: Add support for squashed commit messages.
deathaxe Sep 22, 2017
9b22879
Refactor and simplify commit syntax
ryboe Sep 20, 2017
9c6f12a
[Git] Commit: Rename syntax definition file
deathaxe Sep 23, 2017
f952391
[Git] Link: Rename git link.sublime-syntax to gitlink.sublime-syntax
deathaxe Sep 23, 2017
99da69a
[Git] Rebase: rename git rebase.sublime-syntax to gitrebase.sublime-s…
deathaxe Sep 23, 2017
937c7de
[Git] Commit: Add general purpose headline
deathaxe Sep 23, 2017
d4d952d
[Git] Commit: Merge squash into commit syntax tests
deathaxe Sep 23, 2017
83f303b
[Git] Commit: Highlight recent commands in rebase commits
deathaxe Sep 23, 2017
3cc7a7b
Merge branch 'pr/git-commit' into add_gitconfig_pkg
deathaxe Sep 23, 2017
161b6a7
[Git] Rebase: Extend syntax name
deathaxe Sep 23, 2017
437c532
[Git] Rebase: Simplify scopes of command help
deathaxe Sep 24, 2017
dda56a0
[Git] Commit: Update reference scope names
deathaxe Sep 24, 2017
ec25ba2
[Git] Commit: Remove path from SYNTAX TEST header
deathaxe Sep 24, 2017
918e1de
[Git] Commit: Add Signed-off-by keyword and fix email-reference
deathaxe Sep 24, 2017
01320be
[Git] Commit: Use entity.name.reference for references
deathaxe Sep 24, 2017
ce37d63
[Git] Commit: Less strict empty 2nd line checks
deathaxe Sep 24, 2017
a4d64f3
[Git] Commit: Improve re-usability
deathaxe Sep 24, 2017
09c90ce
[Git] Commit: Support git diff
deathaxe Sep 24, 2017
d068d7d
Merge pull request #2 from deathaxe/pr/git-commit
Sep 25, 2017
4195122
[Git] Rebase: Reduce comment stack push/pops
deathaxe Sep 25, 2017
d1d2dd7
[Git] Rebase: Prepare for common reference scopes
deathaxe Sep 25, 2017
bf92620
[Git] Rebase: Use meta.subject to identify commit subject
deathaxe Sep 25, 2017
cbfbe7e
[Git] Rebase: Remove path from SYNTAX TEST header
deathaxe Sep 25, 2017
cc7df2f
Merge branch 'pr/git-rebase' into add_gitconfig_pkg
deathaxe Sep 25, 2017
c6a2a70
Merge pull request #1 from deathaxe/pr/git
Sep 30, 2017
b901cc8
[Git] Config: Highlight invalid escapes in section names
deathaxe Oct 1, 2017
a81f4e3
[Git] Rename git config base scope
deathaxe Sep 26, 2017
25b3658
Resolve conflicts with add_gitconfig_pkg
deathaxe Oct 1, 2017
1d17e49
Merge pull request #3 from deathaxe/pr/gitlink
Oct 12, 2017
689b737
Merge pull request #4 from deathaxe/pr/git-config
Oct 15, 2017
23e9200
[Git] Rename files to satisfy ST naming conventions
deathaxe Sep 25, 2017
bf103aa
[Git] Fix some scopes to satisfy new file names
deathaxe Sep 26, 2017
1a920e1
[Git] Create a hidden file with common scopes
deathaxe Sep 25, 2017
92dff27
[Git] Add Git Log syntax highlighting
deathaxe Sep 25, 2017
f97ebd3
[Git] Add .gitignore and .gitattributes syntax highlighting
deathaxe Oct 1, 2017
1a077a3
[Git] Link: Tweak path scoping along the lines of fnmatch
deathaxe Oct 10, 2017
942d62e
[Git] Config: Fix section snippet
deathaxe Oct 16, 2017
462873a
[Git] Config: Rename Symbol List
deathaxe Oct 21, 2017
7e2fd09
[Git] Rebase: Update comments
deathaxe Oct 21, 2017
2d9b9f9
[Git] Rebase: Use common line-end rule
deathaxe Oct 21, 2017
20445ee
[Git] Highlight fully qualified rebase message only
deathaxe Oct 21, 2017
aeb786b
[Git] Rebase: Rename commit-message to commit-section
deathaxe Oct 21, 2017
965b015
[Git] Commit: Add some comments as separators
deathaxe Oct 21, 2017
4896438
[Git] Commit: Typo
deathaxe Oct 21, 2017
b19e70c
[Git] Config: Don't mix escapes and trailing-slash
deathaxe Oct 21, 2017
9a78289
[Git] Config: Use escaped quotation marks
deathaxe Oct 21, 2017
ed8c6e7
[Git] Config: Udate/fix some syntax tests
deathaxe Oct 21, 2017
6bd9ada
Merge pull request #5 from deathaxe/pr/add_git_files
Oct 21, 2017
731e25f
[Git] Config: Remove format-escapes
deathaxe Nov 1, 2017
d30a0aa
Merge pull request #6 from deathaxe/pr/add_git_files
Nov 6, 2017
c8d8dee
[Git Files] Config: Allow single quoted value strings
deathaxe Dec 18, 2017
7e41d5b
[Git Files] Config: embed ShellScript
deathaxe Dec 18, 2017
0bcb500
[Git Files] Rebase: Scope all commit operations separately
deathaxe Dec 18, 2017
26f8095
[Git Files] Config: Remove single-quoted strings
deathaxe Jan 2, 2018
1701313
[Git Files] Config: Fix section header must not span multiple rows
deathaxe Jan 2, 2018
a8d5928
[Git Files] Config: Add support for legacy section headers
deathaxe Jan 2, 2018
6af5bfe
[Git Files] Config: Flatten section header rules
deathaxe Jan 2, 2018
0485882
[Git Files] Config: Add some divider comments
deathaxe Jan 2, 2018
c783cc9
[Git Files] Config: Increase performance by 13%
deathaxe Jan 2, 2018
85116e0
[Git Files] Config: Simplify 'escape' rule
deathaxe Jan 2, 2018
a987aff
[Git Files] Config: Improve meta.mapping scopes
deathaxe Jan 2, 2018
7aa5ffc
[Git Files] Config: Respect shellscript's line continuation
deathaxe Jan 2, 2018
b38ad96
[Git Files] Config: Hardening quoted shell script escape
deathaxe Jan 3, 2018
4de96c7
[Git Files] Config: Fix typo
deathaxe Jan 3, 2018
7c10705
Merge pull request #7 from deathaxe/add_gitconfig_pkg
Jan 4, 2018
00e10a8
[Git Files] Config: Capture eol if available
deathaxe Jan 21, 2018
bcd2798
[Git Files] Config: Add indention rules
deathaxe Jan 21, 2018
065536f
[Git Files] Config: Fix multiline shellscript with double quotes
deathaxe Feb 5, 2018
c2fee71
Merge pull request #8 from deathaxe/add_gitconfig_pkg
Feb 8, 2018
a255364
[Git Files] Config: Move Indention Rules to correct path
deathaxe Feb 10, 2018
758cc44
Merge pull request #9 from deathaxe/add_gitconfig_pkg
Feb 11, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Git Files/Comments.tmPreferences
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>name</key>
<string>Comments</string>
<key>scope</key>
<string>text.git</string>
<key>settings</key>
<dict>
<key>shellVariables</key>
<array>
<dict>
<key>name</key>
<string>TM_COMMENT_START</string>
<key>value</key>
<string># </string>
</dict>
</array>
</dict>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"scope": "meta.attributes-list.git.attributes - meta.mapping.value - punctuation.separator",
"completions": [
{"trigger": "binary\tattribute", "contents": "binary"},
{"trigger": "conflict-marker-size\tattribute", "contents": "conflict-marker-size"},
{"trigger": "delta\tattribute", "contents": "delta"},
{"trigger": "diff\tattribute", "contents": "diff"},
{"trigger": "encoding\tattribute", "contents": "encoding"},
{"trigger": "eol\tattribute", "contents": "eol"},
{"trigger": "export-ignore\tattribute", "contents": "export-ignore"},
{"trigger": "export-subst\tattribute", "contents": "export-subst"},
{"trigger": "filter\tattribute", "contents": "filter"},
{"trigger": "ident\tattribute", "contents": "ident"},
{"trigger": "merge\tattribute", "contents": "merge"},
{"trigger": "text\tattribute", "contents": "text"},
{"trigger": "whitespace\tattribute", "contents": "whitespace"}
]
}
25 changes: 25 additions & 0 deletions Git Files/Completions/Git Attributes - Diff.sublime-completions
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"scope": "meta.mapping.expect-value & meta.attribute.builtin.diff.git.attributes",
"completions": [
{"trigger": "ada\t(built-in) diff", "contents": "ada"},
{"trigger": "astextplain\t(built-in) diff", "contents": "astextplain"},
{"trigger": "bibtex\t(built-in) diff", "contents": "bibtex"},
{"trigger": "cpp\t(built-in) diff", "contents": "cpp"},
{"trigger": "csharp\t(built-in) diff", "contents": "csharp"},
{"trigger": "css\t(built-in) diff", "contents": "css"},
{"trigger": "exif\t(built-in) diff", "contents": "exif"},
{"trigger": "fortran\t(built-in) diff", "contents": "fortran"},
{"trigger": "fountain\t(built-in) diff", "contents": "fountain"},
{"trigger": "html\t(built-in) diff", "contents": "html"},
{"trigger": "java\t(built-in) diff", "contents": "java"},
{"trigger": "matlab\t(built-in) diff", "contents": "matlab"},
{"trigger": "objc\t(built-in) diff", "contents": "objc"},
{"trigger": "pascal\t(built-in) diff", "contents": "pascal"},
{"trigger": "perl\t(built-in) diff", "contents": "perl"},
{"trigger": "php\t(built-in) diff", "contents": "php"},
{"trigger": "python\t(built-in) diff", "contents": "python"},
{"trigger": "ruby\t(built-in) diff", "contents": "ruby"},
{"trigger": "tex\t(built-in) diff", "contents": "tex"},
{"trigger": "word\t(built-in) diff", "contents": "word"}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"scope": "meta.mapping.expect-value & meta.attribute.builtin.eol.git.attributes",
"completions": [
{"trigger": "crlf\teol", "contents": "crlf"},
{"trigger": "lf\teol", "contents": "lf"}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"scope": "meta.mapping.expect-value & meta.attribute.builtin.encoding.git.attributes",
"completions": [
{"trigger": "ASCII\tAscii", "contents": "ascii"},
{"trigger": "UTF-8\tUnicode", "contents": "utf-8"},
{"trigger": "UTF-16 LE\tUnicode", "contents": "utf-16-le"},
{"trigger": "UTF-16 BE\tUnicode", "contents": "utf-16-be"},
{"trigger": "ISO 8859-1\tWestern", "contents": "iso-8859-1"},
{"trigger": "ISO 8859-10\tNordic", "contents": "iso-8859-10"},
{"trigger": "ISO 8859-13\tEstonian", "contents": "iso-8859-13"},
{"trigger": "ISO 8859-14\tCeltic", "contents": "iso-8859-14"},
{"trigger": "ISO 8859-15\tWestern", "contents": "iso-8859-15"},
{"trigger": "ISO 8859-16\tRomanian", "contents": "iso-8859-16"},
{"trigger": "ISO 8859-2\tCentral European", "contents": "iso-8859-2"},
{"trigger": "ISO 8859-3\tWestern", "contents": "iso-8859-3"},
{"trigger": "ISO 8859-4\tBaltic", "contents": "iso-8859-4"},
{"trigger": "ISO 8859-5\tCyrillic", "contents": "iso-8859-5"},
{"trigger": "ISO 8859-6\tArabic", "contents": "iso-8859-6"},
{"trigger": "ISO 8859-7\tGreek", "contents": "iso-8859-7"},
{"trigger": "ISO 8859-8\tHebrew", "contents": "iso-8859-8"},
{"trigger": "ISO 8859-9\tTurkish", "contents": "iso-8859-9"},
{"trigger": "Windows 866\tCyrillic", "contents": "windows-866"},
{"trigger": "Windows 1250\tCentral European", "contents": "windows-1250"},
{"trigger": "Windows 1251\tCyrillic", "contents": "windows-1251"},
{"trigger": "Windows 1252\tWestern", "contents": "windows-1252"},
{"trigger": "Windows 1253\tGreek", "contents": "windows-1253"},
{"trigger": "Windows 1254\tTurkish", "contents": "windows-1254"},
{"trigger": "Windows 1255\tHebrew", "contents": "windows-1255"},
{"trigger": "Windows 1256\tArabic", "contents": "windows-1256"},
{"trigger": "Windows 1257\tBaltic", "contents": "windows-1257"},
{"trigger": "Windows 1258\tVietnamese", "contents": "windows-1258"},
{"trigger": "big5\tChineese Traditional", "contents": "gb2312"},
{"trigger": "CP 437\tDOS", "contents": "cp-437"},
{"trigger": "euc_jp\tJapaneese", "contents": "euc_jp"},
{"trigger": "euc_kr\tKorean", "contents": "euc_kr"},
{"trigger": "gb2312\tChineese Simplified", "contents": "gb2312"},
{"trigger": "KOI8-R\tCyrillic", "contents": "koi8-r"},
{"trigger": "KOI8-U\tCyrillic", "contents": "koi8-u"},
{"trigger": "Mac Roman\tWestern", "contents": "mac-roman"},
{"trigger": "Shift_JIS\tJapaneese", "contents": "Shift_JIS"},
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"scope": "meta.mapping.expect-value & meta.attribute.builtin.filter.git.attributes",
"completions": [
]
}
13 changes: 13 additions & 0 deletions Git Files/Completions/Git Attributes - Merge.sublime-completions
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"scope": "meta.mapping.expect-value & meta.attribute.builtin.merge.git.attributes",
"completions": [
{"trigger": "binary\t(built-in) merge", "contents": "binary"},
{"trigger": "ours\t(built-in) merge", "contents": "ours"},
{"trigger": "patience\t(built-in) merge", "contents": "patience"},
{"trigger": "recursive\t(built-in) merge", "contents": "recursive"},
{"trigger": "resolve\t(built-in) merge", "contents": "resolve"},
{"trigger": "text\t(built-in) merge", "contents": "text"},
{"trigger": "theirs\t(built-in) merge", "contents": "theirs"},
{"trigger": "union\t(built-in) merge", "contents": "union"}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"scope": "meta.mapping.expect-value & meta.attribute.builtin.text.git.attributes",
"completions": [
{"trigger": "auto\ttext", "contents": "auto"}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"scope": "meta.mapping.expect-value & meta.attribute.builtin.whitespace.git.attributes",
"completions": [
{"trigger": "blank-at-eof\twhitespace", "contents": "blank-at-eof"},
{"trigger": "blank-at-eol\twhitespace", "contents": "blank-at-eol"},
{"trigger": "cr-at-eol\twhitespace", "contents": "cr-at-eol"},
{"trigger": "indent-with-non-tab\twhitespace", "contents": "indent-with-non-tab"},
{"trigger": "space-before-tab\twhitespace", "contents": "space-before-tab"},
{"trigger": "tab-in-indent\twhitespace", "contents": "tab-in-indent"},
{"trigger": "trailing-space\twhitespace", "contents": "trailing-space"},
{"trigger": "tabwidth=x\twhitespace", "contents": "tabwidth=${0:8}"}
]
}
14 changes: 14 additions & 0 deletions Git Files/Git Attributes.sublime-settings
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"auto_complete_selector": "text.git - comment - string.quoted",
"auto_complete_triggers": [
{
"selector": "meta.attributes-list.git.attributes - meta.attribute - punctuation.separator",
"characters": " -!"
},
{
"selector": "meta.attribute.builtin & meta.mapping.expect-value.git.attributes",
"characters": "-=,"
}
],
"word_separators": "./\\()\"':,.;<>~!@#$%^&*|+=[]{}`~?" // default without '-'
}
210 changes: 210 additions & 0 deletions Git Files/Git Attributes.sublime-syntax
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
%YAML 1.2
---
# Syntax based on documentation here:
# https://git-scm.com/docs/gitattributes
# https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes

# Examples: https://github.com/alexkaratarakis/gitattributes

name: Git Attributes
file_extensions:
- attributes # .git/info/attributes
- gitattributes # *.gitattributes
- .gitattributes # ~/.gitattributes
scope: text.git.attributes

contexts:

main:
- include: Git Common.sublime-syntax#comments-line
- include: macro
- include: pattern

##[ MACROS ]###########################################################

macro:
- match: (\[)([^-!]\S*)(\])
scope: meta.brackets.git.attributes
captures:
1: punctuation.definition.brackets.begin.git.attributes
2: string.unquoted.git.attributes entity.name.macro.git.attributes
3: punctuation.definition.brackets.end.git.attributes
push: attributes-list

##[ PATH PATTERN ]#####################################################

pattern:
# ignore whitespace at the beginning of a line
# patterns may not start with operators: - ! [
- match: '[-!\[]|(?=\S)'
scope: invalid.illegal.operator.git.attributes
push: [pattern-attributes, pattern-content]

pattern-content:
# quoted path pattern
- match: \"
scope: punctuation.definition.string.begin.git.attributes
set: [pattern-content-quoted, Git Common.sublime-syntax#fnmatch-start]
# unquoted path pattern
- match: ''
set: [pattern-content-unquoted, Git Common.sublime-syntax#fnmatch-start]

pattern-content-quoted:
- meta_scope: string.quoted.double.git.attributes
- meta_content_scope: entity.name.pattern.git.attributes
- include: string-end
- include: Git Common.sublime-syntax#fnmatch-body

pattern-content-unquoted:
- meta_scope: string.unquoted.git.attributes
- meta_content_scope: entity.name.pattern.git.attributes
- match: (?=\s)
pop: true
- include: Git Common.sublime-syntax#fnmatch-body

pattern-attributes:
- match: ''
set: attributes-list

##[ ATTRIBUTES LIST ]##################################################

attributes-list:
- meta_content_scope: meta.attributes-list.git.attributes
# attriubte list ends with line
- match: $\n?
scope: meta.attributes-list.git.attributes
pop: true
# set/unset operators
- match: '[-!](?=\w)'
scope: keyword.operator.logical.git.attributes
# known attributes
- match: (?=diff\b)
push: [meta-diff, attribute-key]
- match: (?=encoding\b)
push: [meta-encoding, attribute-key]
- match: (?=eol\b)
push: [meta-eol, attribute-key]
- match: (?=filter\b)
push: [meta-filter, attribute-key]
- match: (?=merge\b)
push: [meta-merge, attribute-key]
- match: (?=text\b)
push: [meta-text, attribute-key]
- match: (?=whitespace\b)
push: [meta-whitespace, attribute-key]
# unknown/other attribute
- match: (?=\w)
push: [meta-other, attribute-key]
# close the meta mapping gab
- match: \s+
scope: meta.mapping.git.attributes
# invalid attribute name
- match: \S+
scope: invalid.illegal.attribute-name.git.attributes

meta-diff:
- meta_scope: meta.attribute.builtin.diff.git.attributes
- include: else-pop

meta-encoding:
- meta_scope: meta.attribute.builtin.encoding.git.attributes
- include: else-pop

meta-eol:
- meta_scope: meta.attribute.builtin.eol.git.attributes
- include: else-pop

meta-filter:
- meta_scope: meta.attribute.builtin.filter.git.attributes
- include: else-pop

meta-merge:
- meta_scope: meta.attribute.builtin.merge.git.attributes
- include: else-pop

meta-text:
- meta_scope: meta.attribute.builtin.text.git.attributes
- include: else-pop

meta-whitespace:
- meta_scope: meta.attribute.builtin.whitespace.git.attributes
- include: else-pop

meta-other:
- meta_scope: meta.attribute.other.git.attributes
- include: else-pop

##[ ATTRIBUTE KEY VALUE ]##############################################

attribute-key:
- match: \w+[-\w]*\b
scope: meta.mapping.key.git.attributes variable.language.attribute.git.attributes
set: attribute-maybe-value-list
- include: else-pop

attribute-maybe-value-list:
- meta_content_scope: meta.mapping.git.attributes
- match: =(?=\S)
scope: punctuation.separator.mapping.key-value.git.attributes
set: [attribute-value-list, attribute-value-content]
- match: =
scope: punctuation.separator.mapping.key-value.git.attributes
set: attribute-value-expected
- include: attribute-separator
- include: else-pop

attribute-value-list:
- meta_content_scope: meta.mapping.value.git.attributes
- include: attribute-separator
- match: ',(?=\S)'
scope: punctuation.separator.mapping.values.git.attributes
push: attribute-value-content
- match: ','
scope: punctuation.separator.mapping.values.git.attributes
set: attribute-value-expected
- match: \S
scope: invalid.illegal.value.git.attributes
- include: else-pop

attribute-value-content:
# double quoted value
- match: \"
scope: punctuation.definition.string.begin.git.attributes
set:
- meta_scope: string.quoted.double.git.attributes
- include: string-end
- match: \\[\\\"\'fnrst]
scope: constant.character.escape.git.attributes
# unquoted value is everything except , and whitespace
- match: '[^,\s]*'
scope: string.unquoted.git.attributes
pop: true
- include: else-pop

attribute-value-expected:
# Attributes are separated by whitespace
# One whitespace after each attribute/value is captured as separator
- match: \s
scope: meta.mapping.expect-value.git.attributes punctuation.separator.mapping.pair.git.attributes
pop: true

attribute-separator:
# Attributes are separated by whitespace
# One whitespace after each attribute/value is captured as separator
- match: \s
scope: meta.mapping.git.attributes punctuation.separator.mapping.pair.git.attributes
pop: true

##[ PROTOTYPES ]#######################################################

string-end:
- match: \"
scope: punctuation.definition.string.end.git.attributes
pop: true
- match: $\n?
scope: invalid.illegal.unexpected.eol.git.attributes
pop: true

else-pop:
- match: ''
pop: true
Loading