Skip to content

Commit

Permalink
[Scala] Improved bail-out behavior in function scoping
Browse files Browse the repository at this point in the history
  • Loading branch information
djspiewak committed Dec 23, 2016
1 parent 92971b3 commit 360fdf2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Scala/Scala.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -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 Down
12 changes: 12 additions & 0 deletions Scala/syntax_test_scala.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1429,3 +1429,15 @@ class Foo extends Bar
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

0 comments on commit 360fdf2

Please sign in to comment.