Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
f563538
Introduce OpenTelemetry in rewatch and setup new test infrastructure
nojaf Feb 6, 2026
e632783
Gracefully shutdown watcher via stdin EOF
nojaf Feb 6, 2026
a4db5ed
Deduplicate and normalize file watch events
nojaf Feb 6, 2026
9ba38d7
Match original line endings in format output on Windows
nojaf Feb 6, 2026
6acd8d3
Improve rewatch span propagation and watcher error handling
nojaf Feb 6, 2026
c83ff8d
Add fixture packages and enhance test infrastructure
nojaf Feb 6, 2026
c28e88f
Add build and build error tests
nojaf Feb 6, 2026
2a9b6df
Add module, namespace, and dev-dependency tests
nojaf Feb 6, 2026
6f653bb
Add config, module system, PPX, and JSX tests
nojaf Feb 6, 2026
a63d1e5
Add clean tests
nojaf Feb 6, 2026
8e33451
Add format and compiler-args tests
nojaf Feb 6, 2026
239fd42
Add lock test
nojaf Feb 6, 2026
d781035
Add watch tests
nojaf Feb 6, 2026
e7210b9
SLEEP NOW IN THE FIRE
nojaf Feb 6, 2026
281064a
Add changelog entry
nojaf Feb 6, 2026
bd3b38b
Fix compile_file spans not nested under compile_wave in OTEL traces
nojaf Feb 6, 2026
2c72389
Add rescript lsp vision
nojaf Feb 6, 2026
41504ed
Initial Rewatch LSP setup
nojaf Feb 7, 2026
d6ebcec
Trim CI to rewatch-focused jobs only
nojaf Feb 7, 2026
b4328ad
Disable cli_help test
nojaf Feb 7, 2026
2afd73e
Detect watch patterns on initialize.
nojaf Feb 7, 2026
e89e0fd
Run initial build when lsp server starts.
nojaf Feb 7, 2026
93be352
LSP: scope did_save compilation to dependency closure
nojaf Feb 7, 2026
38963b6
Add additional test to assert that dependent files from external npm
nojaf Feb 7, 2026
6be0a2a
LSP: implement textDocument/didChange and two-phase didSave
nojaf Feb 7, 2026
9b99727
Fix Windows normalization for snapshot
nojaf Feb 7, 2026
05398ce
Add -bs-read-stdin flag to bsc; use stdin piping in LSP didChange
nojaf Feb 7, 2026
ff6a5ac
Implement textDocument/completion in rescript lsp
nojaf Feb 7, 2026
78ef5d0
Update prose to latest state.
nojaf Feb 7, 2026
6e19a4d
Ensure we complete from @rescript/runtime
nojaf Feb 7, 2026
19aec53
Enrich completion snapshots
nojaf Feb 7, 2026
7247e97
Use rewatch subcommand
nojaf Feb 7, 2026
5ab701a
Implement textDocument/formatting and textDocument/didOpen in LSP
nojaf Feb 7, 2026
5b536cf
Reuse windows line ending check during formatting.
nojaf Feb 8, 2026
c5a2048
Implement textDocument/didClose and enforce open-before-edit in LSP
nojaf Feb 8, 2026
2dba438
Rename CommandsRewatch functions and refactor LSP test client
nojaf Feb 8, 2026
07aa23f
Implement textDocument/definition in LSP and refactor shared helpers
nojaf Feb 8, 2026
b52b1f3
Implement textDocument/typeDefinition in LSP
nojaf Feb 8, 2026
016216d
Fix Windows CI: use uri_to_file_path for did_open/did_close span paths
nojaf Feb 8, 2026
a22ed40
Implement textDocument/references in LSP
nojaf Feb 8, 2026
a893c27
Don't do manual JSON parsing in rewatch
nojaf Feb 8, 2026
df7fc51
Fix CI: remove cross-package fixture dependency that broke build-modules
nojaf Feb 8, 2026
dc78b96
Implement textDocument/documentSymbol in LSP
nojaf Feb 9, 2026
1075c2a
Implement textDocument/prepareRename and textDocument/rename in LSP
nojaf Feb 9, 2026
ba85bf7
Implement rename, prepareRename and completionResolve in LSP
nojaf Feb 9, 2026
22fa7e4
Implement textDocument/signatureHelp in LSP
nojaf Feb 9, 2026
8e8273d
Don't read any rescript source code in CommandsRewatch.ml
nojaf Feb 9, 2026
6eaf96d
Implement textDocument/codeLens in LSP
nojaf Feb 9, 2026
8995414
Implement textDocument/inlayHint in LSP
nojaf Feb 9, 2026
1d22d99
Implement textDocument/semanticTokens/full in LSP
nojaf Feb 9, 2026
a94e4f7
Implement textDocument/codeAction in rewatch LSP
nojaf Feb 9, 2026
afeffb6
Update LSP.md
nojaf Feb 9, 2026
4c25105
Refactor last_diagnostics_files
nojaf Feb 9, 2026
dcf5886
Refactor LSP handlers with AnalysisContext to reduce lock contention
nojaf Feb 9, 2026
3bb6ae3
Revert ci.yml
nojaf Feb 9, 2026
9863eef
Fix Windows path mismatch in independent project discovery
nojaf Feb 9, 2026
88e4b86
Fix bsc crash when using -bs-read-stdin for error reporting
nojaf Feb 10, 2026
790855f
Update LSP.md document
nojaf Feb 10, 2026
f96c27d
Add debounced build queue for LSP didSave
nojaf Feb 10, 2026
276aa5f
Wire up workspace/didChangeWatchedFiles for external file changes
nojaf Feb 10, 2026
b0f7dc0
Remove `compiler-args` CLI subcommand
nojaf Feb 10, 2026
505e361
Unify LSP file event handling into a single debounced queue
nojaf Feb 10, 2026
1d7e8e1
Stabilize LSP rename test ordering
nojaf Feb 10, 2026
d726a6a
Stabilize LSP test ordering after unified queue
nojaf Feb 10, 2026
7780bb8
Cached runtime modules from lib/ocaml/ for analysis shell out.
nojaf Feb 10, 2026
1327876
Increase waitForSpan for slow windows builds
nojaf Feb 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
21 changes: 6 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -324,18 +324,6 @@ jobs:
if: runner.os != 'Windows'
run: make -C tests/gentype_tests/typescript-react-example clean test

