Skip to content

Support Rescript v12 literal regex, experimental tree-sitter mode and autoload compilation rx#18

Open
mvaled wants to merge 3 commits intojjlee:masterfrom
mvaled:master
Open

Support Rescript v12 literal regex, experimental tree-sitter mode and autoload compilation rx#18
mvaled wants to merge 3 commits intojjlee:masterfrom
mvaled:master

Conversation

@mvaled
Copy link
Copy Markdown
Contributor

@mvaled mvaled commented Mar 28, 2026

This PR contains 3 different improvements:

  • Update the syntax table to avoid highlight breaks when Rescript v12's literal regexes are used
  • Auto-load the compilation and warning rx; otherwise if you just open your project dir (not a .res file) and compile, the errors won't be properly detected because rescript-mode is not loaded yet.
  • Add experimental support for tree-sitter; it doesn't work yet because the upstream grammar doesn't support the latest Rescript v12 syntax.

mvaled added 3 commits March 28, 2026 11:34
- Add regex-literal detection regex to properly handle /regex/ literals
- Add syntax-propertize-function to mark / delimiters as string fences
- This ensures quotes inside regexes don't break syntax parsing
- Tree-sitter based major mode for ReScript
- Provides syntax highlighting and indentation powered by tressister
- Uses the upstream Rescript grammar from the ReScript team
- Note: Experimental - current upstream grammar doesn't support dict syntax
  (ReScript v11.1+) or Rescript v12 yet
- To enable, add rescript-ts-mode manually after loading the package
The rescript error/warning patterns were registered at load time of
rescript-mode, but compilation-mode may parse the buffer before any
.res file is opened.  Wrap the registration in with-eval-after-load
and add autoload cookies so the patterns are available as soon as
compile.el is loaded.
@mvaled mvaled changed the title Support Rescript v12 literal regex, experimental tree-mode and autoload compilation rx Support Rescript v12 literal regex, experimental tree-sitter mode and autoload compilation rx Mar 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant