Skip to content

Experimental ReScript Language Server in OCaml - #8425

Draft
aspeddro wants to merge 161 commits into
rescript-lang:masterfrom
aspeddro:lsp
Draft

aspeddro wants to merge 161 commits into
rescript-lang:masterfrom
aspeddro:lsp

Conversation

@aspeddro

@aspeddro aspeddro commented May 14, 2026 •

Copy link
Copy Markdown
Contributor

Very experimental, WIP!!

This branch introduces a ReScript LSP server built on top of the existing
analysis library. It runs in-process through rescript lsp --stdio, using the
new rescript CLI written in OCaml (rewatch-ocaml). There is no separate
rescript-language-server executable. It's a separate, OCaml-side exploration
alongside the Rust/rewatch-based experiment in #8243, the two share the same
goal (a LSP server for ReScript) but approach it from different ends of the
toolchain.

Why rewriting the server in OCaml is a good fit

The editor features are already implemented in the OCaml analysis library.
Hover, completion, references, rename, document symbols, code actions, and
diagnostics all depend on compiler data structures such as .cmt / .cmti,
typed trees, locations, package metadata, and compiler diagnostics. Running the
LSP server in OCaml lets the server call those APIs directly instead of shelling
out to rescript-editor-analysis.exe or passing JSON through stdin. That
removes a large amount of process orchestration and serialization glue, and
keeps the LSP closer to the compiler types it needs to understand. This also
makes the server easier to evolve with the compiler. When typedtree, diagnostic
formats, package discovery, or .cmt handling changes, the LSP can be updated
in the same language and build system as the analysis code. That reduces version
skew and makes bugs easier to reproduce with Dune/expect tests.

Why ship the language server with the compiler

The language server is tightly coupled to the compiler version used by a
project. It reads .cmt and .cmti files containing marshalled compiler
internals such as Typedtree, Types, and Env. These files are not a stable,
schema-aware protocol: changing one of those OCaml types can make an analysis
binary incompatible with artifacts produced by another compiler revision.

This is not only a theoretical compatibility concern. In
#8475, adding typedtree
constructors for for...of without changing the CMT magic number allowed a
newer analysis binary to read incompatible ReScript 12 artifacts and
segmentation fault. The same class of failure appeared after record-rest changes
altered compiler data stored in CMT files. Bumping the CMT magic number makes
these mismatches rejectable, but the project must still be rebuilt with the
matching compiler.

Shipping the server in the same platform package as the compiler, and exposing
it through rescript lsp --stdio, gives clients one project-local entrypoint.
The selected ReScript dependency then supplies bsc, the analysis code, and the
language server from the same release. This has several practical benefits:

  • Editors do not need to install or select a separate language-server version.
  • Projects pinned to different ReScript versions get the corresponding server.
  • Compiler, analysis, and LSP changes can be released and upgraded atomically.
  • The OCaml rescript executable links the server library directly, so no
    separate language-server executable needs to be located or launched.

Bundling does not make stale artifacts safe. Compiler changes that alter
marshalled CMT data must still bump the magic number, and the server should turn
version mismatches into an actionable request to rebuild. A separately versioned
server becomes practical only if analysis moves to a stable, explicitly
versioned artifact format or maintains decoders for multiple compiler-internal
formats. Until then, promising one server binary that supports multiple compiler
versions would hide a compatibility boundary that already exists.

What's here

  • The server library lives in lsp/src, with its own opam package
    (rescript-language-server.opam). It uses lsp (>= 1.22.0), eio,
    ppx_deriving_yojson, ppx_expect and the in-tree analysis library.
  • The entrypoint is rewatch-ocaml/rescript_ocaml.ml. The OCaml rescript
    executable links the server library and uses Eio_main.run to supply its
    filesystem, stdin and stdout.
  • Start the server with rescript lsp --stdio. The --stdio flag is required:
    rescript lsp without it fails and displays usage help. The LSP subcommand
    does not accept --quiet or --verbose.
  • End-to-end snapshot tests in tests/lsp_tests exercise the server through the
    same OCaml CLI entrypoint.

Status / what's not here yet

