Skip to content

Commit

Permalink
Merge branch 'master' into pr/css/prepare-dialects
Browse files Browse the repository at this point in the history
  • Loading branch information
deathaxe committed Jul 3, 2022
2 parents 25701d3 + 50dc547 commit 3c72e5c
Show file tree
Hide file tree
Showing 42 changed files with 1,294 additions and 479 deletions.
12 changes: 7 additions & 5 deletions C#/C#.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -1276,7 +1276,9 @@ contexts:
- match: '->'
scope: punctuation.accessor.arrow.cs
- match: '{{bin_op}}='
scope: keyword.operator.cs
scope: keyword.operator.assignment.augmented.cs
- match: \?\?
scope: keyword.operator.null-coalescing.cs
- match: '{{bin_op}}|{{unary_op}}'
scope: keyword.operator.cs
- match: '='
Expand Down Expand Up @@ -1422,7 +1424,7 @@ contexts:
- match: ':'
scope: keyword.operator.assignment.cs
- match: _\b
scope: variable.language.deconstruction.discard.cs
scope: variable.language.anonymous.cs
- match: (?!{{reserved}})(?={{namespaced_name}}{{type_suffix}}\s+{{name}}\s*[:,])
push: var_declaration_explicit
- match: '({{name}})(<)'
Expand Down Expand Up @@ -2073,7 +2075,7 @@ contexts:
pop: true
- include: line_of_code_in
- match: \b_\b
scope: variable.language.deconstruction.discard.cs
scope: variable.language.anonymous.cs
- match: '\bwhen\b'
scope: keyword.control.switch.case.when.cs
- match: \(
Expand All @@ -2086,7 +2088,7 @@ contexts:
- match: ','
scope: punctuation.separator.sequence.cs
- match: _\b
scope: variable.language.deconstruction.discard.cs
scope: variable.language.anonymous.cs
- include: line_of_code_in_no_semicolon # needed for "when" syntax?
- match: (?={{namespaced_name}}\s+(?:\{|(?!{{reserved}}|when\b){{name}}))
push: [maybe_pattern_matching_object, var_declaration]
Expand Down Expand Up @@ -2151,7 +2153,7 @@ contexts:
scope: meta.sequence.tuple.cs punctuation.section.sequence.end.cs
pop: true
- match: _\b
scope: variable.language.deconstruction.discard.cs
scope: variable.language.anonymous.cs
- match: '{{name}}'
scope: variable.other.cs
- match: ','
Expand Down
4 changes: 2 additions & 2 deletions C#/tests/syntax_test_C#7.cs
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ string Beta
/// ^^^^^^ storage.type
/// ^^^^ variable.other
/// ^ punctuation.separator.sequence
/// ^ variable.language.deconstruction.discard
/// ^ variable.language.anonymous
/// ^ punctuation.separator.sequence
/// ^^^^^^ storage.type
/// ^^^^ variable.other
Expand All @@ -436,7 +436,7 @@ string Beta
/// ^ punctuation.separator.sequence
/// ^^^^^^^^^^ variable.other
/// ^ punctuation.separator.sequence
/// ^ variable.language.deconstruction
/// ^ variable.language.anonymous
/// ^ punctuation.section.sequence.end
/// ^ keyword.operator.assignment
var (_, _, _, pop1, _, pop2) = QueryCityDataForYears("New York City", 1960, 2010);
Expand Down
10 changes: 5 additions & 5 deletions C#/tests/syntax_test_C#8.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
int? i = null;

numbers ??= new List<int>();
/// ^^^ keyword.operator
/// ^^^ keyword.operator.assignment.augmented
numbers.Add(i ??= 17);
numbers.Add(i ??= 20);

Expand Down Expand Up @@ -48,7 +48,7 @@ public static decimal CalculateToll(object vehicle) =>
/// ^^ meta.method meta.block punctuation.separator.case-expression

_ => throw new ArgumentException("Not a known vehicle type", nameof(vehicle))
/// ^ variable.language.deconstruction.discard
/// ^ variable.language.anonymous
/// ^^ punctuation.separator.case-expression
};

Expand Down Expand Up @@ -239,11 +239,11 @@ public static string RockPaperScissors(string first, string second)
var (_, _) => Quadrant.OnBorder,
/// ^^^ storage.type.variable
/// ^^^^^^ meta.sequence.tuple
/// ^ variable.language.deconstruction.discard
/// ^ variable.language.anonymous
/// ^ punctuation.separator.sequence
/// ^ variable.language.deconstruction.discard
/// ^ variable.language.anonymous
_ => Quadrant.Unknown
/// ^ variable.language.deconstruction.discard
/// ^ variable.language.anonymous
/// ^^ punctuation.separator.case-expression
};
/// <- punctuation.section.block.end
Expand Down
5 changes: 3 additions & 2 deletions C#/tests/syntax_test_C#9.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public string LastName
/// ^^^^ keyword.declaration.function.accessor.set
/// ^^ keyword.declaration.function.arrow
/// ^^^^^^^^ variable.other
/// ^^ keyword.operator.null-coalescing
}
}

