Skip to content

Commit 4bd3e82

Browse files
committed
Add deprecated highlighting
1 parent b49adb4 commit 4bd3e82

File tree

2 files changed

+34
-12
lines changed

2 files changed

+34
-12
lines changed

ReScript.sublime-syntax

+13-8
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,10 @@ contexts:
128128

129129
operator:
130130
- match:
131-
'->|\|\||&&|\+\+|\*\*|\+\.|\+|-\.|-|\*\.|\*|/\.|/|\.\.\.|\.\.|\|>|===|==|\^|:=|!|>=(?! *\?)|<=|='
131+
'->|\|\||&&|\+\+|\*\*|\+\.|\+|-\.|-|\*\.|\*|/\.|/|\.\.\.|\.\.|\|===|==|\^|:=|!|>=(?! *\?)|<=|='
132132
scope: keyword.operator
133+
- match: '\|>'
134+
scope: invalid.deprecated
133135

134136
# doesn't contain ` unlike reason-highlightjs
135137
constructor:
@@ -178,13 +180,16 @@ contexts:
178180
push: attributeContent
179181
attributeContent:
180182
- meta_scope: meta.annotation
181-
# - match: '{{RE_ATTRIBUTE}} *\('
182-
# scope: variable.annotation
183-
# push:
184-
# - match: \)
185-
# pop: true
186-
- match: '{{RE_ATTRIBUTE}}'
187-
scope: variable.annotation
183+
- match: 'bs\.send\.pipe'
184+
scope: invalid.deprecated
185+
pop: true
186+
- match: 'splice'
187+
scope: invalid.illegal
188+
pop: true
189+
- match: '(bs\.)?({{RE_ATTRIBUTE}})'
190+
captures:
191+
1: invalid.deprecated
192+
2: variable.annotation
188193
pop: true
189194

190195
jsx:

syntax_test.res

+21-4
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,24 @@ let getAudience = (~excited) => excited ? "world!" : "world"
425425

426426
// === external
427427

428-
@bs.module external foo: {..} => {..} = "bla"
429-
// ^^ keyword.operator
430-
// ^^ storage.type.function keyword.declaration.function
431-
// ^^ keyword.operator
428+
@module external foo: {..} => {..} = "bla"
429+
// ^^^^^^ meta.annotation variable.annotation
430+
// ^^ keyword.operator
431+
// ^^ storage.type.function keyword.declaration.function
432+
// ^^ keyword.operator
433+
434+
435+
// === deprecated
436+
437+
myList |> map
438+
// ^^ invalid.deprecated
439+
@bs.send.pipe external a: b => c = ""
440+
// ^^^^^^^^^^^^ meta.annotation invalid.deprecated
441+
@bs.module external a: b = ""
442+
// ^^^ meta.annotation invalid.deprecated
443+
@splice external a: b = ""
444+
// ^^^^^^ meta.annotation invalid.illegal
445+
@bs.variadic external a: b = ""
446+
// ^^^ meta.annotation invalid.deprecated
447+
@variadic external a: b = "" // works
448+
// ^^^^^^^^ meta.annotation variable.annotation

0 commit comments

Comments
 (0)