The main objective is to first maintain feature parity with the current server
(server.ts) as much as possible. Below is a list of some requests and
notifications. Some are out of scope because they don't make sense.

  • initialize - client request
  • initialized - client notification
  • shutdown - client request
  • exit - client notification
  • textDocument/didOpen - client notification
  • textDocument/didChange - client notification
    • Incremental change
  • textDocument/didClose - client notification
  • textDocument/didSave - client notification - It will not be
    implemented for now.
  • textDocument/hover - client request
  • textDocument/publishDiagnostics - server notification
    • More work was needed for some kinds of errors. How should circular
      dependency errors be published?
      • Circular dependency diagnostics are special-cased because the compiler log
        does not point at a precise source range. When the document is open, we
        expand the diagnostic range to cover the whole document so the editor can
        display a file-level diagnostic. If the document is not open, we keep the
        range parsed from the compiler log, i.e.,
        {start: {line: 0, character: 0}, end: {line: 0, character: 6}}
        • The shortest possible code has at least 7 characters: let a=1.
          Protocol positions are zero-based, so the position is length - 1.
    • Use Analysis for syntax errors and ignore them in the compiler log
      parser.
      • This lets the server publish syntax errors on TextDocumentDidChange and
        provide instant feedback.
    • Compiler-log diagnostics from .compiler.log - server feature
      • Add more test cases; see compiler_log.ml. See tests/build_tests
        for more examples.
      • Remove support for parsing OCaml messages?
    • Monorepo diagnostics via .sourcedirs.json - server feature
      • Requires ReScript v12.1.0. In this version, .sourcedirs.json is always
        generated with build_root field for each subpackage.
    • Add the warning number to the diagnostic message.
  • workspace/didChangeWatchedFiles - client notification
    • The server uses this notification to detect changes to generated
      .compiler.log files, which usually means a ReScript build has finished.
      When a watched log changes, the server re-reads every known compiler log and
      republishes diagnostics so stale errors are cleared and monorepo diagnostics
      stay in sync.
    • Use GlobPattern with baseUri (workspace root)?
    • Should we watch all rescript.json files in the workspace root?
      • Some features require data defined in rescript.json. For example,
        suffix and package-specs are needed to create the code action
        Open compiled JS file. Changes in dependencies impact various
        functionalities because they modify the state in
        Analysis.Shared_types.state.
      • Users can restart the server after changing the configuration.
  • client/registerCapability - server request
    • We use this because workspace/didChangeWatchedFiles is commonly registered
      dynamically. The server does not know all file-watch patterns during the
      static initialize response. In this LSP, the watcher list depends on
      project state, especially .sourcedirs.json, which tells us where each
      ReScript build root lives. In monorepos, that means the server needs to
      register watchers for compiler logs after initialization, once it has
      workspace context. That means watching generated .compiler.log files. When
      the client sees one change, it sends workspace/didChangeWatchedFiles, and
      the server refreshes diagnostics.
  • textDocument/diagnostic - client request
  • textDocument/completion - client request
  • completionItem/resolve - client request
  • textDocument/signatureHelp - client request
  • textDocument/definition - client request
  • textDocument/declaration - client request - It will not be implemented
    for now.
  • textDocument/typeDefinition - client request
  • textDocument/implementation - client request - It will not be
    implemented for now.
  • textDocument/references - client request
  • textDocument/documentHighlight - client request - It will not be
    implemented for now.
  • textDocument/documentSymbol - client request
    • Zed needs the "document_symbols": "on" configuration. When enabled,
      tree-sitter is not used for document symbols.
  • workspace/symbol - client request - It will not be implemented for
    now.
  • textDocument/codeAction - client request
    • Code actions from analysis
    • Code actions from diagnostics (refactor, quick fixes, etc)
    • Open compiled js file (Trigger workspace execute command
      rescript/openCompiled)
      • Available if the client supports window/showDocument.
    • Create interface file (Trigger workspace execute command
      rescript/createInterface)
      • Available if the interface does not exist.
    • Switch to implementation/interface (Trigger workspace execute command
      rescript/switchImplementationInterface)
      • Available if the client supports the window/showDocument request.
  • codeAction/resolve - client request - It will not be implemented for
    now.
  • textDocument/codeLens - client request
  • workspace/codeLens/refresh - server request
  • codeLens/resolve - client request - It will not be implemented for
    now.
  • textDocument/inlayHint - client request
  • inlayHint/resolve - client request - It will not be implemented for
    now.
  • textDocument/semanticTokens/full - client request
  • textDocument/semanticTokens/full/delta - client request - It will not
    be implemented for now.
  • textDocument/semanticTokens/range - client request - It will not be
    implemented for now.
  • textDocument/rename - client request
  • textDocument/prepareRename - client request
  • textDocument/formatting - client request
  • textDocument/rangeFormatting - client request - It will not be
    implemented for now.
  • textDocument/onTypeFormatting - client request - It will not be
    implemented for now.
  • textDocument/foldingRange - client request - It will not be
    implemented for now.
  • textDocument/selectionRange - client request - It will not be
    implemented for now.
  • textDocument/documentLink - client request - It will not be
    implemented for now.
  • documentLink/resolve - client request - It will not be implemented for
    now.
  • textDocument/documentColor - client request - It will not be
    implemented for now.
  • textDocument/linkedEditingRange - client request - It will not be
    implemented for now.
  • workspace/didChangeConfiguration - client notification
  • workspace/configuration - server request
  • workspace/executeCommand - client request
    • rescript/dumpServerState
      • Dump the State.t (diagnostics, document store, status, configuration,
        analysis state (Analysis.Shared_types.state) and compiler config).
      • Write a temporary .json file and open it using window/showDocument.
        Requires client support for that request; the command returns no content.
    • rescript/openCompiled: Triggered by a code action
      • Only works if the client supports window/showDocument.
    • rescript/createInterface: Triggered by a code action
      • The server creates the interface if it does not exist and opens the
        interface file if the client supports the window/showDocument request.
      • If the interface file already exists, the server sends an error.
    • rescript/switchImplementationInterface: Triggered by a code action
      • Only available if the client supports the window/showDocument request.
    • rescript/dumpCmt: Dump cmt file content
      • Write a temporary .txt file and open it using window/showDocument.
        Requires client support for that request; the command returns no content.
    • rescript/dumpParseTree It will not be implemented for now.
      • Dump parsed tree
    • rescript/dumpTypedTree It will not be implemented for now.
      • Dump typed tree
    • Flow to execute a command:
  • Custom requests
    • textDocument/openCompiled - client request
    • textDocument/createInterface - client request
    • textDocument/switchImplementationInterface: Currently it's done on the
      client side, but it could be a command triggered by a code action.
      • Move to code action feature
    • rescript/startBuild - client request - How the build integration
      will be done. See last point
      . It will not be implemented for now
      • Some questions
        • Create a setting to automatically start the build watcher during
          initialization and drop this custom request?
        • When should the build watcher be stopped? On shutdown/exit?
        • Create work-done progress?
        • Add a custom request to kill the watcher rescript/stopBuild?
  • Custom notifications
  • Channels to support
    • The current server (server.ts) supports stdio and node-ipc. The VSCode
      client uses node-ipc. This implementation supports only stdio.
    • stdio
    • socket - It will not be implemented for now
  • Support package managers: Deno, Bun, Yarn Plug'n'Play, npm, and pnpm
  • Incremental compilation - server feature
  • Build integration managed by the LSP server - server feature - It will
    not be implemented for now.
    • Build integration is still external: diagnostics come from compiler logs
      produced by an existing rescript build, rather than the LSP starting or
      managing builds itself.
  • First-class compiler support on the server. It will not be implemented
    for now. Idea to explore.
    • Instead of running a rescript watch process, it's much harder to compile
      in memory?