Expand Down Expand Up @@ -91,7 +92,7 @@ public record Student : Person { int ID; }
/// ^^ constant.numeric.value
/// ^^ punctuation.separator.case-expression
_ => "More than 10"
/// ^ variable.language.deconstruction.discard
/// ^ variable.language.anonymous
/// ^^ punctuation.separator.case-expression
} + ".";
/// <- punctuation.section.block.end
Expand Down Expand Up @@ -137,7 +138,7 @@ static bool CheckIfCanWalkIntoBank(Bank bank, bool isVip)
/// ^ punctuation.accessor.dot
/// ^^^^ variable.other
/// ^ punctuation.separator.sequence
/// ^ variable.language.deconstruction.discard
/// ^ variable.language.anonymous
/// ^ punctuation.section.sequence.end
/// ^^ punctuation.separator.case-expression
/// ^^^^ constant.language
Expand Down
4 changes: 3 additions & 1 deletion C++/C++.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -334,12 +334,14 @@ contexts:
- include: expressions

statements-enum:
- include: comments
- include: preprocessor-statements
- include: scope:source.c#label
- match: '{{identifier}}'
scope: entity.name.constant.c++
push: constant-value
- include: expressions
- match: ','
scope: punctuation.separator.c++

constant-value:
- match: (?=[,;}])
Expand Down
4 changes: 3 additions & 1 deletion C++/C.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -688,13 +688,15 @@ contexts:
- include: expressions

data-structures-body-enum:
- include: comments
- include: preprocessor-data-structures
- match: '(?={{before_tag}})'
push: data-structures
- match: '{{identifier}}'
scope: entity.name.constant.c
push: constant-value
- include: expressions
- match: ','
scope: punctuation.separator.c

constant-value:
- match: (?=[,;}])
Expand Down
8 changes: 8 additions & 0 deletions C++/syntax_test_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ enum { kFoo = FOO, kBar = BAR };
/* ^ keyword.operator.assignment.c */
/* ^^^ - entity.name.constant */

enum {
FOO,
/* ^^^ entity.name.constant.c */
/* ^ punctuation.separator.c */
BAR
/* ^^^ entity.name.constant.c */
};

