From 9bb6dcd1caca18f5fe555ba94e862715d710048e Mon Sep 17 00:00:00 2001 From: Raffaele Lungarella Date: Sat, 7 Feb 2026 18:07:15 +0100 Subject: [PATCH] Add outline.scm file to enable search buffer symbols --- languages/rescript/outline.scm | 76 ++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 languages/rescript/outline.scm diff --git a/languages/rescript/outline.scm b/languages/rescript/outline.scm new file mode 100644 index 0000000..536ec03 --- /dev/null +++ b/languages/rescript/outline.scm @@ -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, e.g. `module rec Foo = { ... }` +(module_declaration + "module" @context + "rec" @context + (module_binding + name: (_) @name) @item) + +; Module type declarations, e.g. `module type S = { ... }` +(module_declaration + "module" @context + "type" @context + (module_binding + name: (_) @name) @item) + +; External declarations, e.g. `external log: string => unit = "console.log"` +(external_declaration + "external" @context + (value_identifier) @name) @item + +; Exception declarations, e.g. `exception NotFound` +(exception_declaration + "exception" @context + (variant_identifier) @name) @item + +; Open statements, e.g. `open Belt` +(open_statement + "open" @context + (_) @name) @item + +; Include statements, e.g. `include React.Component` +(include_statement + "include" @context + (_) @name) @item + +; Variant declarations inside type bodies, e.g. `Foo | Bar(int)` +(variant_declaration + (variant_identifier) @name) @item