From 36f38c19986bd5f1f222de18e6111b045deaa9ea Mon Sep 17 00:00:00 2001 From: Keith Hall Date: Thu, 16 Nov 2023 19:48:22 +0200 Subject: [PATCH 1/4] [Go] fix match-case-value context never popping off the stack --- Go/Go.sublime-syntax | 2 ++ Go/tests/syntax_test_go.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Go/Go.sublime-syntax b/Go/Go.sublime-syntax index a1433867f1..80707c3444 100644 --- a/Go/Go.sublime-syntax +++ b/Go/Go.sublime-syntax @@ -916,6 +916,8 @@ contexts: pop: true - match: '{{predeclared_type}}' scope: support.type.go + - match: (?=;) + pop: 1 - include: match-any match-keyword-chan: diff --git a/Go/tests/syntax_test_go.go b/Go/tests/syntax_test_go.go index a2f7e23645..dddf796f12 100644 --- a/Go/tests/syntax_test_go.go +++ b/Go/tests/syntax_test_go.go @@ -4961,7 +4961,7 @@ by accident, but if necessary, such support could be sacrificed. break // ^^^^^ keyword.control.flow.break.go - case + case ; // ^^^^ keyword.control.conditional.case.go continue // ^^^^^^^^ keyword.control.flow.continue.go From c6dddb98c59eda97f344599a0b350fe46eda3f4c Mon Sep 17 00:00:00 2001 From: Keith Hall Date: Thu, 16 Nov 2023 19:48:35 +0200 Subject: [PATCH 2/4] [Go] fix backtick strings with embedded languages inside function calls --- ... (Embedded Backtick String).sublime-syntax | 21 +++---------------- Go/tests/syntax_test_go.go | 10 +++++++++ 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/Go/Embeddings/Go (Embedded Backtick String).sublime-syntax b/Go/Embeddings/Go (Embedded Backtick String).sublime-syntax index 97bd49073e..142fa11b8d 100644 --- a/Go/Embeddings/Go (Embedded Backtick String).sublime-syntax +++ b/Go/Embeddings/Go (Embedded Backtick String).sublime-syntax @@ -17,7 +17,7 @@ contexts: - match: '{{newline}}' scope: comment.line.double-slash.go set: - - match-any + - match-any-root - consume-comments-at-beginning-of-line consume-comments-at-beginning-of-line: @@ -26,21 +26,6 @@ contexts: - match: ^(?!\s*/[/*]) pop: true - match-any: - - meta_prepend: true + match-any-root: - include: pop-on-eol - - match-parens: - - meta_prepend: true - - match: (?=\)) - pop: true - - match-brackets: - - meta_prepend: true - - match: (?=\]) - pop: true - - match-braces: - - meta_prepend: true - - match: (?=\}) - pop: true + - include: match-any diff --git a/Go/tests/syntax_test_go.go b/Go/tests/syntax_test_go.go index dddf796f12..5940823596 100644 --- a/Go/tests/syntax_test_go.go +++ b/Go/tests/syntax_test_go.go @@ -5847,3 +5847,13 @@ func lang_embedding() { // ^^^^^^^^^^^ meta.interpolation.go // ^ meta.string.go string.quoted.backtick.go punctuation.definition.string.end.go } + +// language=sql +some_func_call( + args_on_next_line, ` + SELECT min(a) + FROM b + WHERE c = @p1`, "some value", + // ^^^^^^^^^^^^^^ meta.string.go meta.embedded.go source.sql.embedded.go +) +// <- punctuation.section.parens.end.go - invalid From eb053e481a368130b528381a2b8f6a044dc484a1 Mon Sep 17 00:00:00 2001 From: Keith Hall Date: Fri, 17 Nov 2023 05:03:39 +0200 Subject: [PATCH 3/4] [Go] add a test for incomplete case statements missing a colon --- Go/tests/syntax_test_go.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Go/tests/syntax_test_go.go b/Go/tests/syntax_test_go.go index 5940823596..5785f83db5 100644 --- a/Go/tests/syntax_test_go.go +++ b/Go/tests/syntax_test_go.go @@ -4961,8 +4961,12 @@ by accident, but if necessary, such support could be sacrificed. break // ^^^^^ keyword.control.flow.break.go - case ; + case no_colon_here_while_user_is_typing // ^^^^ keyword.control.conditional.case.go + ; a := b +// ^ punctuation.terminator +// ^ - punctuation.separator.case-statement +// ^^ keyword.operator.assignment continue // ^^^^^^^^ keyword.control.flow.continue.go default From cfb5f70259b0c6f76cee661c5683e4d94326b4bf Mon Sep 17 00:00:00 2001 From: Keith Hall Date: Sun, 26 Nov 2023 14:21:01 +0200 Subject: [PATCH 4/4] [Go] move syntax test to a more appropriate place --- Go/tests/syntax_test_go.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Go/tests/syntax_test_go.go b/Go/tests/syntax_test_go.go index 5785f83db5..b0ba238d7f 100644 --- a/Go/tests/syntax_test_go.go +++ b/Go/tests/syntax_test_go.go @@ -4961,12 +4961,8 @@ by accident, but if necessary, such support could be sacrificed. break // ^^^^^ keyword.control.flow.break.go - case no_colon_here_while_user_is_typing + case // ^^^^ keyword.control.conditional.case.go - ; a := b -// ^ punctuation.terminator -// ^ - punctuation.separator.case-statement -// ^^ keyword.operator.assignment continue // ^^^^^^^^ keyword.control.flow.continue.go default @@ -5648,6 +5644,13 @@ func main() { // plan9, windows... fmt.Printf("%s.\n", os) } + switch os { + case no_colon_here_while_user_is_typing + ; a := b +// ^ punctuation.terminator +// ^ - punctuation.separator.case-statement +// ^^ keyword.operator.assignment + } } func do(i interface{}) {