typedef enum state { DEAD, ALIVE } State;
/* <- keyword.declaration
/* ^ entity.name.enum */
Expand Down
8 changes: 8 additions & 0 deletions C++/syntax_test_cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2010,6 +2010,14 @@ class FooBar {
and_now_method_name2();
/* ^ entity.name.function */

enum {
FOO,
/* ^^^ entity.name.constant.c++ */
/* ^ punctuation.separator.c++ */
BAR
/* ^^^ entity.name.constant.c++ */
};

enum
/* ^^^^ meta.enum keyword.declaration */
{
Expand Down
2 changes: 1 addition & 1 deletion CSS/CSS3.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ variables:
| {{viewport_percentage_lengths}}
)
font_relative_lengths: (?i:cap|ch|em|ex|ic|lh|rem|rlh)\b
viewport_percentage_lengths: (?i:vh|vw|vi|vb|vmin|vmax)\b
viewport_percentage_lengths: (?i:[sld]?(?:vh|vw|vi|vb|vmin|vmax))\b
absolute_lengths: (?i:cm|mm|q|in|pt|pc|px|fr)\b
angle_units: (?i:deg|grad|rad|turn)\b
duration_units: (?i:s|ms)\b
Expand Down
8 changes: 8 additions & 0 deletions CSS/syntax_test_css.css
Original file line number Diff line number Diff line change
Expand Up @@ -1645,6 +1645,14 @@
top: 0.9rlh;
/* ^^^^^^ meta.number.float.decimal.css */
/* ^^^ constant.numeric.value.css */
/* ^^^ constant.numeric.suffix.css */
top: 1.0vh;
/* ^^ constant.numeric.suffix.css */
top: 1.0svh;
/* ^^^ constant.numeric.suffix.css */
top: 1.0dvh;
/* ^^^ constant.numeric.suffix.css */
top: 1.0lvh;
/* ^^^ constant.numeric.suffix.css */
}

Expand Down
21 changes: 21 additions & 0 deletions Git Formats/Git Config - Fold.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>scope</key>
<string>text.git.config</string>
<key>settings</key>
<dict>
<key>foldScopes</key>
<array>
<dict>
<key>begin</key>
<string>meta.section meta.brackets punctuation.definition.brackets.end</string>
<key>end</key>
<string>meta.section meta.brackets punctuation.definition.brackets.begin</string>
<key>excludeTrailingNewlines</key>
<true/>
</dict>
</array>
</dict>
</dict>
</plist>
2 changes: 1 addition & 1 deletion Git Formats/Git Config - Symbol List.tmPreferences
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<key>name</key>
<string>Symbol List</string>
<key>scope</key>
<string>meta.brackets.git.config</string>
<string>meta.section.header.git.config meta.brackets.git.config</string>
<key>settings</key>
<dict>
<key>showInSymbolList</key>
Expand Down
17 changes: 13 additions & 4 deletions Git Formats/Git Config.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,14 @@ contexts:
section-header:
- match: \[
scope: punctuation.definition.brackets.begin.git.config
set: [expect-line-end, section-header-end, section-name]
set: [section-header-meta, section-header-end, section-name]

section-header-meta:
- meta_scope: meta.section.header.git.config
- match: $\n?
pop: 1
- match: \S
scope: invalid.illegal.expected.eol.git.config

section-header-end:
- meta_scope: meta.brackets.git.config
Expand Down Expand Up @@ -99,19 +106,20 @@ contexts:
- match: (?=^\s*\[) # start of new section
pop: 1
- match: \]
scope: punctuation.definition.brackets.end.git.config invalid.illegal.stray-bracket.git.config
scope: invalid.illegal.stray-bracket.git.config

##[ SECTION BODY ]#####################################################

# changed = red
# untracked = bold green
key-color-pair:
- meta_scope: meta.section.body.git.config
- match: ^(\s*)({{variable_name}})(\s*(\=)\s*)
captures:
1: meta.mapping.git.config
2: meta.mapping.key.git.config variable.other.readwrite.git.config
3: meta.mapping.git.config
4: keyword.operator.assignment.git.config
4: punctuation.separator.key-value.git.config
push:
- meta_content_scope: meta.mapping.value.git.config
- include: color-value
Expand All @@ -120,12 +128,13 @@ contexts:

# key = val
key-value-pair:
- meta_scope: meta.section.body.git.config
- match: ^(\s*)({{variable_name}})(\s*(\=)\s*)
captures:
1: meta.mapping.git.config
2: meta.mapping.key.git.config variable.other.readwrite.git.config
3: meta.mapping.git.config
4: keyword.operator.assignment.git.config
4: punctuation.separator.key-value.git.config
push:
- meta_content_scope: meta.mapping.value.git.config
- include: other-value
Expand Down
Loading

0 comments on commit 3c72e5c

Please sign in to comment.