Skip to content

Fix #226: Parse quoted blocks with spaces (' {) #227

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

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 2 additions & 2 deletions src/typescript/Scala.tmLanguage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -678,11 +678,11 @@ export const scalaTmLanguage: TmLanguage = {
'scala-quoted': {
patterns: [
{ // Start of `'{ .. }` or `${ .. }`
match: "['$]\\{(?!')",
match: "['$][ \\t]*\\{(?!')",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used [ \\t] instead of \\b because the Scala compiler doesn't accept newlines here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A single rule that captures the ' or $ but not rest.

{
  match: "['$](?=[ \\t]*[{[](?!'))"
  name: "..." // not sure what this should be
              // maybe "escape.scala" like in string interpolators
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could also take any space characters

  match: "['$](?=\\s*[{[](?!'))"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be more precise

  match: "['$](?=[{[](?!')|\\s+[{[])"

as it is valid to have ${'{...}} even though a warning will be emitted

name: 'punctuation.section.block.begin.scala'
},
{ // Start of `'[ .. ]`
match: "'\\[(?!')",
match: "'[ \\t]*\\[(?!')",
name: 'meta.bracket.scala'
}
]
Expand Down
Loading