Tests

tests/lsp_tests/ contains OCaml ppx_expect end-to-end tests, with a named
let%expect_test for each scenario and separate modules for each feature.
Representative cases are adapted from tests/analysis_tests; the original
analysis suite remains in place. Source snippets no longer contain cursor
markers: requests use explicit, zero-based LSP positions.

The shared client in test.ml starts
rewatch-ocaml/rescript_ocaml.exe lsp --stdio through Unix.open_process_args,
avoiding Eio.Stdenv.process_mgr in the test harness so it can run on Windows,
Linux and macOS. Dune declares the CLI executable as a test dependency. The
harness supplies RESCRIPT_RUNTIME because it bypasses the npm launcher.

Tests create their source files and rescript.json from OCaml.
Test.setup_project writes the project and optionally builds it;
Test.with_project manages a temporary workspace and cleanup. Tests can add
multiple documents, edit unsaved buffers, rebuild, change settings and vary
client capabilities. Snapshots normalize temporary workspace paths while
preserving ranges and response ordering.

Coverage includes hover and JSX hover, completion and JSX completion, completion
resolution, definitions, type definitions, references, prepare rename, rename,
document symbols, semantic tokens, signature help, interface creation, code
actions, inlay hints, syntax diagnostics and code lenses. Diagnostic regression
tests cover build-log updates, stale warnings, duplicate publications, flicker
and document closure. Execute-command tests check the temporary state/CMT dump
files and window/showDocument capability handling. These tests do not imply
complete coverage or feature parity with the existing server.

Build the toolchain and runtime and run the LSP suite with:

opam exec -- make test-lsp

After the toolchain and runtime are built, run just the integration suite with
opam exec -- dune runtest tests/lsp_tests. Run opam exec -- dune runtest to
also cover inline tests in the server library, including .sourcedirs.json
build-root extraction and .compiler.log parsing. See
the snapshot test guide for helpers and commands
to review and promote snapshots.

Breaking Changes

Server settings

Proposed interface.

  • Currently (server.ts), supportMarkdownLinks is not a setting. It's a great
    feature, but some clients don't have good support; Neovim are a example.
    Therefore, I'm promoting it to a setting so users can enable or disable it.
/**
 * Server settings.
 * These configurations are requested by the server using `workspace/configuration`.
 */
interface Settings {
  hover?: {
    /**
     * Enable markdown links in hover responses
     * @default false
     */
    supportMarkdownLinks?: boolean;
  };
  /**
   * Enable code lenses for function definitions, showing the full type above each definition
   * @default false
   */
  codeLens?: boolean;
  /**
   * Place annotations inline with text to display type hints
   */
  inlayHints?: {
    /**
     * Enable inlay hints
     * @default false
     */
    enable?: boolean;
    /**
     * Maximum number of characters for inlay hints. Set to null to have an unlimited length.
     * Inlay hints that exceed the maximum length will not be shown
     * @default 25
     */
    maxLength?: number | null;
  };
}

