From 324957cbeb39ca857ca51c09c8cfd295081799ef Mon Sep 17 00:00:00 2001 From: Jeff Hykin Date: Wed, 12 Jun 2019 01:40:45 -0500 Subject: [PATCH] temp fix for #230 --- source/languages/cpp/generate.rb | 3 ++ syntaxes/cpp.tmLanguage.json | 3 ++ syntaxes/cpp.tmLanguage.yaml | 1 + test/fixtures/issues/230.cpp | 4 ++ test/specs/issues/230.cpp.yaml | 83 ++++++++++++++++++++++++++++++++ 5 files changed, 94 insertions(+) create mode 100644 test/fixtures/issues/230.cpp create mode 100644 test/specs/issues/230.cpp.yaml diff --git a/source/languages/cpp/generate.rb b/source/languages/cpp/generate.rb index 5a0dda98..63e6ab7f 100644 --- a/source/languages/cpp/generate.rb +++ b/source/languages/cpp/generate.rb @@ -2171,6 +2171,9 @@ def generateBlockFinder( name:"", tag_as:"", start_pattern:nil, needs_semicolon: } }, patterns: [ + { + include: "#parameter_struct", + }, { include: "#root_context" } diff --git a/syntaxes/cpp.tmLanguage.json b/syntaxes/cpp.tmLanguage.json index 7a1bea02..67eadfa2 100644 --- a/syntaxes/cpp.tmLanguage.json +++ b/syntaxes/cpp.tmLanguage.json @@ -7013,6 +7013,9 @@ } }, "patterns": [ + { + "include": "#parameter_struct" + }, { "include": "#root_context" } diff --git a/syntaxes/cpp.tmLanguage.yaml b/syntaxes/cpp.tmLanguage.yaml index 8c474c84..f09f155e 100644 --- a/syntaxes/cpp.tmLanguage.yaml +++ b/syntaxes/cpp.tmLanguage.yaml @@ -3714,6 +3714,7 @@ '0': name: punctuation.section.parens.end.bracket.round.cpp patterns: + - include: "#parameter_struct" - include: "#root_context" parentheses_block: name: meta.parens.block.cpp diff --git a/test/fixtures/issues/230.cpp b/test/fixtures/issues/230.cpp new file mode 100644 index 00000000..d085f3eb --- /dev/null +++ b/test/fixtures/issues/230.cpp @@ -0,0 +1,4 @@ +void func() +{ + struct var** thing = (struct var**)func(); //comment +} \ No newline at end of file diff --git a/test/specs/issues/230.cpp.yaml b/test/specs/issues/230.cpp.yaml new file mode 100644 index 00000000..278d0314 --- /dev/null +++ b/test/specs/issues/230.cpp.yaml @@ -0,0 +1,83 @@ +- source: void + scopesBegin: + - source + - meta.function.definition + scopes: + - meta.qualified_type + - storage.type.primitive + - storage.type.built-in.primitive +- source: func + scopesBegin: + - meta.head.function.definition + scopes: + - entity.name.function.definition +- source: ( + scopes: + - punctuation.section.parameters.begin.bracket.round +- source: ) + scopes: + - punctuation.section.parameters.end.bracket.round +- source: '{' + scopes: + - punctuation.section.block.begin.bracket.curly.function.definition + scopesEnd: + - meta.head.function.definition +- source: struct + scopesBegin: + - meta.body.function.definition + scopes: + - storage.type.struct.declare +- source: var + scopes: + - entity.name.type.struct +- source: '**' + scopes: + - storage.modifier.pointer +- source: thing + scopes: + - variable.other.object.declare +- source: = + scopes: + - keyword.operator.assignment +- source: ( + scopesBegin: + - meta.parens + scopes: + - punctuation.section.parens.begin.bracket.round +- source: struct + scopes: + - storage.type.struct.parameter +- source: var + scopes: + - entity.name.type.struct.parameter +- source: '**' + scopes: + - storage.modifier.pointer +- source: ) + scopes: + - punctuation.section.parens.end.bracket.round + scopesEnd: + - meta.parens +- source: func + scopes: + - entity.name.function.call +- source: ( + scopes: + - punctuation.section.arguments.begin.bracket.round.function.call +- source: ) + scopes: + - punctuation.section.arguments.end.bracket.round.function.call +- source: ; + scopes: + - punctuation.terminator.statement +- source: // + scopesBegin: + - comment.line.double-slash + scopes: + - punctuation.definition.comment +- source: comment + scopesEnd: + - comment.line.double-slash +- source: '}' + scopes: + - punctuation.section.block.end.bracket.curly.function.definition