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

[Go] fix backtick strings inside function calls #3868

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 3 additions & 18 deletions Go/Embeddings/Go (Embedded Backtick String).sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
2 changes: 2 additions & 0 deletions Go/Go.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,8 @@ contexts:
pop: true
- match: '{{predeclared_type}}'
scope: support.type.go
- match: (?=;)
pop: 1
deathaxe marked this conversation as resolved.
Show resolved Hide resolved
- include: match-any

match-keyword-chan:
Expand Down
17 changes: 17 additions & 0 deletions Go/tests/syntax_test_go.go
Original file line number Diff line number Diff line change
Expand Up @@ -5644,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{}) {
Expand Down Expand Up @@ -5847,3 +5854,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