Release and transition plan

How should the server be published? How should developers use the server?

Other related topics

Refactor analysis for use on the server side

  • Parsing from source (not just files) / decouple I/O from core logic
    #8426
    #8466
    #8478
  • Use the yojson and lsp libraries in the analysis library
    ##8436
  • Remove global state Shared_types.state
    #8465

- Move Io, Chan, and listen infrastructure to server.ml
- Simplify on_request to take a packed request directly
- Add basic hover response with markdown content
- Rename public executable to rescript-language-server
- Add `parse_implementation_from_source` to parsing/print engine types
  and all engine implementations, enabling parsing from a string source
  rather than a filename
- Use `parse_implementation_from_source` in CompletionFrontEnd
- Rename package from `rescript-lsp` to `rescript-language-server`
- Refactor LSP server with typed state, document store, and diagnostics
- Add hover support via completion backend integration
Move LSP modules under lsp/src/ with a thin lsp/bin/ entry point, add a
configuration module, and introduce a tests/lsp_tests workspace exercising
hover end-to-end.
Splits `Commands.ml` into a pure layer that returns OCaml values
(option, list, typed records like Protocol.hover,
Protocol.signatureHelp, Protocol.completionItem) and a new
`analysis/src/Cli.ml` that does the stringify-and-print step.
`analysis/bin/main.ml` now dispatches to `Cli.*`, while the LSP server
consumes `Commands.*` directly.

Makes the parsers accept source strings: `res_driver` gains
`parse_interface_from_source` alongside the existing
`parse_implementation_from_source`
@codecov

codecov Bot commented May 22, 2026 •

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

aspeddro added 10 commits May 30, 2026 15:25
- Rename Helper module to Client
- Move expected output files into workspace directories
- Improve request log format to show file path:line:col
- Simplify hover.ml by removing intermediate result binding
- Disable in-source compilation for basic-workspace
@github-actions

Copy link
Copy Markdown

Semantic Diff

1 new commit (128 total) · Full page

implement test e2e

c65e5d1 · Pedro Castro · Aug 02, 2026

@github-actions

Copy link
Copy Markdown

Semantic Diff

1 new commit (129 total) · Full page

update yarn.lock

2863c1c · Pedro Castro · Oct 23, 2026

@github-actions

Copy link
Copy Markdown

Semantic Diff

1 new commit (130 total) · Full page

remove lsp from rust rewatch

0ee23ac · Pedro Castro · Oct 23, 2026

@github-actions

Copy link
Copy Markdown

Semantic Diff

1 new commit (131 total) · Full page

update makefile lsp tests

45e23a9 · Pedro Castro · Oct 23, 2026

@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Changelog

🏠 Internal

  • Update ppx_expect to v0.17.3 to resolve test dependencies with ppxlib 0.38 and OCaml 5.5.

Semantic Diff

143 commits · Full page

initial lsp

693422c · aspeddro · Dec 01, 2024, 15:31 UTC

update

129af21 · aspeddro · Apr 29, 2026, 03:06 UTC

add state

6b65a25 · aspeddro · Apr 30, 2026, 12:13 UTC

Extract server I/O into Server module and simplify handlers

e2989d0 · aspeddro · May 12, 2026, 01:02 UTC

- Move Io, Chan, and listen infrastructure to server.ml - Simplify on_request to take a packed request directly - Add basic hover response with markdown content - Rename public executable to rescript-language-server

Add parse_implementation_from_source and refactor LSP server

a99abc6 · aspeddro · May 12, 2026, 18:49 UTC

- Add parse_implementation_from_source to parsing/print engine types and all engine implementations, enabling parsing from a string source rather than a filename - Use parse_implementation_from_source in CompletionFrontEnd - Rename package from rescript-lsp to rescript-language-server - Refactor LSP server with typed state, document store, and diagnostics - Add hover support via completion backend integration

Split LSP into bin/src layout and add hover integration test

365836c · aspeddro · May 14, 2026, 08:11 UTC

Move LSP modules under lsp/src/ with a thin lsp/bin/ entry point, add a configuration module, and introduce a tests/lsp_tests workspace exercising hover end-to-end.

Refactor analysis to decouple I/O from core logic

1692629 · aspeddro · May 16, 2026, 02:53 UTC

Splits Commands.ml into a pure layer that returns OCaml values (option, list, typed records like Protocol.hover, Protocol.signatureHelp, Protocol.completionItem) and a new analysis/src/Cli.ml that does the stringify-and-print step. analysis/bin/main.ml now dispatches to Cli.*, while the LSP server consumes Commands.* directly.

