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

[Scala] Various stateful bailout bugs #756

Merged
merged 2 commits into from
Dec 23, 2016
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
25 changes: 13 additions & 12 deletions Scala/Scala.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ contexts:
# this is included when a single newline is found in a declaration
# you should never push/set this context, only include
decl-newline-double-check:
- match: '(?=[\{\}\)]|\b(class|def|val|var|trait|object|private|protected|for|while|if|)\b)'
- match: '(?=[\{\}\)]|\b(case|class|def|val|var|trait|object|private|protected|for|while|if)\b)'
pop: true
- match: '\n'
pop: true
Expand All @@ -399,10 +399,12 @@ contexts:
push: function-tparams-brackets
- match: ':'
set: function-return-type-definition
- match: '\n'
set: function-type-parameter-list-newline
- match: '(?=[\{\};]|{{nonopchar}}?={{nonopchar}})'
pop: true
- match: (?=\S)
pop: true
- match: '\n'
set: function-type-parameter-list-newline

function-type-parameter-list-newline:
- include: decl-newline-double-check
Expand All @@ -423,6 +425,8 @@ contexts:
- match: '(?=[\{\};]|{{nonopchar}}?={{nonopchar}})'
pop: true
- include: delimited-type-expression
- match: (?=\S)
pop: true

function-return-type-definition-newline:
- include: decl-newline-double-check
Expand Down Expand Up @@ -457,7 +461,7 @@ contexts:
set: function-return-type-definition
- match: '\n'
set: function-parameter-list-newline
- match: '(?=[\{=])'
- match: '(?=\S)'
pop: true

function-parameter-list-newline:
Expand All @@ -473,7 +477,7 @@ contexts:
- match: '\['
push: class-tparams-brackets
- match: '(?=\b(extends|with)\b)'
set: class-inheritance
set: class-inheritance-extends
- match: '(?=\{)'
set: class-pre-inheritance-early-initializer
- match: '\n'
Expand Down Expand Up @@ -519,12 +523,12 @@ contexts:
- match: '(?=[=])'
pop: true
- include: main
- match: '\n'
set: class-parameter-list-newline
- match: '(?=\b(extends|with)\b)'
set: class-inheritance
set: class-inheritance-extends
- match: '(?=\{)'
set: class-pre-inheritance-early-initializer
- match: '\n'
set: class-parameter-list-newline

class-parameter-list-newline:
- include: decl-newline-double-check
Expand Down Expand Up @@ -552,9 +556,6 @@ contexts:
- match: '(?=\S)'
set: class-pre-inheritance-early-initializer

class-inheritance:
- include: class-inheritance-extends

class-inheritance-extends:
- match: \bwith\b
scope: invalid.keyword.with-before-extends.scala
Expand All @@ -570,7 +571,7 @@ contexts:
class-inheritance-extends-newline:
- include: decl-newline-double-check
- match: '(?=\S)'
set: class-inheritance
set: class-inheritance-extends

class-inheritance-extends-token:
- match: '{{id}}'
Expand Down
28 changes: 28 additions & 0 deletions Scala/syntax_test_scala.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1413,3 +1413,31 @@ class Foo extends (Int => String)
class Foo extends Bar[Int]
// ^ punctuation.section.brackets.begin.scala
// ^ punctuation.section.brackets.end.scala

class Foo
extends Bar
// ^^^^^^^ keyword.declaration.scala
// ^^^ entity.other.inherited-class.scala

class Foo extends Bar
with Baz
// ^^^^ keyword.declaration.scala
// ^^^ entity.other.inherited-class.scala

class Foo extends Bar
with Baz
with Bin
// ^^^^ keyword.declaration.scala
// ^^^ entity.other.inherited-class.scala

def foo
42
// ^^ constant.numeric.integer.scala

def foo()
42
// ^^ constant.numeric.integer.scala

def foo():
42
// ^^ constant.numeric.integer.scala