Skip to content

Commit

Permalink
Highlight argument default values in function types
Browse files Browse the repository at this point in the history
This syntax is technically not supported by Haxe, but it's still useful to highlight this for hover hints.
  • Loading branch information
Gama11 committed Jun 7, 2018
1 parent ec4473f commit 2f9d29e
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 2 deletions.
126 changes: 126 additions & 0 deletions baselines/HoverHints.hx.baseline.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
original file
-----------------------------------
var t:(?opt:Int, ?opt2:Int, def:Int = 0, ?both:Int = 0, foo:String = "Foo", b:Bool = false) -> Void;
-----------------------------------

>var t:(?opt:Int, ?opt2:Int, def:Int = 0, ?both:Int = 0, foo:String = "Foo", b:Bool = false) -> Void;
^^^
source.hx storage.type.variable.hx
^
source.hx
^
source.hx variable.other.hx
^
source.hx keyword.operator.type.annotation.hx
^
source.hx punctuation.definition.parameters.begin.hx
^
source.hx keyword.operator.optional.hx
^^^
source.hx variable.parameter.hx
^
source.hx keyword.operator.type.annotation.hx
^^^
source.hx support.class.builtin.hx
^
source.hx
^
source.hx
^
source.hx keyword.operator.optional.hx
^^^^
source.hx variable.parameter.hx
^
source.hx keyword.operator.type.annotation.hx
^^^
source.hx support.class.builtin.hx
^
source.hx
^
source.hx
^^^
source.hx variable.parameter.hx
^
source.hx keyword.operator.type.annotation.hx
^^^
source.hx support.class.builtin.hx
^
source.hx
^
source.hx keyword.operator.assignment.hx
^
source.hx
^
source.hx constant.numeric.decimal.hx
^
source.hx
^
source.hx
^
source.hx keyword.operator.optional.hx
^^^^
source.hx variable.parameter.hx
^
source.hx keyword.operator.type.annotation.hx
^^^
source.hx support.class.builtin.hx
^
source.hx
^
source.hx keyword.operator.assignment.hx
^
source.hx
^
source.hx constant.numeric.decimal.hx
^
source.hx
^
source.hx
^^^
source.hx variable.parameter.hx
^
source.hx keyword.operator.type.annotation.hx
^^^^^^
source.hx support.class.builtin.hx
^
source.hx
^
source.hx keyword.operator.assignment.hx
^
source.hx
^
source.hx string.quoted.double.hx punctuation.definition.string.begin.hx
^^^
source.hx string.quoted.double.hx
^
source.hx string.quoted.double.hx punctuation.definition.string.end.hx
^
source.hx
^
source.hx
^
source.hx variable.parameter.hx
^
source.hx keyword.operator.type.annotation.hx
^^^^
source.hx support.class.builtin.hx
^
source.hx
^
source.hx keyword.operator.assignment.hx
^
source.hx
^^^^^
source.hx constant.language.hx
^
source.hx punctuation.definition.parameters.end.hx
^
source.hx
^^
source.hx keyword.operator.type.function.hx
^
source.hx
^^^^
source.hx support.class.builtin.hx
^
source.hx punctuation.terminator.hx
1 change: 1 addition & 0 deletions cases/HoverHints.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var t:(?opt:Int, ?opt2:Int, def:Int = 0, ?both:Int = 0, foo:String = "Foo", b:Bool = false) -> Void;
3 changes: 2 additions & 1 deletion haxe.YAML-tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,7 @@ repository:
- include: '#punctuation-comma'
- include: '#function-type-parameter-name'
- include: '#function-type-parameter-type-hint'
- include: '#parameter-assign'
- include: '#type'
- include: '#global'
function-type-parameter-name:
Expand All @@ -1003,7 +1004,7 @@ repository:
begin: ':'
beginCaptures:
'0': {name: keyword.operator.type.annotation.hx}
end: (?=\)|,)
end: (?=\)|,|=)
patterns:
- include: '#type'
type-name:
Expand Down
2 changes: 1 addition & 1 deletion haxe.tmLanguage

Large diffs are not rendered by default.

0 comments on commit 2f9d29e

Please sign in to comment.