Makes the parsers accept source strings: res_driver gains parse_interface_from_source alongside the existing parse_implementation_from_source

Delegate hover logic to Analysis.Commands.hover

743126f · aspeddro · May 16, 2026, 02:54 UTC

Rename tokenModifiersString to tokenModifiers with correct type

0e522be · aspeddro · May 16, 2026, 03:53 UTC

Update dune-project

9df9079 · aspeddro · May 22, 2026, 13:17 UTC

Refactor LSP test infrastructure

29cd3d7 · aspeddro · May 31, 2026, 20:39 UTC

- Rename Helper module to Client - Move expected output files into workspace directories - Improve request log format to show file path:line:col - Simplify hover.ml by removing intermediate result binding - Disable in-source compilation for basic-workspace

ci: add linux-headers

a20da0d · aspeddro · May 31, 2026, 21:06 UTC

ci: add linux-headers-generic

5a57bbc · aspeddro · May 31, 2026, 21:19 UTC

ci: linux-libc-dev

9442c4b · aspeddro · May 31, 2026, 21:57 UTC

ci: add build-essential

64dffd8 · aspeddro · May 31, 2026, 22:11 UTC

ci: add build-essential and linux-libc-dev

e0f6296 · aspeddro · May 31, 2026, 23:16 UTC

ci: update cache version to v5

8cebaf2 · aspeddro · May 31, 2026, 23:30 UTC

ci: make Linux headers visible to musl-gcc

85138b1 · aspeddro · Jun 01, 2026, 23:26 UTC

ci: support arm and disable test for build for ocaml 5.0

66b69fe · aspeddro · Jun 01, 2026, 23:56 UTC

makefile: add test-lsp

c50f613 · aspeddro · Jun 02, 2026, 01:13 UTC

Add LSP compiler diagnostics and file watching

890fd16 · aspeddro · Jun 05, 2026, 20:35 UTC

Parse ReScript compiler logs into LSP diagnostics and keep diagnostic state in the language server so stale entries can be cleared when logs change. Read build roots from .sourcedirs.json to support monorepos and refresh diagnostics across all compiler logs instead of only the changed watch path.

Register dynamic workspace/didChangeWatchedFiles watchers after the client sends initialized, and add server-side request/response tracking so client responses to server requests no longer crash the input loop.

Tighten document store errors, thread the Eio environment through server state, update hover handling to use the current analysis API, and extend LSP tests to initialize the server before running workspace requests.

Comment to add more compiler log test

39639c6 · aspeddro · Jun 06, 2026, 16:37 UTC

ci: add lsp test step

5e002cb · aspeddro · Jun 06, 2026, 16:41 UTC

fix opam install ppx_expect

5781622 · aspeddro · Jun 06, 2026, 16:51 UTC

ppx_expect uses Jane Street-style opam versions like v0.17.2, not 0.17.2

ci: run test inside opam opam exec --

728c4bf · aspeddro · Jun 06, 2026, 17:12 UTC

lsp: disable hover supports_markdown_links for now

33edc85 · aspeddro · Jun 06, 2026, 17:27 UTC

Move Eio_main setup to LSP executable

75a6123 · aspeddro · Jun 06, 2026, 18:05 UTC

Keep the language server library independent from Eio_main by exposing a listen function that accepts input, output, and filesystem handles. Store only the filesystem handle in LSP state and remove the unused environment from the server record.

ci: skip lsp tests on Windows

126f67a · aspeddro · Jun 06, 2026, 18:21 UTC

Expand LSP request handling and diagnostics

5d14a57 · aspeddro · Jun 07, 2026, 03:50 UTC

Advertise and implement the main language server capabilities using the existing analysis commands, including completion, signature help, definition, references, document symbols, code actions, code lenses, inlay hints, semantic tokens, rename, and formatting.

Rework diagnostics so compiler log diagnostics are treated as build snapshots, stale entries are cleared, and syntax diagnostics from the current in-memory document are appended on change. Also make document symbols source-based so the LSP can serve open documents without reading from disk.

Enforce LSP server lifecycle

015a2d2 · aspeddro · Jun 07, 2026, 18:51 UTC

Track initialize, running, and shutdown states in the LSP server loop. Reject requests before initialization with ServerNotInitialized, reject requests after shutdown with InvalidRequest, and allow exit notifications to terminate with the correct status code.

Also make unsupported requests and notifications explicit in the language server handlers.

analysis refactor: remove global state Shared_types.state

bbcb7b9 · aspeddro · Jun 07, 2026, 20:10 UTC

lsp: use analysis state

b63a60f · aspeddro · Jun 07, 2026, 20:12 UTC

Revert "analysis refactor: remove global state Shared_types.state"

88190b9 · aspeddro · Jun 08, 2026, 15:19 UTC

This reverts commit bbcb7b9.

analysis: add state_to_yojson

3be179c · aspeddro · Jun 08, 2026, 23:26 UTC

