Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,18 @@ jobs:
node-version: 16

- run: npm ci
- run: opam install dune cppo
- run: npm run compile

# These 2 runs (or just the second?) are for when you have opam dependencies. We don't.
# Don't add deps. But if you ever do, un-comment these and add an .opam file.
# - run: opam pin add rescript-editor-analysis.dev . --no-action
# - run: opam install . --deps-only --with-doc --with-test

- name: Install opam deps
run: opam install . --deps-only

- name: Build and test
run: opam exec -- make test
working-directory: analysis

# Also avoids artifacts upload permission loss:
# https://github.com/actions/upload-artifact/tree/ee69f02b3dfdecd58bb31b4d133da38ba6fe3700#permission-loss
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ node_modules
examples/*/lib
analysis/tests/lib
analysis/tests/.bsb.lock
analysis/_build
analysis/tests/.merlin
analysis/rescript-editor-analysis.exe
analysis/_opam
_build
_opam
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
},
"ocaml.sandbox": {
"kind": "opam",
"switch": "${workspaceFolder:rescript-vscode}/analysis"
"switch": "${workspaceFolder:rescript-vscode}"
}
}
5 changes: 3 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Thanks for your interest. Below is an informal spec of how the plugin's server c
│ └── src
│ └── extension.ts // Language Client entry point
├── analysis // Native binary powering hover, autocomplete, etc.
│ ├── src
│ ├── bin // Analysis binary
│ ├── src // Analysis Library
│ └── rescript-editor-analysis.exe // Dev-time analysis binary
├── package.json // The extension manifest
└── server // Language Server. Usable standalone
Expand All @@ -32,7 +33,7 @@ This is needed for the `analysis` folder, which is native code.

```sh
# If you haven't created the switch, do it. OPAM(https://opam.ocaml.org)
opam switch 4.14.0 # can also create local switch with opam switch create . 4.14.0
opam switch create . --deps-only

# Install dev dependencies from OPAM
opam install . --deps-only
Expand Down
7 changes: 4 additions & 3 deletions analysis/rescript-vscode.opam → analysis.opam
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
synopsis: "ReScript vscode support"
synopsis: "ReScript Analysis"
maintainer: ["Cristiano Calcagno"]
authors: ["Cristiano Calcagno"]
homepage: "https://github.com/rescript-lang/rescript-vscode"
bug-reports: "https://github.com/rescript-lang/rescript-vscode/issues"
depends: [
"dune" {>= "3.0"}
"ocaml" {>= "4.10"}
"ocamlformat" {= "0.22.4"}
"cppo" {= "1.6.9"}
"reanalyze" {= "2.23.0"}
"dune"
"odoc" {with-doc}
]
build: [
["dune" "subst"] {pinned}
["dune" "subst"] {dev}
[
"dune"
"build"
Expand Down
2 changes: 1 addition & 1 deletion analysis/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SHELL = /bin/bash
build-analysis-binary:
rm -f rescript-editor-analysis.exe
dune build
cp _build/install/default/bin/rescript-editor-analysis rescript-editor-analysis.exe
cp ../_build/default/analysis/bin/main.exe rescript-editor-analysis.exe

build-tests:
make -C tests build
Expand Down
6 changes: 6 additions & 0 deletions analysis/bin/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(executable
(name main)
(public_name analysis)
(package analysis)
(modes byte exe)
(libraries analysis))
12 changes: 5 additions & 7 deletions analysis/src/Cli.ml → analysis/bin/main.ml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
open Analysis
let help =
{|
**Private CLI For rescript-vscode usage only**
Expand Down Expand Up @@ -102,7 +103,7 @@ let main () =
Commands.typeDefinition ~path
~pos:(int_of_string line, int_of_string col)
~debug:false
| [_; "documentSymbol"; path] -> DocumentSymbol.command ~path
| [_; "documentSymbol"; path] -> Commands.documentSymbol ~path
| [_; "hover"; path; line; col; currentFile; supportsMarkdownLinks] ->
Commands.hover ~path
~pos:(int_of_string line, int_of_string col)
Expand Down Expand Up @@ -140,13 +141,10 @@ let main () =
Commands.rename ~path
~pos:(int_of_string line, int_of_string col)
~newName ~debug:false
| [_; "semanticTokens"; currentFile] ->
SemanticTokens.semanticTokens ~currentFile
| [_; "semanticTokens"; currentFile] -> Commands.semanticTokens ~currentFile
| [_; "createInterface"; path; cmiFile] ->
Printf.printf "\"%s\""
(Json.escape (CreateInterface.command ~path ~cmiFile))
| [_; "format"; path] ->
Printf.printf "\"%s\"" (Json.escape (Commands.format ~path))
Commands.createInterface ~path ~cmiFile
| [_; "format"; path] -> Commands.format ~path
| [_; "test"; path] ->
Cfg.supportsSnippets := true;
Commands.test ~path
Expand Down
2 changes: 1 addition & 1 deletion analysis/dune
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(dirs src reanalyze vendor)
(dirs src bin reanalyze vendor)

(env
(dev
Expand Down
4 changes: 2 additions & 2 deletions analysis/reanalyze/examples/deadcode/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ else
exclude_dirs="src/exception"
suppress="src/ToSuppress.res"
fi
dune exec rescript-editor-analysis -- reanalyze -config -debug -ci -exclude-paths $exclude_dirs -live-names globallyLive1 -live-names globallyLive2,globallyLive3 -suppress $suppress > $output
dune exec analysis -- reanalyze -config -debug -ci -exclude-paths $exclude_dirs -live-names globallyLive1 -live-names globallyLive2,globallyLive3 -suppress $suppress > $output
# CI. We use LF, and the CI OCaml fork prints CRLF. Convert.
if [ "$RUNNER_OS" == "Windows" ]; then
perl -pi -e 's/\r\n/\n/g' -- $output
Expand All @@ -18,7 +18,7 @@ if [ "$RUNNER_OS" == "Windows" ]; then
else
unsuppress_dirs="src/exception"
fi
dune exec rescript-editor-analysis -- reanalyze -exception -ci -suppress src -unsuppress $unsuppress_dirs > $output
dune exec analysis -- reanalyze -exception -ci -suppress src -unsuppress $unsuppress_dirs > $output
# CI. We use LF, and the CI OCaml fork prints CRLF. Convert.
if [ "$RUNNER_OS" == "Windows" ]; then
perl -pi -e 's/\r\n/\n/g' -- $output
Expand Down
2 changes: 1 addition & 1 deletion analysis/reanalyze/examples/termination/test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
output="expected/termination.txt"
dune exec rescript-editor-analysis -- reanalyze -config -ci -debug > $output
dune exec analysis -- reanalyze -config -ci -debug > $output
# CI. We use LF, and the CI OCaml fork prints CRLF. Convert.
if [ "$RUNNER_OS" == "Windows" ]; then
perl -pi -e 's/\r\n/\n/g' -- $output
Expand Down
Loading