Skip to content
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
8 changes: 4 additions & 4 deletions extension.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
id = "rescript"
name = "ReScript"
description = "ReScript support."
version = "0.4.3"
version = "0.5.0"
schema_version = 1
authors = ["Karolis Narkevicius <hey@kn8.lt>"]
repository = "https://github.com/rescript-lang/rescript-zed"
repository = "https://github.com/sigurthor/rescript-zed"

[language_servers.rescript-language-server]
name = "rescript-language-server"
language = "ReScript"

[grammars.rescript]
repository = "https://github.com/rescript-lang/tree-sitter-rescript"
commit = "64249e68649c77d3c880e335469b464674ad1cbf"
repository = "https://github.com/sigurthor/tree-sitter-rescript"
commit = "f81040d23a3c2970e467432178043162acabdd34"
8 changes: 8 additions & 0 deletions languages/rescript/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,14 @@
(jsx_fragment [">" "<" "/"] @tag.delimiter)
(jsx_attribute (property_identifier) @tag.attribute)


; Regex literals
;---------------

(regex "/" @punctuation.special)
(regex_pattern) @string.special.regex
(regex_flags) @operator

; Error
;----------

Expand Down
4 changes: 4 additions & 0 deletions languages/rescript/injections.scm
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@
(#eq? @_name "relay")
(expression_statement
(_ (_) @injection.content (#set! injection.language "graphql") )))

; Native regex literals (/pattern/flags)
(regex
(regex_pattern) @injection.content (#set! injection.language "regex"))
76 changes: 76 additions & 0 deletions languages/rescript/outline.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
; Let declarations, e.g. `let foo = 42`
(let_declaration
["let" "export"] @context
(let_binding
pattern: (_) @name) @item)

; Recursive let declarations, e.g. `let rec fib = n => ...`
(let_declaration
["let" "export"] @context
"rec" @context
(let_binding
pattern: (_) @name) @item)

; Type declarations, e.g. `type t = int`
(type_declaration
"type" @context
(type_binding
name: (_) @name) @item)

; Recursive type declarations, e.g. `type rec tree<'a> = ...`
(type_declaration
"type" @context
"rec" @context
(type_binding
name: (_) @name) @item)

; Exported type declarations, e.g. `export type t = int`
(type_declaration
"export" @context
"type" @context
(type_binding
name: (_) @name) @item)

; Module declarations, e.g. `module Foo = { ... }`
(module_declaration
"module" @context
(module_binding
name: (_) @name) @item)

; Recursive module declarations
(module_declaration
"module" @context
"rec" @context
(module_binding
name: (_) @name) @item)

; Module type declarations
(module_declaration
"module" @context
"type" @context
(module_binding
name: (_) @name) @item)

; External declarations
(external_declaration
"external" @context
(value_identifier) @name) @item

; Exception declarations
(exception_declaration
"exception" @context
(variant_identifier) @name) @item

; Open statements
(open_statement
"open" @context
(_) @name) @item

; Include statements
(include_statement
"include" @context
(_) @name) @item

; Variant declarations inside type bodies
(variant_declaration
(variant_identifier) @name) @item