lsp: refactor load_full

9bc661c · aspeddro · Jun 08, 2026, 23:28 UTC

- Add package to server state - Add to_yojson in state

add minimal param to State.to_yojson

8ec52ae · aspeddro · Jun 09, 2026, 02:11 UTC

Makefile: skip test on Windows and update ci

22a5eeb · aspeddro · Jun 09, 2026, 02:31 UTC

refactor: add discover_subpackages_and_populate

16e4fb2 · aspeddro · Jun 10, 2026, 16:11 UTC

fix type error from latest master merge

67a741f · aspeddro · Jun 10, 2026, 16:15 UTC

Improve LSP workspace initialization and package resolution

d9ca156 · aspeddro · Jun 10, 2026, 18:41 UTC

Resolve the workspace root from initialize params, initialize analysis state only after the server is initialized, and keep the active package in the initialized server state.

Populate analysis package caches for the workspace and dependencies. Resolve document requests against the package whose root best matches the document path, so nested package workspaces use the correct package metadata.

Implement code_actions.ml

ac07b29 · aspeddro · Jun 13, 2026, 12:27 UTC

lsp format: use rescript format command

ba293ab · aspeddro · Jun 13, 2026, 20:04 UTC

Add code actions from compiler log

87e280d · aspeddro · Jun 13, 2026, 22:51 UTC

Add LSP configuration handling

9f6c805 · aspeddro · Jun 14, 2026, 01:31 UTC

Pull workspace configuration from the client and decode it into typed server settings for hover, code lens, inlay hints, and signature help behavior.

Route server-initiated request responses through an on_response handler so configuration updates do not block the LSP input loop

Circular dependency diagnostics: expand end character

b4e797c · aspeddro · Jun 14, 2026, 01:54 UTC

Add LSP compiler config parsing

1566ae2 · aspeddro · Jun 14, 2026, 23:46 UTC

add code actions and custom requests

fc76cba · aspeddro · Jun 14, 2026, 23:46 UTC

fix dune tests

2fae316 · aspeddro · Jun 14, 2026, 23:48 UTC

code action: check for window/showDocuent support

0107015 · aspeddro · Jun 15, 2026, 03:13 UTC

Add LSP file navigation commands

85942cd · aspeddro · Jun 16, 2026, 00:37 UTC

Add code actions and execute commands for opening compiled output, creating interface files, switching between implementation/interface files, and dumping server state. Centralize filesystem access through option-based Eio helpers so LSP paths can be checked without raising.

chore: renames and minor fixes

2bcd312 · aspeddro · Jun 16, 2026, 01:11 UTC

add todo comments and minor fixes

879995d · aspeddro · Jun 16, 2026, 01:24 UTC

add lsp.md

e246eef · aspeddro · Jun 16, 2026, 01:29 UTC

Update lsp.md

b9d2730 · aspeddro · Jun 16, 2026, 02:56 UTC

Omit empty document symbol children

55d0431 · aspeddro · Jun 17, 2026, 15:40 UTC

DocumentSymbol.children is optional, so only set it when a symbol has nested entries. This avoids serializing leaf symbols with an empty children array.

Fix lsp document symbol

4194057 · aspeddro · Jun 17, 2026, 15:41 UTC

Update lsp.md

cc7ed4f · aspeddro · Jun 17, 2026, 15:41 UTC

Add server notification rescript/compilationFinished

de08232 · aspeddro · Jun 17, 2026, 23:45 UTC

compiler_log: add warning number

1152368 · aspeddro · Jun 17, 2026, 23:59 UTC

add warning number in diagnostic message

d2afded · aspeddro · Jun 18, 2026, 00:07 UTC

Add more test to compiler log parser

d3cfd95 · aspeddro · Jun 18, 2026, 01:42 UTC

Add cli

11ac541 · aspeddro · Jun 18, 2026, 02:18 UTC

fix Neovim bug document symbol

1ccc66e · aspeddro · Jun 19, 2026, 01:35 UTC

minimal refactor on rescript_language_server.ml

94d0d87 · aspeddro · Jun 19, 2026, 01:36 UTC

support workspace/codeLens/refresh

2943e98 · aspeddro · Jun 19, 2026, 03:24 UTC

Resolve runtime packages from workspace node_modules

0c4e43a · aspeddro · Jun 19, 2026, 14:28 UTC

Prefer package-manager installs under the active workspace when resolving dependencies, including Deno and pnpm node_modules layouts.

Keep Runtime_package.path as a compiler-development fallback so editor navigation does not jump from user projects into the server checkout.

build system: remove RESCRIPT_RUNTIME env var

47bae3b · aspeddro · Jun 19, 2026, 14:29 UTC

Make Configuration unstrict

5133b39 · aspeddro · Jun 19, 2026, 20:26 UTC

add more log message for invalid settings

a41e580 · aspeddro · Jun 19, 2026, 20:28 UTC

