You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Add `@react.componentWithProps`that explicitly handles the props with shared props:https://github.com/rescript-lang/rescript/pull/7203
24
+
- Add `@react.componentWithProps`for React component functions taking a props record instead of labeled arguments.https://github.com/rescript-lang/rescript/pull/7203
- Fix bug where a ref assignment is moved ouside a conditional. https://github.com/rescript-lang/rescript/pull/7176
20
30
- Fix nullable to opt conversion. https://github.com/rescript-lang/rescript/pull/7193
21
31
22
32
#### :house: Internal
33
+
23
34
- Use latest compiler for tests. https://github.com/rescript-lang/rescript/pull/7186
24
35
- Added infra to modernise AST: theres' Parsetree, Parsetree0 (legacy), and conversion functions to keep compatibility with PPX. https://github.com/rescript-lang/rescript/pull/7185
25
-
-Ast cleanup: remove exp object and exp unreachable. https://github.com/rescript-lang/rescript/pull/7189
26
-
-Ast cleanup: explicit representation for optional record fields in types. https://github.com/rescript-lang/rescript/pull/7190https://github.com/rescript-lang/rescript/pull/7191
36
+
-AST cleanup: remove exp object and exp unreachable. https://github.com/rescript-lang/rescript/pull/7189
37
+
-AST cleanup: explicit representation for optional record fields in types. https://github.com/rescript-lang/rescript/pull/7190https://github.com/rescript-lang/rescript/pull/7191
27
38
- AST cleanup: first-class expression and patterns for records with optional fields. https://github.com/rescript-lang/rescript/pull/7192
28
39
- AST cleanup: Represent the arity of uncurried function definitions directly in the AST. https://github.com/rescript-lang/rescript/pull/7197
29
40
- AST cleanup: Remove Pexp_function from the AST. https://github.com/rescript-lang/rescript/pull/7198
30
41
- Remove unused code from Location and Rescript_cpp modules. https://github.com/rescript-lang/rescript/pull/7150
31
42
- Build with OCaml 5.2.1. https://github.com/rescript-lang/rescript-compiler/pull/7201
32
43
- AST cleanup: Remove `Function$` entirely for function definitions. https://github.com/rescript-lang/rescript/pull/7200
33
-
- AST cleanup: store arity in function type https://github.com/rescript-lang/rescript/pull/7195
44
+
- AST cleanup: store arity in function type.https://github.com/rescript-lang/rescript/pull/7195
34
45
- AST cleanup: remove explicit uses of `function$` in preparation for removing the type entirely. https://github.com/rescript-lang/rescript/pull/7206
Copy file name to clipboardExpand all lines: analysis/README.md
+80-6Lines changed: 80 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,15 +12,89 @@ See main CONTRIBUTING.md's repo structure. Additionally, `examples/` is a conven
12
12
13
13
## Usage
14
14
15
-
At root:
16
-
```sh
17
-
./rescript-editor-analysis.exe --help
18
-
19
-
# or
20
-
15
+
```shell
21
16
dune exec -- rescript-editor-analysis --help
22
17
```
23
18
24
19
## History
25
20
26
21
This project is based on a fork of [Reason Language Server](https://github.com/jaredly/reason-language-server).
22
+
23
+
## Tests
24
+
25
+
### Prerequisites
26
+
27
+
- Ensure the compiler is built (`make build` in the repository root).
28
+
- Ensure the library is built (`make lib` in the repository root).
29
+
30
+
### Running the Tests
31
+
32
+
Run `make test` in `tests/analysis_tests/tests`.
33
+
34
+
### Key Concept
35
+
36
+
The tests in the `tests/analysis_tests/tests` folder are based on the `dune exec -- rescript-editor-analysis test` command. This special subcommand processes a file and executes specific editor analysis functionality based on special syntax found in code comments.
37
+
38
+
Consider the following code:
39
+
40
+
```res
41
+
let a = 5
42
+
// a.
43
+
// ^com
44
+
```
45
+
46
+
After building the ReScript project (**⚠️ this is a requirement**), you can execute `dune exec -- rescript-editor-analysis test Sample.res`, and completion will be performed for the cursor position indicated by `^`. The `com` directive requests completion. To see other commands, check out the pattern match in the `test` function in [Commands.ml](./src/Commands.ml).
47
+
48
+
> [!WARNING]
49
+
> Ensure there are no spaces in the code comments, as the commands are captured by a regular expression that expects spaces and not tabs!
50
+
51
+
Here’s how it works: once a command is found in a comment, a copy of the source file is created inside a temporary directory, where the line above `^com` is uncommented. The corresponding analysis functionality is then processed, typically with `~debug:true`. With debug enabled, code paths like
will print to stdout. This is helpful for observing what happens during the analysis.
59
+
60
+
When you run `make test` (from the `tests/analysis_tests` folder), `dune exec -- rescript-editor-analysis test <file>` will be executed for each `*.res` file in `analysis/tests/src`. The stdout will be compared to the corresponding `analysis/tests/src/expected` file. If `git diff` indicates changes, `make test` will fail, as these differences might be unintentional.
61
+
62
+
## Testing on Your Own Projects
63
+
64
+
To use a local version of `rescript-editor-analysis`, the targeted project needs to be compiled with the local compiler.
65
+
66
+
Install your local ReScript with `npm i /path/to/your-local-rescript-repo`.
67
+
Reinstall the dependencies and run `npx rescript` in your project. This ensures the project is compiled with the same compiler version that the `rescript-editor-analysis` will process.
68
+
69
+
## Debugging
70
+
71
+
It is possible to debug `analysis` via [ocamlearlybird](https://github.com/hackwaly/ocamlearlybird).
72
+
73
+
1. Install `opam install earlybird`.
74
+
2. Install the [earlybird extension](https://marketplace.visualstudio.com/items?itemName=hackwaly.ocamlearlybird).
75
+
3. Create a launch configuration (`.vscode/launch.json`):
0 commit comments