diff --git a/grammars/csharp.tmLanguage b/grammars/csharp.tmLanguage
index 4064c73..4f47c06 100644
--- a/grammars/csharp.tmLanguage
+++ b/grammars/csharp.tmLanguage
@@ -6872,11 +6872,32 @@
name
storage.modifier.cs
match
- \b(ref|out|in)\b
+ \b(ref|in)\b
- include
- #declaration-expression-local
+ begin
+ \b(out)\b
+ beginCaptures
+
+ 1
+
+ name
+ storage.modifier.cs
+
+
+ end
+ (?=,|\)|\])
+ patterns
+
+
+ include
+ #declaration-expression-local
+
+
+ include
+ #expression
+
+
include
diff --git a/grammars/csharp.tmLanguage.cson b/grammars/csharp.tmLanguage.cson
index 17c3db2..e5acf75 100644
--- a/grammars/csharp.tmLanguage.cson
+++ b/grammars/csharp.tmLanguage.cson
@@ -4141,10 +4141,22 @@ repository:
patterns: [
{
name: "storage.modifier.cs"
- match: "\\b(ref|out|in)\\b"
+ match: "\\b(ref|in)\\b"
}
{
- include: "#declaration-expression-local"
+ begin: "\\b(out)\\b"
+ beginCaptures:
+ "1":
+ name: "storage.modifier.cs"
+ end: "(?=,|\\)|\\])"
+ patterns: [
+ {
+ include: "#declaration-expression-local"
+ }
+ {
+ include: "#expression"
+ }
+ ]
}
{
include: "#expression"
diff --git a/src/csharp.tmLanguage.yml b/src/csharp.tmLanguage.yml
index 4648f6b..35f45fb 100644
--- a/src/csharp.tmLanguage.yml
+++ b/src/csharp.tmLanguage.yml
@@ -2753,8 +2753,14 @@ repository:
argument:
patterns:
- name: storage.modifier.cs
- match: \b(ref|out|in)\b
- - include: '#declaration-expression-local'
+ match: \b(ref|in)\b
+ - begin: \b(out)\b
+ beginCaptures:
+ '1': { name: storage.modifier.cs }
+ end: (?=,|\)|\])
+ patterns:
+ - include: '#declaration-expression-local'
+ - include: '#expression'
- include: '#expression'
query-expression:
diff --git a/test/expressions.tests.ts b/test/expressions.tests.ts
index 5b713bb..902f494 100644
--- a/test/expressions.tests.ts
+++ b/test/expressions.tests.ts
@@ -2112,28 +2112,6 @@ var result = list.Select(l => new {
]);
});
- it("in argument declaration", async () => {
- const input = Input.InMethod(`var o = P[in int x, in var y];`);
- const tokens = await tokenize(input);
-
- tokens.should.deep.equal([
- Token.Keywords.Var,
- Token.Identifiers.LocalName("o"),
- Token.Operators.Assignment,
- Token.Variables.Property("P"),
- Token.Punctuation.OpenBracket,
- Token.Keywords.Modifiers.In,
- Token.PrimitiveType.Int,
- Token.Identifiers.LocalName("x"),
- Token.Punctuation.Comma,
- Token.Keywords.Modifiers.In,
- Token.Keywords.Var,
- Token.Identifiers.LocalName("y"),
- Token.Punctuation.CloseBracket,
- Token.Punctuation.Semicolon
- ]);
- });
-
it("member of generic with no arguments", async () => {
const input = Input.InMethod(`var o = C.P[];`);
const tokens = await tokenize(input);
@@ -2644,25 +2622,6 @@ long total = (data["bonusGame"]["win"].AsLong) * data["bonusGame"]["betMult"].As
]);
});
- it("in argument declaration", async () => {
- const input = Input.InMethod(`M(in int x, in var y);`);
- const tokens = await tokenize(input);
-
- tokens.should.deep.equal([
- Token.Identifiers.MethodName("M"),
- Token.Punctuation.OpenParen,
- Token.Keywords.Modifiers.In,
- Token.PrimitiveType.Int,
- Token.Identifiers.LocalName("x"),
- Token.Punctuation.Comma,
- Token.Keywords.Modifiers.In,
- Token.Keywords.Var,
- Token.Identifiers.LocalName("y"),
- Token.Punctuation.CloseParen,
- Token.Punctuation.Semicolon
- ]);
- });
-
it("generic with no arguments", async () => {
const input = Input.InMethod(`M();`);
const tokens = await tokenize(input);