dump server state: add configuration and order elements

9a1bbb8 · aspeddro · Jun 19, 2026, 20:29 UTC

Server request settings from item rescript.settings

08d0f48 · aspeddro · Jun 19, 2026, 20:30 UTC

move Exit to end

e0dcc88 · aspeddro · Jun 19, 2026, 20:30 UTC

Support TextDocumentDiagnostic and improve TextDocumentDidOpen

d8e0e67 · aspeddro · Jun 19, 2026, 21:20 UTC

Publish syntax error diagnostic on open document

Keep diagnostic sources separate

7c7c209 · aspeddro · Jun 19, 2026, 22:02 UTC

Track compiler diagnostics, compiler syntax diagnostics, and open-document syntax diagnostics independently so each source can be refreshed according to its own lifetime.

A syntax-only compiler log is an incomplete build snapshot, so keep existing type diagnostics until the next complete compiler snapshot or successful empty log. Open documents continue to use in-memory syntax diagnostics, while closed documents can fall back to compiler syntax diagnostics.

Use sourcedirs for initial compiler diagnostics

5813157 · aspeddro · Jun 19, 2026, 22:17 UTC

Read diagnostics from the compiler-log roots recorded in .sourcedirs.json so opening a document can publish the last known compiler diagnostics even when the compiler is not currently running.

Keep the root lib/bs/.compiler.log fallback only for older or partial builds without sourcedirs metadata, and document the diagnostic behavior and release notes.

remove double newline from message diagnostic

393a6c3 · aspeddro · Jun 19, 2026, 22:33 UTC

update analysis tests

dd758b8 · aspeddro · Jun 19, 2026, 22:34 UTC

refactor compiler log parser

81b6f1d · aspeddro · Jun 20, 2026, 00:16 UTC

cli, print to stderr

d18955c · aspeddro · Jun 20, 2026, 01:29 UTC

refactor compiler log to use option for range

abf9743 · aspeddro · Jun 20, 2026, 01:41 UTC

Update compiler log tests snapshots

e3eab6e · aspeddro · Jun 20, 2026, 12:13 UTC

Update compiler_config.ml

0eef9a4 · aspeddro · Jun 20, 2026, 12:14 UTC

Remove comment from code_actions.ml

07cfb97 · aspeddro · Jun 20, 2026, 12:14 UTC

Avoid duplicate syntax diagnostics on document changes

3737687 · aspeddro · Jun 20, 2026, 14:13 UTC

Do not push open-buffer syntax diagnostics through textDocument/publishDiagnostics on didChange. They are already available through textDocument/diagnostic.

Keep the changed URI force-published so any stale pushed syntax diagnostics are cleared when the filtered diagnostic set is empty.

minor fixes: add todo comment and fix typos in messages

1fd9414 · aspeddro · Jun 20, 2026, 14:14 UTC

workspace/configuration section must use rescript

acb52a5 · aspeddro · Jun 20, 2026, 15:47 UTC

Improve todo comments

2f10c7f · aspeddro · Jun 20, 2026, 17:04 UTC

Update lsp.md

f8c0d4a · aspeddro · Jun 20, 2026, 17:21 UTC

Update lsp.md

42fe2ae · aspeddro · Jun 20, 2026, 17:27 UTC

Refactor cmt_viewer.dump for serve-side

be81434 · aspeddro · Jun 20, 2026, 22:04 UTC

Refactor execute commands. Move logic to module execute_commands.ml

c80ae00 · aspeddro · Jun 21, 2026, 00:12 UTC

Move format logic to module Formatter.ml

6ddcce5 · aspeddro · Jun 21, 2026, 00:23 UTC

Refactor code, better error messages

2d411c9 · aspeddro · Jun 21, 2026, 01:52 UTC

Analysis cmt dump return a string instead a option

0f16ff5 · aspeddro · Jun 21, 2026, 01:52 UTC

Update lsp.md

a5f8c82 · aspeddro · Jun 21, 2026, 01:53 UTC

minor fixes

b712f28 · aspeddro · Jun 21, 2026, 02:45 UTC

minor refactor

136c02f · aspeddro · Jun 21, 2026, 16:26 UTC

fix typo: Unknow -> Unknown

0e0b495 · aspeddro · Jun 30, 2026, 14:04 UTC

code actions: use %todo

a13340d · aspeddro · Jun 30, 2026, 14:07 UTC

Update lsp.md

82dad0a · aspeddro · Jun 30, 2026, 14:16 UTC

Update lsp.md

d313206 · aspeddro · Jun 30, 2026, 14:16 UTC

lsp.md: fix typos

23337d4 · aspeddro · Jun 30, 2026, 14:33 UTC

Add rescript_language_server.mli

539d1a6 · aspeddro · Jul 01, 2026, 16:05 UTC

update formatter and lsp.md

649ab7c · aspeddro · Jul 12, 2026, 02:40 UTC