# On Windows, after running setup-ocaml (if it wasn't cached yet or the cache couldn't be restored),
# Cygwin bash is used instead of Git Bash for Windows, breaking the rewatch tests.
# So we need to adjust the path to bring back Git Bash for Windows.
- name: Rewatch tests need Git Bash for Windows
if: ${{ runner.os == 'Windows' }}
run: echo "C:\Program Files\Git\bin" >> $GITHUB_PATH
shell: bash

- name: Run rewatch tests
run: ./rewatch/tests/suite.sh rewatch/target/release/rescript
shell: bash

- name: Run syntax benchmarks
if: matrix.benchmarks
run: |
Expand Down Expand Up @@ -645,15 +633,18 @@ jobs:
# Run integration tests with the oldest supported node version.
node-version: 20

- name: Install ReScript package in rewatch/testrepo
- name: Install npm packages
run: yarn install

- name: Install ReScript package in test fixture
run: |
COMMIT_SHA="${{ github.event.pull_request.head.sha || github.sha }}"
yarn add "rescript@https://pkg.pr.new/rescript-lang/rescript@${COMMIT_SHA::7}"
shell: bash
working-directory: rewatch/testrepo
working-directory: tests/rewatch_tests/fixture

- name: Run rewatch integration tests
run: ./rewatch/tests/suite.sh rewatch/testrepo/node_modules/.bin/rescript
run: node scripts/test.js -rewatch
shell: bash