Resolve some TODOs

3b4cfe3 · aspeddro · Jul 16, 2026, 23:55 UTC

Restore get_runtime_dir in build_system.ml

bd375c5 · aspeddro · Jul 17, 2026, 00:26 UTC

Resolve todo resolve dep resolution using analysis

7079611 · aspeddro · Jul 17, 2026, 01:02 UTC

Remove signature help setting. Enable by default

4959f72 · aspeddro · Jul 17, 2026, 01:22 UTC

Replace command rescript-vscode.go_to_location with native URls

9872578 · aspeddro · Jul 17, 2026, 02:00 UTC

file://name.res#LX,Y

Works in VSCode and Zed!!

Update lsp.md

7b4cdfc · aspeddro · Jul 17, 2026, 02:01 UTC

Restore step ci Make Linux headers visible to musl-gcc

45e2308 · aspeddro · Jul 17, 2026, 02:07 UTC

Update action.yml

e871beb · aspeddro · Jul 17, 2026, 02:20 UTC

Restore version in action.yml

87b1b87 · aspeddro · Jul 17, 2026, 02:47 UTC

Fix uring install on ci

041bf08 · aspeddro · Jul 17, 2026, 02:47 UTC

Update lsp.md and add notes.md

5568145 · aspeddro · Jul 17, 2026, 12:17 UTC

Integrate lsp command into Rewatch

a0e32ab · aspeddro · Jul 17, 2026, 15:16 UTC

Make binary statically linked

9c999ee · aspeddro · Jul 17, 2026, 18:39 UTC

Fix stale and flickering LSP diagnostics

bef996d · aspeddro · Jul 25, 2026, 02:32 UTC

Merge all diagnostic sources when serving requests and serializing state. Ignore partial compiler logs until #Done, then publish the completed snapshot and refresh pull diagnostics so clients clear resolved warnings without flickering.

add lsp in COMPILER_SOURCES

5061f2f · aspeddro · Jul 25, 2026, 02:33 UTC

fix duplicated diagnostic

1a57d99 · aspeddro · Jul 25, 2026, 03:12 UTC

Update test.ml

201b3e1 · aspeddro · Jul 25, 2026, 03:13 UTC

Fix formatter

22b5f6b · aspeddro · Jul 25, 2026, 06:20 UTC

Refactor document store to use incremental text change

6e6d0ec · aspeddro · Jul 26, 2026, 00:55 UTC

Fix neovim bug in test dev

6cd1f91 · aspeddro · Jul 26, 2026, 00:56 UTC

Update lsp.md

ea637a1 · aspeddro · Jul 26, 2026, 01:11 UTC

Add Document.extension_of_kind

30b0921 · aspeddro · Jul 31, 2026, 18:02 UTC

test: enable tests on windows using Unix.open_process_args

4356d72 · aspeddro · Jul 31, 2026, 18:22 UTC

implement test e2e

c65e5d1 · aspeddro · Aug 02, 2026, 18:40 UTC

update yarn.lock

2863c1c · aspeddro · Oct 23, 2026, 14:22 UTC

remove lsp from rust rewatch

0ee23ac · aspeddro · Oct 23, 2026, 14:36 UTC

update makefile lsp tests

45e23a9 · aspeddro · Oct 23, 2026, 15:34 UTC

add hover test

4935477 · aspeddro · Oct 23, 2026, 17:07 UTC

Add more lsp tests

646b885 · aspeddro · Oct 24, 2026, 14:43 UTC

Add full tests

a94e6d4 · aspeddro · Oct 24, 2026, 15:00 UTC

Move lsp entrypoint to rewatch-ocaml

c098344 · aspeddro · Oct 24, 2026, 22:19 UTC

Fix module shadow

b13ee89 · aspeddro · Oct 24, 2026, 22:31 UTC

Remove packages/@rescript/darwin-x64

c49c5fb · aspeddro · Oct 24, 2026, 22:36 UTC

Remove rescript_language_server_exe binary from bin.js files

e42db9a · aspeddro · Oct 24, 2026, 22:37 UTC

Fix dune runtest

bd51ede · aspeddro · Oct 24, 2026, 22:55 UTC

Restore lsp tests on CI

3c21378 · aspeddro · Oct 25, 2026, 22:26 UTC

Restore test-rewatch-rust rule in makefile

15a7428 · aspeddro · Oct 25, 2026, 22:35 UTC

✨ write file for dump cmt and server state

fec573f · aspeddro · Oct 26, 2026, 15:56 UTC · new

✨ Update lsp.md and notes.md

954d894 · aspeddro · Oct 26, 2026, 16:12 UTC · new

Signed-off-by: Pedro Castro <aspeddro@gmail.com>
Signed-off-by: Pedro Castro <aspeddro@gmail.com>
@aspeddro

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-26T16:13:47.910529Z 954d894 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

This branch has not been deployed

No deployments
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