publish:
Expand Down
38 changes: 21 additions & 17 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -387,21 +387,7 @@ make test-rewatch # Run integration tests

**Note**: The rewatch project is located in the `rewatch/` directory with its own `Cargo.toml` file. All cargo commands should be run from the project root using the `--manifest-path rewatch/Cargo.toml` flag, as shown in the CI workflow.

**Integration Tests**: The `make test-rewatch` command runs bash-based integration tests located in `rewatch/tests/suite.sh`. These tests use the `rewatch/testrepo/` directory as a test workspace with various package configurations to verify rewatch's behavior across different scenarios.

**Running Individual Integration Tests**: You can run individual test scripts directly by setting up the environment manually:

```bash
cd rewatch/tests
export REWATCH_EXECUTABLE="$(realpath ../target/debug/rescript)"
eval $(node ./get_bin_paths.js)
export RESCRIPT_BSC_EXE
export RESCRIPT_RUNTIME
source ./utils.sh
bash ./watch/06-watch-missing-source-folder.sh
```

This is useful for iterating on a specific test without running the full suite.
**Integration Tests**: The `make test-rewatch` command runs Vitest-based integration tests located in `tests/rewatch_tests/`. These tests use a sandbox copy of `tests/rewatch_tests/fixture/` to verify rewatch's behavior across different scenarios (build, watch, clean, format, etc.).

#### Debugging

Expand All @@ -410,6 +396,26 @@ This is useful for iterating on a specific test without running the full suite.
- **Dependencies**: Inspect module dependency graph in `deps.rs`
- **File Watching**: Monitor file change events in `watcher.rs`

#### OpenTelemetry Tracing

Rewatch supports OpenTelemetry (OTEL) tracing for build and watch commands. To visualize traces locally, run a Jaeger all-in-one container:

```bash
docker run -d --name jaeger \
-p 4317:4317 -p 4318:4318 -p 16686:16686 \
jaegertracing/all-in-one
```

Then run rewatch with the OTLP endpoint set:

```bash
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 cargo run --manifest-path rewatch/Cargo.toml -- build
```

Open http://localhost:16686 to view traces in the Jaeger UI.

Note: Use `tracing::debug!` (not `log::debug!`) for events you want to appear in OTEL traces — they use separate logging systems.

#### Running Rewatch Directly

When running the rewatch binary directly (via `cargo run` or the compiled binary) during development, you need to set environment variables to point to the local compiler and runtime. Otherwise, rewatch will try to use the installed versions:
Expand Down Expand Up @@ -493,5 +499,3 @@ When clippy suggests refactoring that could impact performance, consider the tra
## CI Gotchas

- **`sleep` is fragile** — Prefer polling (e.g., `wait_for_file`) over fixed sleeps. CI runners are slower than local machines.
- **`exit_watcher` is async** — It only signals the watcher to stop (removes the lock file), it doesn't wait for the process to exit. Avoid triggering config-change events before exiting, as the watcher may start a concurrent rebuild.
- **`sed -i` differs across platforms** — macOS requires `sed -i '' ...`, Linux does not. Use the `replace` / `normalize_paths` helpers from `rewatch/tests/utils.sh` instead of raw `sed`.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
#### :nail_care: Polish

- Build system: Watch only source folders from build state instead of the entire project directory, and report missing configured source folders. https://github.com/rescript-lang/rescript/pull/8219
- Build system: Add OpenTelemetry tracing support for cli commands. https://github.com/rescript-lang/rescript/pull/8241

#### :house: Internal

- speed up dev container test by installing ocaml in docker image instead of in `postCreate.sh`. https://github.com/rescript-lang/rescript/pull/8230
- Migrate rewatch integration tests from bash scripts to Vitest and remove old test infrastructure. https://github.com/rescript-lang/rescript/pull/8241

# 13.0.0-alpha.1

Expand Down
Loading
Loading