diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b94382ad3..fc40cb663 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,13 +16,13 @@ jobs: # https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-including-additional-values-into-combinations include: - os: macos-latest - build: eval $(opam env) && cd analysis && make test + build: eval $(opam env) && cd analysis && make test -j artifact-folder: darwin - os: ubuntu-18.04 - build: eval $(opam env) && cd analysis && make test + build: eval $(opam env) && cd analysis && make test -j artifact-folder: linux - os: windows-latest - build: "cd analysis && & $env:CYGWIN_ROOT\\bin\\ocaml-env exec -- make test" + build: "cd analysis && & $env:CYGWIN_ROOT\\bin\\ocaml-env exec -- make test -j" artifact-folder: win32 runs-on: ${{matrix.os}} diff --git a/.gitignore b/.gitignore index b7ebf7ff4..37497da55 100644 --- a/.gitignore +++ b/.gitignore @@ -2,9 +2,9 @@ out node_modules examples/*/lib -analysis/tests/lib -analysis/tests/.bsb.lock +analysis/tests/**/*/lib +analysis/tests/*/.bsb.lock analysis/_build -analysis/tests/.merlin +analysis/tests/**/*/.merlin analysis/rescript-editor-analysis.exe diff --git a/CHANGELOG.md b/CHANGELOG.md index ca6d7fe1b..caecf3d3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,9 +14,11 @@ #### :rocket: New Feature +- Add workspace Symbols - Inlay Hints (experimetal). `rescript.settings.inlayHints.enable: true`. Turned off by default. - Code Lenses for functions (experimetal). `rescript.settings.codeLens: true`. Turned off by default. - Markdown code blocks tagged as `rescript` now get basic syntax highlighting. + #### :bug: Bug Fix - Fix Incorrect rendering on the right of `external` diff --git a/README.md b/README.md index 04ea02b79..1edf89dc2 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,7 @@ The only 2 themes we don't (and can't) support, due to their lack of coloring, a - Find references. - Rename. - Inlay Hints +- Workspace Symbols - Snippets to ease a few syntaxes: - `external` features such as `@bs.module` and `@bs.val` - `try`, `for`, etc. diff --git a/analysis/Makefile b/analysis/Makefile index 069dbbbe4..ef0931096 100644 --- a/analysis/Makefile +++ b/analysis/Makefile @@ -19,10 +19,16 @@ dce: build-analysis-binary format: dune build @fmt --auto-promote -test-analysis-binary: build-analysis-binary +build-tests: + make -C tests build + +install-reanalyze: install-reanalyze + make -C reanalyze install + +test-analysis-binary: build-analysis-binary build-tests make -C tests test -test-reanalyze: build-analysis-binary +test-reanalyze: build-analysis-binary build-reanalyze make -C reanalyze test test: test-analysis-binary test-reanalyze diff --git a/analysis/reanalyze/Makefile b/analysis/reanalyze/Makefile index 15a49fa37..487f1a8e3 100644 --- a/analysis/reanalyze/Makefile +++ b/analysis/reanalyze/Makefile @@ -1,17 +1,37 @@ SHELL = /bin/bash -build: +install-deadcode: + make -C examples/deadcode install + +install-termination: + make -C examples/termination install + +install: install-deadcode install-termination + +build-deadcode: install-deadcode make -C examples/deadcode build + +build-termination: install-termination make -C examples/termination build -test: +build: build-deadcode build-termination + +test-deadcode: build-deadcode make -C examples/deadcode test + +test-termination: build-termination make -C examples/termination test -clean: +test: test-deadcode test-termination + +clean-deadcode: make -C examples/deadcode clean + +clean-termination: make -C examples/termination clean +clean: clean-deadcode clean-termination + .DEFAULT_GOAL := build .PHONY: build clean clean test diff --git a/analysis/reanalyze/examples/deadcode/Makefile b/analysis/reanalyze/examples/deadcode/Makefile index fc76aaa37..ac1e69aa3 100644 --- a/analysis/reanalyze/examples/deadcode/Makefile +++ b/analysis/reanalyze/examples/deadcode/Makefile @@ -3,15 +3,17 @@ SHELL = /bin/bash node_modules/.bin/rescript: npm install -build: node_modules/.bin/rescript +install: node_modules/.bin/rescript + +build: install node_modules/.bin/rescript -test: build node_modules/.bin/rescript +test: build ./test.sh clean: - rm -r node_modules lib + rm -rf node_modules lib .DEFAULT_GOAL := build -.PHONY: build clean test +.PHONY: build clean test install diff --git a/analysis/reanalyze/examples/termination/Makefile b/analysis/reanalyze/examples/termination/Makefile index fc76aaa37..ac1e69aa3 100644 --- a/analysis/reanalyze/examples/termination/Makefile +++ b/analysis/reanalyze/examples/termination/Makefile @@ -3,15 +3,17 @@ SHELL = /bin/bash node_modules/.bin/rescript: npm install -build: node_modules/.bin/rescript +install: node_modules/.bin/rescript + +build: install node_modules/.bin/rescript -test: build node_modules/.bin/rescript +test: build ./test.sh clean: - rm -r node_modules lib + rm -rf node_modules lib .DEFAULT_GOAL := build -.PHONY: build clean test +.PHONY: build clean test install diff --git a/analysis/src/Cli.ml b/analysis/src/Cli.ml index 90b82b1c8..dabaa699c 100644 --- a/analysis/src/Cli.ml +++ b/analysis/src/Cli.ml @@ -7,6 +7,7 @@ API examples: ./rescript-editor-analysis.exe definition src/MyFile.res 9 3 ./rescript-editor-analysis.exe typeDefinition src/MyFile.res 9 3 ./rescript-editor-analysis.exe documentSymbol src/Foo.res + ./rescript-editor-analysis.exe workspaceSymbols src/ ./rescript-editor-analysis.exe hover src/MyFile.res 10 2 ./rescript-editor-analysis.exe references src/MyFile.res 10 2 ./rescript-editor-analysis.exe rename src/MyFile.res 10 2 foo @@ -39,6 +40,10 @@ Options: ./rescript-editor-analysis.exe documentSymbol src/MyFile.res + workspaceSymbols: get all symbols in directory src/ + + ./rescript-editor-analysis.exe workspaceSymbols src/ + hover: get inferred type for MyFile.res at line 10 column 2: ./rescript-editor-analysis.exe hover src/MyFile.res 10 2 @@ -94,7 +99,8 @@ 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 + | [_; "workspaceSymbols"; dir] -> Commands.workspaceSymbols ~dir | [_; "hover"; path; line; col; currentFile] -> Commands.hover ~path ~pos:(int_of_string line, int_of_string col) diff --git a/analysis/src/Commands.ml b/analysis/src/Commands.ml index ad9ad4a89..e1b2d5242 100644 --- a/analysis/src/Commands.ml +++ b/analysis/src/Commands.ml @@ -268,10 +268,27 @@ let format ~path = let diagnosticSyntax ~path = print_endline (Diagnostics.document_syntax ~path |> Protocol.array) +let documentSymbol ~path = + Symbols.document ~path + |> List.map Protocol.stringifyDocumentSymbolItem + |> Protocol.array |> print_endline + +let workspaceSymbols ~dir = + print_endline + (match Symbols.workspace ~dir with + | Some symbol -> symbol + | None -> Protocol.null) + let test ~path = Uri.stripPath := true; match Files.readFile path with - | None -> assert false + | None -> ( + (* Test for workspaces/directory *) + let nameTest = Filename.basename(path) in + match nameTest with + | "workspaceSymbols" -> workspaceSymbols ~dir:path + | _ -> assert false + ) | Some text -> let lines = text |> String.split_on_char '\n' in let processLine i line = @@ -327,7 +344,7 @@ let test ~path = DceCommand.command () | "doc" -> print_endline ("DocumentSymbol " ^ path); - DocumentSymbol.command ~path + documentSymbol ~path | "hig" -> print_endline ("Highlight " ^ path); SemanticTokens.command ~debug:true diff --git a/analysis/src/Hint.ml b/analysis/src/Hint.ml index 0f90ff8ea..b6e7ffbf9 100644 --- a/analysis/src/Hint.ml +++ b/analysis/src/Hint.ml @@ -1,9 +1,8 @@ open SharedTypes -type inlayHintKind = Type | Parameter +type inlayHintKind = Type let inlayKindToNumber = function | Type -> 1 - | Parameter -> 2 let locItemToTypeHint ~full:{file; package} locItem = match locItem.locType with diff --git a/analysis/src/DocumentSymbol.ml b/analysis/src/Symbols.ml similarity index 80% rename from analysis/src/DocumentSymbol.ml rename to analysis/src/Symbols.ml index 2ba1e217f..58021499d 100644 --- a/analysis/src/DocumentSymbol.ml +++ b/analysis/src/Symbols.ml @@ -24,7 +24,7 @@ let kindNumber = function | EnumMember -> 22 | TypeParameter -> 26 -let command ~path = +let document ~path = let symbols = ref [] in let rec exprKind (exp : Parsetree.expression) = match exp.pexp_desc with @@ -134,19 +134,42 @@ let command ~path = let parser = Res_driver.parsingEngine.parseInterface ~forPrinter:false in let {Res_driver.parsetree = signature} = parser ~filename:path in iterator.signature iterator signature |> ignore); - let result = - !symbols - |> List.rev_map (fun (name, loc, kind) -> - Protocol.stringifyDocumentSymbolItem - { - name; - location = - { - uri = Uri.toString (Uri.fromPath path); - range = Utils.cmtLocToRange loc; - }; - kind = kindNumber kind; - }) - |> String.concat ",\n" - in - print_endline ("[\n" ^ result ^ "\n]") + !symbols + |> List.rev_map (fun (name, loc, kind) -> + let symbol : Protocol.documentSymbolItem = + { + name; + location = + { + uri = Uri.toString (Uri.fromPath path); + range = Utils.cmtLocToRange loc; + }; + kind = kindNumber kind; + } + in + symbol) + +let workspace ~dir = + let open FindFiles in + let bsconfig = dir /+ "bsconfig.json" in + match Files.readFile bsconfig with + | None -> None + | Some text -> ( + match Json.parse text with + | None -> None + | Some inner -> + let sourceDirectories = + getSourceDirectories ~includeDev:false ~baseDir:dir inner + in + let result = + sourceDirectories + |> List.map (fun srcDir -> + Files.readDirectory (dir /+ srcDir) + |> List.map (fun path -> dir /+ srcDir /+ path) + |> List.filter isSourceFile |> filterDuplicates) + |> List.flatten + |> List.map (fun path -> + document ~path |> List.map Protocol.stringifyDocumentSymbolItem) + |> List.flatten |> Protocol.array + in + Some result) diff --git a/analysis/tests/Makefile b/analysis/tests/Makefile index 5084c67ab..8c1f356a9 100644 --- a/analysis/tests/Makefile +++ b/analysis/tests/Makefile @@ -1,16 +1,27 @@ SHELL = /bin/bash -node_modules/.bin/rescript: - npm install +buildDocument: + make -C document build -build: node_modules/.bin/rescript - node_modules/.bin/rescript +buildWorkspaceSymbols: + make -C workspaceSymbols build + +build: buildDocument buildWorkspaceSymbols test: build ./test.sh +install-document: + make -C document install + +install-workspaceSymbols: + make -C workspaceSymbols install + +install: install-document install-workspaceSymbols + clean: - rm -r node_modules lib + make -C document clean + make -C workspaceSymbols clean .DEFAULT_GOAL := test diff --git a/analysis/tests/document/Makefile b/analysis/tests/document/Makefile new file mode 100644 index 000000000..d355dec33 --- /dev/null +++ b/analysis/tests/document/Makefile @@ -0,0 +1,14 @@ +SHELL = /bin/bash + +build: node_modules/.bin/rescript + node_modules/.bin/rescript + +install: node_modules/.bin/rescript + +node_modules/.bin/rescript: + npm install + +clean: + rm -rf node_modules lib + +.PHONY: clean build \ No newline at end of file diff --git a/analysis/tests/bsconfig.json b/analysis/tests/document/bsconfig.json similarity index 100% rename from analysis/tests/bsconfig.json rename to analysis/tests/document/bsconfig.json diff --git a/analysis/tests/not_compiled/Diagnostics.res b/analysis/tests/document/not_compiled/Diagnostics.res similarity index 100% rename from analysis/tests/not_compiled/Diagnostics.res rename to analysis/tests/document/not_compiled/Diagnostics.res diff --git a/analysis/tests/not_compiled/expected/Diagnostics.res.txt b/analysis/tests/document/not_compiled/expected/Diagnostics.res.txt similarity index 100% rename from analysis/tests/not_compiled/expected/Diagnostics.res.txt rename to analysis/tests/document/not_compiled/expected/Diagnostics.res.txt diff --git a/analysis/tests/package-lock.json b/analysis/tests/document/package-lock.json similarity index 98% rename from analysis/tests/package-lock.json rename to analysis/tests/document/package-lock.json index eedea29bb..b3872ea57 100644 --- a/analysis/tests/package-lock.json +++ b/analysis/tests/document/package-lock.json @@ -1,5 +1,5 @@ { - "name": "tests", + "name": "document", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/analysis/tests/package.json b/analysis/tests/document/package.json similarity index 100% rename from analysis/tests/package.json rename to analysis/tests/document/package.json diff --git a/analysis/tests/src/Auto.res b/analysis/tests/document/src/Auto.res similarity index 100% rename from analysis/tests/src/Auto.res rename to analysis/tests/document/src/Auto.res diff --git a/analysis/tests/src/CompletePrioritize1.res b/analysis/tests/document/src/CompletePrioritize1.res similarity index 100% rename from analysis/tests/src/CompletePrioritize1.res rename to analysis/tests/document/src/CompletePrioritize1.res diff --git a/analysis/tests/src/CompletePrioritize2.res b/analysis/tests/document/src/CompletePrioritize2.res similarity index 100% rename from analysis/tests/src/CompletePrioritize2.res rename to analysis/tests/document/src/CompletePrioritize2.res diff --git a/analysis/tests/src/Completion.res b/analysis/tests/document/src/Completion.res similarity index 100% rename from analysis/tests/src/Completion.res rename to analysis/tests/document/src/Completion.res diff --git a/analysis/tests/src/Component.res b/analysis/tests/document/src/Component.res similarity index 100% rename from analysis/tests/src/Component.res rename to analysis/tests/document/src/Component.res diff --git a/analysis/tests/src/Component.resi b/analysis/tests/document/src/Component.resi similarity index 100% rename from analysis/tests/src/Component.resi rename to analysis/tests/document/src/Component.resi diff --git a/analysis/tests/src/CreateInterface.res b/analysis/tests/document/src/CreateInterface.res similarity index 100% rename from analysis/tests/src/CreateInterface.res rename to analysis/tests/document/src/CreateInterface.res diff --git a/analysis/tests/src/Cross.res b/analysis/tests/document/src/Cross.res similarity index 100% rename from analysis/tests/src/Cross.res rename to analysis/tests/document/src/Cross.res diff --git a/analysis/tests/src/Dce.res b/analysis/tests/document/src/Dce.res similarity index 100% rename from analysis/tests/src/Dce.res rename to analysis/tests/document/src/Dce.res diff --git a/analysis/tests/src/Debug.res b/analysis/tests/document/src/Debug.res similarity index 100% rename from analysis/tests/src/Debug.res rename to analysis/tests/document/src/Debug.res diff --git a/analysis/tests/src/Definition.res b/analysis/tests/document/src/Definition.res similarity index 100% rename from analysis/tests/src/Definition.res rename to analysis/tests/document/src/Definition.res diff --git a/analysis/tests/src/DefinitionWithInterface.res b/analysis/tests/document/src/DefinitionWithInterface.res similarity index 100% rename from analysis/tests/src/DefinitionWithInterface.res rename to analysis/tests/document/src/DefinitionWithInterface.res diff --git a/analysis/tests/src/DefinitionWithInterface.resi b/analysis/tests/document/src/DefinitionWithInterface.resi similarity index 100% rename from analysis/tests/src/DefinitionWithInterface.resi rename to analysis/tests/document/src/DefinitionWithInterface.resi diff --git a/analysis/tests/src/Div.res b/analysis/tests/document/src/Div.res similarity index 100% rename from analysis/tests/src/Div.res rename to analysis/tests/document/src/Div.res diff --git a/analysis/tests/src/DocumentSymbol.res b/analysis/tests/document/src/DocumentSymbol.res similarity index 100% rename from analysis/tests/src/DocumentSymbol.res rename to analysis/tests/document/src/DocumentSymbol.res diff --git a/analysis/tests/src/Fragment.res b/analysis/tests/document/src/Fragment.res similarity index 100% rename from analysis/tests/src/Fragment.res rename to analysis/tests/document/src/Fragment.res diff --git a/analysis/tests/src/Highlight.res b/analysis/tests/document/src/Highlight.res similarity index 100% rename from analysis/tests/src/Highlight.res rename to analysis/tests/document/src/Highlight.res diff --git a/analysis/tests/src/Hover.res b/analysis/tests/document/src/Hover.res similarity index 100% rename from analysis/tests/src/Hover.res rename to analysis/tests/document/src/Hover.res diff --git a/analysis/tests/src/InlayHint.res b/analysis/tests/document/src/InlayHint.res similarity index 100% rename from analysis/tests/src/InlayHint.res rename to analysis/tests/document/src/InlayHint.res diff --git a/analysis/tests/src/Jsx.res b/analysis/tests/document/src/Jsx.res similarity index 100% rename from analysis/tests/src/Jsx.res rename to analysis/tests/document/src/Jsx.res diff --git a/analysis/tests/src/Jsx.resi b/analysis/tests/document/src/Jsx.resi similarity index 100% rename from analysis/tests/src/Jsx.resi rename to analysis/tests/document/src/Jsx.resi diff --git a/analysis/tests/src/LongIdentTest.res b/analysis/tests/document/src/LongIdentTest.res similarity index 100% rename from analysis/tests/src/LongIdentTest.res rename to analysis/tests/document/src/LongIdentTest.res diff --git a/analysis/tests/src/Object.res b/analysis/tests/document/src/Object.res similarity index 100% rename from analysis/tests/src/Object.res rename to analysis/tests/document/src/Object.res diff --git a/analysis/tests/src/Patterns.res b/analysis/tests/document/src/Patterns.res similarity index 100% rename from analysis/tests/src/Patterns.res rename to analysis/tests/document/src/Patterns.res diff --git a/analysis/tests/src/RecModules.res b/analysis/tests/document/src/RecModules.res similarity index 100% rename from analysis/tests/src/RecModules.res rename to analysis/tests/document/src/RecModules.res diff --git a/analysis/tests/src/RecordCompletion.res b/analysis/tests/document/src/RecordCompletion.res similarity index 100% rename from analysis/tests/src/RecordCompletion.res rename to analysis/tests/document/src/RecordCompletion.res diff --git a/analysis/tests/src/RecoveryOnProp.res b/analysis/tests/document/src/RecoveryOnProp.res similarity index 100% rename from analysis/tests/src/RecoveryOnProp.res rename to analysis/tests/document/src/RecoveryOnProp.res diff --git a/analysis/tests/src/References.res b/analysis/tests/document/src/References.res similarity index 100% rename from analysis/tests/src/References.res rename to analysis/tests/document/src/References.res diff --git a/analysis/tests/src/ReferencesWithInterface.res b/analysis/tests/document/src/ReferencesWithInterface.res similarity index 100% rename from analysis/tests/src/ReferencesWithInterface.res rename to analysis/tests/document/src/ReferencesWithInterface.res diff --git a/analysis/tests/src/ReferencesWithInterface.resi b/analysis/tests/document/src/ReferencesWithInterface.resi similarity index 100% rename from analysis/tests/src/ReferencesWithInterface.resi rename to analysis/tests/document/src/ReferencesWithInterface.resi diff --git a/analysis/tests/src/Rename.res b/analysis/tests/document/src/Rename.res similarity index 100% rename from analysis/tests/src/Rename.res rename to analysis/tests/document/src/Rename.res diff --git a/analysis/tests/src/RenameWithInterface.res b/analysis/tests/document/src/RenameWithInterface.res similarity index 100% rename from analysis/tests/src/RenameWithInterface.res rename to analysis/tests/document/src/RenameWithInterface.res diff --git a/analysis/tests/src/RenameWithInterface.resi b/analysis/tests/document/src/RenameWithInterface.resi similarity index 100% rename from analysis/tests/src/RenameWithInterface.resi rename to analysis/tests/document/src/RenameWithInterface.resi diff --git a/analysis/tests/src/TableclothMap.ml b/analysis/tests/document/src/TableclothMap.ml similarity index 100% rename from analysis/tests/src/TableclothMap.ml rename to analysis/tests/document/src/TableclothMap.ml diff --git a/analysis/tests/src/TableclothMap.mli b/analysis/tests/document/src/TableclothMap.mli similarity index 100% rename from analysis/tests/src/TableclothMap.mli rename to analysis/tests/document/src/TableclothMap.mli diff --git a/analysis/tests/src/TypeDefinition.res b/analysis/tests/document/src/TypeDefinition.res similarity index 100% rename from analysis/tests/src/TypeDefinition.res rename to analysis/tests/document/src/TypeDefinition.res diff --git a/analysis/tests/src/Xform.res b/analysis/tests/document/src/Xform.res similarity index 100% rename from analysis/tests/src/Xform.res rename to analysis/tests/document/src/Xform.res diff --git a/analysis/tests/src/expected/Auto.res.txt b/analysis/tests/document/src/expected/Auto.res.txt similarity index 87% rename from analysis/tests/src/expected/Auto.res.txt rename to analysis/tests/document/src/expected/Auto.res.txt index df82b73c6..14bb83f65 100644 --- a/analysis/tests/src/expected/Auto.res.txt +++ b/analysis/tests/document/src/expected/Auto.res.txt @@ -1,3 +1,3 @@ -Hover src/Auto.res 2:13 +Hover document/src/Auto.res 2:13 {"contents": "```rescript\n(Belt.List.t<'a>, 'a => 'b) => Belt.List.t<'b>\n```\n\n\n Returns a new list with `f` applied to each element of `someList`.\n\n ```res example\n list{1, 2}->Belt.List.map(x => x + 1) // list{3, 4}\n ```\n"} diff --git a/analysis/tests/src/expected/CompletePrioritize1.res.txt b/analysis/tests/document/src/expected/CompletePrioritize1.res.txt similarity index 80% rename from analysis/tests/src/expected/CompletePrioritize1.res.txt rename to analysis/tests/document/src/expected/CompletePrioritize1.res.txt index 3f5485410..a20d6232f 100644 --- a/analysis/tests/src/expected/CompletePrioritize1.res.txt +++ b/analysis/tests/document/src/expected/CompletePrioritize1.res.txt @@ -1,4 +1,4 @@ -Complete src/CompletePrioritize1.res 5:6 +Complete document/src/CompletePrioritize1.res 5:6 posCursor:[5:6] posNoWhite:[5:5] Found expr:[5:3->0:-1] Completable: Cpath Value[a]-> [{ diff --git a/analysis/tests/src/expected/CompletePrioritize2.res.txt b/analysis/tests/document/src/expected/CompletePrioritize2.res.txt similarity index 80% rename from analysis/tests/src/expected/CompletePrioritize2.res.txt rename to analysis/tests/document/src/expected/CompletePrioritize2.res.txt index b3b9674e1..f1d27505a 100644 --- a/analysis/tests/src/expected/CompletePrioritize2.res.txt +++ b/analysis/tests/document/src/expected/CompletePrioritize2.res.txt @@ -1,4 +1,4 @@ -Complete src/CompletePrioritize2.res 9:7 +Complete document/src/CompletePrioritize2.res 9:7 posCursor:[9:7] posNoWhite:[9:6] Found expr:[9:3->0:-1] Completable: Cpath Value[ax]-> [{ @@ -9,7 +9,7 @@ Completable: Cpath Value[ax]-> "documentation": null }] -Complete src/CompletePrioritize2.res 12:5 +Complete document/src/CompletePrioritize2.res 12:5 posCursor:[12:5] posNoWhite:[12:4] Found expr:[12:3->12:5] Pexp_ident ax:[12:3->12:5] Completable: Cpath Value[ax] diff --git a/analysis/tests/src/expected/Completion.res.txt b/analysis/tests/document/src/expected/Completion.res.txt similarity index 94% rename from analysis/tests/src/expected/Completion.res.txt rename to analysis/tests/document/src/expected/Completion.res.txt index a32963ef6..86ab6cfb8 100644 --- a/analysis/tests/src/expected/Completion.res.txt +++ b/analysis/tests/document/src/expected/Completion.res.txt @@ -1,4 +1,4 @@ -Complete src/Completion.res 1:11 +Complete document/src/Completion.res 1:11 posCursor:[1:11] posNoWhite:[1:10] Found expr:[1:3->1:11] Pexp_ident MyList.m:[1:3->1:11] Completable: Cpath Value[MyList, m] @@ -70,7 +70,7 @@ Completable: Cpath Value[MyList, m] "documentation": {"kind": "markdown", "value": " Uncurried version of [mapReverse](#mapReverse). "} }] -Complete src/Completion.res 3:9 +Complete document/src/Completion.res 3:9 posCursor:[3:9] posNoWhite:[3:8] Found expr:[3:3->3:9] Pexp_ident Array.:[3:3->3:9] Completable: Cpath Value[Array, ""] @@ -292,7 +292,7 @@ Completable: Cpath Value[Array, ""] "documentation": null }] -Complete src/Completion.res 5:10 +Complete document/src/Completion.res 5:10 posCursor:[5:10] posNoWhite:[5:9] Found expr:[5:3->5:10] Pexp_ident Array.m:[5:3->5:10] Completable: Cpath Value[Array, m] @@ -346,7 +346,7 @@ Completable: Cpath Value[Array, m] "documentation": {"kind": "markdown", "value": " [mem a l] is true if and only if [a] is equal\n to an element of [l].\n @since 4.03.0 "} }] -Complete src/Completion.res 15:17 +Complete document/src/Completion.res 15:17 posCursor:[15:17] posNoWhite:[15:16] Found expr:[15:12->15:17] Pexp_ident Dep.c:[15:12->15:17] Completable: Cpath Value[Dep, c] @@ -358,7 +358,7 @@ Completable: Cpath Value[Dep, c] "documentation": {"kind": "markdown", "value": "Deprecated: Use customDouble instead\n\nSome doc comment"} }] -Complete src/Completion.res 23:20 +Complete document/src/Completion.res 23:20 posCursor:[23:20] posNoWhite:[23:19] Found expr:[23:11->23:20] Pexp_apply ...[23:11->23:18] () Completable: CnamedArg(Value[Lib, foo], "", []) @@ -377,7 +377,7 @@ Found type for function (~age: int, ~name: string) => string "documentation": null }] -Complete src/Completion.res 26:13 +Complete document/src/Completion.res 26:13 posCursor:[26:13] posNoWhite:[26:12] Found expr:[26:3->26:13] Completable: Cpath array->m [{ @@ -394,7 +394,7 @@ Completable: Cpath array->m "documentation": {"kind": "markdown", "value": "\nApplies the function (the second argument) to each item in the array, returning\na new array. The result array does not have to have elements of the same type\nas the input array. See\n[`Array.map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)\non MDN.\n\n```res example\nJs.Array2.map([12, 4, 8], x => x * x) == [144, 16, 64]\nJs.Array2.map([\"animal\", \"vegetable\", \"mineral\"], Js.String.length) == [6, 9, 7]\n```\n"} }] -Complete src/Completion.res 29:13 +Complete document/src/Completion.res 29:13 posCursor:[29:13] posNoWhite:[29:12] Found expr:[29:3->29:13] Completable: Cpath string->toU [{ @@ -405,7 +405,7 @@ Completable: Cpath string->toU "documentation": {"kind": "markdown", "value": "\n`toUpperCase(str)` converts `str` to upper case using the locale-insensitive\ncase mappings in the Unicode Character Database. Notice that the conversion can\nexpand the number of letters in the result; for example the German ß\ncapitalizes to two Ses in a row.\n\nSee [`String.toUpperCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase)\non MDN.\n\n```res example\nJs.String2.toUpperCase(\"abc\") == \"ABC\"\nJs.String2.toUpperCase(`Straße`) == `STRASSE`\nJs.String2.toUpperCase(`πς`) == `ΠΣ`\n```\n"} }] -Complete src/Completion.res 34:8 +Complete document/src/Completion.res 34:8 posCursor:[34:8] posNoWhite:[34:7] Found expr:[34:3->34:8] Completable: Cpath Value[op]->e [{ @@ -422,7 +422,7 @@ Completable: Cpath Value[op]->e "documentation": {"kind": "markdown", "value": "\n Evaluates two optional values for equality with respect to a predicate\n function. If both `optValue1` and `optValue2` are `None`, returns `true`.\n If one of the arguments is `Some(value)` and the other is `None`, returns\n `false`.\n\n If arguments are `Some(value1)` and `Some(value2)`, returns the result of\n `predicate(value1, value2)`; the predicate function must return a bool.\n\n ```res example\n let clockEqual = (a, b) => mod(a, 12) == mod(b, 12)\n\n open Belt.Option\n\n eq(Some(3), Some(15), clockEqual) /* true */\n\n eq(Some(3), None, clockEqual) /* false */\n\n eq(None, Some(3), clockEqual) /* false */\n\n eq(None, None, clockEqual) /* true */\n ```\n"} }] -Complete src/Completion.res 44:7 +Complete document/src/Completion.res 44:7 posCursor:[44:7] posNoWhite:[44:6] Found expr:[44:3->54:3] Pexp_apply ...[50:9->50:10] (...[44:3->50:8], ...[51:2->54:3]) posCursor:[44:7] posNoWhite:[44:6] Found expr:[44:3->50:8] @@ -441,7 +441,7 @@ Completable: Cpath Value[fa]-> "documentation": null }] -Complete src/Completion.res 47:21 +Complete document/src/Completion.res 47:21 posCursor:[47:21] posNoWhite:[47:20] Found expr:[47:3->47:21] posCursor:[47:21] posNoWhite:[47:20] Found expr:[47:12->47:21] Pexp_ident Js.Dict.u:[47:12->47:21] @@ -460,7 +460,7 @@ Completable: Cpath Value[Js, Dict, u] "documentation": {"kind": "markdown", "value": " Experimental internal function "} }] -Complete src/Completion.res 59:30 +Complete document/src/Completion.res 59:30 posCursor:[59:30] posNoWhite:[59:29] Found expr:[59:15->59:30] JSX 59:21] second[59:22->59:28]=...[59:29->59:30]> _children:None posCursor:[59:30] posNoWhite:[59:29] Found expr:[59:29->59:30] @@ -474,7 +474,7 @@ Completable: Cpath Value[z] "documentation": null }] -Complete src/Completion.res 62:23 +Complete document/src/Completion.res 62:23 posCursor:[62:23] posNoWhite:[62:22] Found expr:[62:15->62:23] JSX 62:21] z[62:22->62:23]=...[62:22->62:23]> _children:None Completable: Cjsx([O, Comp], z, [z]) @@ -486,7 +486,7 @@ Completable: Cjsx([O, Comp], z, [z]) "documentation": null }] -Complete src/Completion.res 65:8 +Complete document/src/Completion.res 65:8 Attribute id:reac:[65:3->65:8] label:reac Completable: Cdecorator(reac) [{ @@ -497,7 +497,7 @@ Completable: Cdecorator(reac) "documentation": {"kind": "markdown", "value": "The `@react.component` decorator is used to annotate functions that are RescriptReact components.\n\nYou will need this decorator whenever you want to use a ReScript / React component in ReScript JSX expressions.\n\nNote: The `@react.component` decorator requires the react-jsx config to be set in your `bsconfig.json` to enable the required React transformations.\n\n[Read more and see examples in the documentation](https://rescript-lang.org/syntax-lookup#react-component-decorator)."} }] -Complete src/Completion.res 68:10 +Complete document/src/Completion.res 68:10 posCursor:[68:10] posNoWhite:[68:9] Found expr:[0:-1->86:1] Pexp_apply ...[80:6->80:7] (...[80:8->86:1]) Attribute id:react.let:[68:3->80:3] label:react. @@ -510,7 +510,7 @@ Completable: Cdecorator(react.) "documentation": {"kind": "markdown", "value": "The `@react.component` decorator is used to annotate functions that are RescriptReact components.\n\nYou will need this decorator whenever you want to use a ReScript / React component in ReScript JSX expressions.\n\nNote: The `@react.component` decorator requires the react-jsx config to be set in your `bsconfig.json` to enable the required React transformations.\n\n[Read more and see examples in the documentation](https://rescript-lang.org/syntax-lookup#react-component-decorator)."} }] -Complete src/Completion.res 71:27 +Complete document/src/Completion.res 71:27 posCursor:[71:27] posNoWhite:[71:26] Found expr:[71:11->71:27] Pexp_apply ...[71:11->71:18] (~name71:20->71:24=...[71:20->71:24]) Completable: CnamedArg(Value[Lib, foo], "", [name]) @@ -523,7 +523,7 @@ Found type for function (~age: int, ~name: string) => string "documentation": null }] -Complete src/Completion.res 74:26 +Complete document/src/Completion.res 74:26 posCursor:[74:26] posNoWhite:[74:25] Found expr:[74:11->74:26] Pexp_apply ...[74:11->74:18] (~age74:20->74:23=...[74:20->74:23]) Completable: CnamedArg(Value[Lib, foo], "", [age]) @@ -536,7 +536,7 @@ Found type for function (~age: int, ~name: string) => string "documentation": null }] -Complete src/Completion.res 77:32 +Complete document/src/Completion.res 77:32 posCursor:[77:32] posNoWhite:[77:31] Found expr:[77:11->77:32] Pexp_apply ...[77:11->77:18] (~age77:20->77:23=...[77:25->77:28]) Completable: CnamedArg(Value[Lib, foo], "", [age]) @@ -549,14 +549,14 @@ Found type for function (~age: int, ~name: string) => string "documentation": null }] -Complete src/Completion.res 82:5 +Complete document/src/Completion.res 82:5 posCursor:[82:5] posNoWhite:[82:4] Found expr:[80:8->86:1] Pexp_apply ...[80:8->80:15] (~age84:3->84:6=...[84:7->84:8], ~name85:3->85:7=...[85:8->85:10]) Completable: CnamedArg(Value[Lib, foo], "", [age, name]) Found type for function (~age: int, ~name: string) => string [] -Complete src/Completion.res 90:13 +Complete document/src/Completion.res 90:13 posCursor:[90:13] posNoWhite:[90:12] Found expr:[90:3->93:18] Pexp_send a[90:12->90:13] e:[90:3->90:10] Completable: Cpath Value[someObj]["a"] @@ -568,7 +568,7 @@ Completable: Cpath Value[someObj]["a"] "documentation": null }] -Complete src/Completion.res 95:24 +Complete document/src/Completion.res 95:24 posCursor:[95:24] posNoWhite:[95:23] Found expr:[95:3->99:6] Pexp_send [95:24->95:24] e:[95:3->95:22] Completable: Cpath Value[nestedObj]["x"]["y"][""] @@ -586,7 +586,7 @@ Completable: Cpath Value[nestedObj]["x"]["y"][""] "documentation": null }] -Complete src/Completion.res 99:7 +Complete document/src/Completion.res 99:7 posCursor:[99:7] posNoWhite:[99:6] Found expr:[99:3->102:20] Pexp_send a[99:6->99:7] e:[99:3->99:4] Completable: Cpath Value[o]["a"] @@ -598,7 +598,7 @@ Completable: Cpath Value[o]["a"] "documentation": null }] -Complete src/Completion.res 104:17 +Complete document/src/Completion.res 104:17 posCursor:[104:17] posNoWhite:[104:16] Found expr:[104:3->125:18] Pexp_send [104:17->104:17] e:[104:3->104:15] Completable: Cpath Value[no]["x"]["y"][""] @@ -616,7 +616,7 @@ Completable: Cpath Value[no]["x"]["y"][""] "documentation": null }] -Complete src/Completion.res 110:5 +Complete document/src/Completion.res 110:5 posCursor:[110:5] posNoWhite:[110:4] Found expr:[110:3->110:5] Pexp_field [110:3->110:4] _:[116:0->110:5] Completable: Cpath Value[r]."" @@ -634,7 +634,7 @@ Completable: Cpath Value[r]."" "documentation": null }] -Complete src/Completion.res 113:24 +Complete document/src/Completion.res 113:24 posCursor:[113:24] posNoWhite:[113:23] Found expr:[113:3->113:24] Pexp_field [113:3->113:23] _:[116:0->113:24] Completable: Cpath Value[Object, Rec, recordVal]."" @@ -652,7 +652,7 @@ Completable: Cpath Value[Object, Rec, recordVal]."" "documentation": null }] -Complete src/Completion.res 120:7 +Complete document/src/Completion.res 120:7 posCursor:[120:7] posNoWhite:[120:6] Found expr:[119:11->123:1] posCursor:[120:7] posNoWhite:[120:6] Found expr:[120:5->122:5] posCursor:[120:7] posNoWhite:[120:6] Found expr:[120:5->120:7] @@ -666,7 +666,7 @@ Completable: Cpath Value[my] "documentation": null }] -Complete src/Completion.res 125:18 +Complete document/src/Completion.res 125:18 posCursor:[125:18] posNoWhite:[125:17] Found expr:[125:3->145:32] Pexp_send [125:18->125:18] e:[125:3->125:16] Completable: Cpath Value[Object, object][""] @@ -684,7 +684,7 @@ Completable: Cpath Value[Object, object][""] "documentation": null }] -Complete src/Completion.res 151:6 +Complete document/src/Completion.res 151:6 posCursor:[151:6] posNoWhite:[151:5] Found expr:[151:4->151:6] JSX 151:6] > _children:None Completable: Cpath Module[O, ""] @@ -696,7 +696,7 @@ Completable: Cpath Module[O, ""] "documentation": null }] -Complete src/Completion.res 157:8 +Complete document/src/Completion.res 157:8 posCursor:[157:8] posNoWhite:[157:7] Found expr:[157:3->157:8] Pexp_field [157:3->157:7] _:[165:0->157:8] Completable: Cpath Value[q].aa."" @@ -714,7 +714,7 @@ Completable: Cpath Value[q].aa."" "documentation": null }] -Complete src/Completion.res 159:9 +Complete document/src/Completion.res 159:9 posCursor:[159:9] posNoWhite:[159:8] Found expr:[159:3->159:9] Pexp_field [159:3->159:7] n:[159:8->159:9] Completable: Cpath Value[q].aa.n @@ -726,7 +726,7 @@ Completable: Cpath Value[q].aa.n "documentation": null }] -Complete src/Completion.res 162:6 +Complete document/src/Completion.res 162:6 posCursor:[162:6] posNoWhite:[162:5] Found expr:[162:3->162:6] Pexp_construct Lis:[162:3->162:6] None Completable: Cpath Value[Lis] @@ -744,7 +744,7 @@ Completable: Cpath Value[Lis] "documentation": null }] -Complete src/Completion.res 169:16 +Complete document/src/Completion.res 169:16 posCursor:[169:16] posNoWhite:[169:15] Found expr:[169:4->169:16] JSX 169:16] > _children:None Completable: Cpath Module[WithChildren] @@ -756,7 +756,7 @@ Completable: Cpath Module[WithChildren] "documentation": null }] -Complete src/Completion.res 172:16 +Complete document/src/Completion.res 172:16 posCursor:[172:16] posNoWhite:[172:15] Found type:[172:12->172:16] Ptyp_constr Js.n:[172:12->172:16] Completable: Cpath Type[Js, n] @@ -780,7 +780,7 @@ Completable: Cpath Type[Js, n] "documentation": {"kind": "markdown", "value": "\n Nullable value of this type can be either null or 'a. This type is equivalent to Js.Null.t.\n"} }] -Complete src/Completion.res 174:20 +Complete document/src/Completion.res 174:20 posCursor:[174:20] posNoWhite:[174:19] Found type:[174:12->174:20] Ptyp_constr ForAuto.:[174:12->174:20] Completable: Cpath Type[ForAuto, ""] @@ -792,7 +792,7 @@ Completable: Cpath Type[ForAuto, ""] "documentation": null }] -Complete src/Completion.res 179:13 +Complete document/src/Completion.res 179:13 posCursor:[179:13] posNoWhite:[179:12] Found expr:[179:11->179:13] Pexp_construct As:[179:11->179:13] None Completable: Cpath Value[As] @@ -804,7 +804,7 @@ Completable: Cpath Value[As] "documentation": null }] -Complete src/Completion.res 182:17 +Complete document/src/Completion.res 182:17 Pmod_ident For:[182:14->182:17] Completable: Cpath Module[For] [{ @@ -815,7 +815,7 @@ Completable: Cpath Module[For] "documentation": null }] -Complete src/Completion.res 190:11 +Complete document/src/Completion.res 190:11 posCursor:[190:11] posNoWhite:[190:10] Found expr:[190:3->190:11] Pexp_ident Private.:[190:3->190:11] Completable: Cpath Value[Private, ""] @@ -827,13 +827,13 @@ Completable: Cpath Value[Private, ""] "documentation": null }] -Complete src/Completion.res 202:6 +Complete document/src/Completion.res 202:6 posCursor:[202:6] posNoWhite:[202:5] Found expr:[202:3->202:6] Pexp_ident sha:[202:3->202:6] Completable: Cpath Value[sha] [] -Complete src/Completion.res 205:6 +Complete document/src/Completion.res 205:6 posCursor:[205:6] posNoWhite:[205:5] Found expr:[205:3->205:6] Pexp_ident sha:[205:3->205:6] Completable: Cpath Value[sha] @@ -845,7 +845,7 @@ Completable: Cpath Value[sha] "documentation": null }] -Complete src/Completion.res 208:6 +Complete document/src/Completion.res 208:6 posCursor:[208:6] posNoWhite:[208:5] Found expr:[208:3->208:6] Pexp_ident sha:[208:3->208:6] Completable: Cpath Value[sha] @@ -857,7 +857,7 @@ Completable: Cpath Value[sha] "documentation": null }] -Complete src/Completion.res 221:22 +Complete document/src/Completion.res 221:22 posCursor:[221:22] posNoWhite:[221:21] Found expr:[221:3->224:22] Pexp_send [221:22->221:22] e:[221:3->221:20] Completable: Cpath Value[FAO, forAutoObject][""] @@ -875,7 +875,7 @@ Completable: Cpath Value[FAO, forAutoObject][""] "documentation": null }] -Complete src/Completion.res 224:37 +Complete document/src/Completion.res 224:37 posCursor:[224:37] posNoWhite:[224:36] Found expr:[224:3->224:37] Pexp_field [224:3->224:36] _:[233:0->224:37] Completable: Cpath Value[FAO, forAutoObject]["forAutoLabel"]."" @@ -893,7 +893,7 @@ Completable: Cpath Value[FAO, forAutoObject]["forAutoLabel"]."" "documentation": null }] -Complete src/Completion.res 227:46 +Complete document/src/Completion.res 227:46 posCursor:[227:46] posNoWhite:[227:45] Found expr:[227:3->0:-1] Completable: Cpath Value[FAO, forAutoObject]["forAutoLabel"].forAuto-> [{ @@ -910,7 +910,7 @@ Completable: Cpath Value[FAO, forAutoObject]["forAutoLabel"].forAuto-> "documentation": null }] -Complete src/Completion.res 230:55 +Complete document/src/Completion.res 230:55 posCursor:[230:55] posNoWhite:[230:54] Found expr:[230:3->230:55] posCursor:[230:55] posNoWhite:[230:54] Found expr:[230:46->230:55] Pexp_ident ForAuto.a:[230:46->230:55] @@ -929,7 +929,7 @@ Completable: Cpath Value[ForAuto, a] "documentation": null }] -Complete src/Completion.res 234:34 +Complete document/src/Completion.res 234:34 posCursor:[234:34] posNoWhite:[234:33] Found expr:[234:18->234:36] Pexp_apply ...__ghost__[0:-1->0:-1] (...[234:18->234:34], ...[234:34->234:35]) posCursor:[234:34] posNoWhite:[234:33] Found expr:[234:18->234:34] @@ -945,12 +945,12 @@ Completable: Cpath Value[na] "documentation": null }] -Complete src/Completion.res 237:17 +Complete document/src/Completion.res 237:17 posCursor:[237:17] posNoWhite:[237:14] Found expr:[237:14->237:22] Completable: Cnone [] -Complete src/Completion.res 243:8 +Complete document/src/Completion.res 243:8 posCursor:[243:8] posNoWhite:[243:7] Found expr:[241:8->246:1] posCursor:[243:8] posNoWhite:[243:7] Found expr:[242:14->243:8] Pexp_apply ...[243:3->243:4] (...[242:14->242:15], ...[243:5->243:8]) @@ -971,7 +971,7 @@ Completable: Cpath Value[_z]."" "documentation": null }] -Complete src/Completion.res 254:17 +Complete document/src/Completion.res 254:17 posCursor:[254:17] posNoWhite:[254:16] Found expr:[254:11->254:17] Pexp_construct SomeLo:[254:11->254:17] None Completable: Cpath Value[SomeLo] @@ -983,7 +983,7 @@ Completable: Cpath Value[SomeLo] "documentation": null }] -Complete src/Completion.res 256:29 +Complete document/src/Completion.res 256:29 posCursor:[256:29] posNoWhite:[256:28] Found type:[256:13->256:29] Ptyp_constr SomeLocalModule.:[256:13->256:29] Completable: Cpath Type[SomeLocalModule, ""] @@ -995,7 +995,7 @@ Completable: Cpath Type[SomeLocalModule, ""] "documentation": null }] -Complete src/Completion.res 261:33 +Complete document/src/Completion.res 261:33 posCursor:[261:33] posNoWhite:[261:32] Found type:[261:17->263:11] Ptyp_constr SomeLocalModule.:[261:17->263:11] Completable: Cpath Type[SomeLocalModule, ""] @@ -1007,7 +1007,7 @@ Completable: Cpath Type[SomeLocalModule, ""] "documentation": null }] -Complete src/Completion.res 268:21 +Complete document/src/Completion.res 268:21 Ptype_variant unary SomeLocal:[268:12->268:21] Completable: Cpath Value[SomeLocal] [{ @@ -1024,7 +1024,7 @@ Completable: Cpath Value[SomeLocal] "documentation": null }] -Complete src/Completion.res 271:20 +Complete document/src/Completion.res 271:20 posCursor:[271:20] posNoWhite:[271:19] Found pattern:[271:7->274:3] posCursor:[271:20] posNoWhite:[271:19] Found type:[271:11->274:3] Ptyp_constr SomeLocal:[271:11->274:3] @@ -1037,7 +1037,7 @@ Completable: Cpath Type[SomeLocal] "documentation": null }] -Complete src/Completion.res 275:15 +Complete document/src/Completion.res 275:15 posCursor:[275:15] posNoWhite:[275:14] Found expr:[274:11->278:1] posCursor:[275:15] posNoWhite:[275:14] Found expr:[275:5->277:3] posCursor:[275:15] posNoWhite:[275:14] Found expr:[275:13->275:15] @@ -1051,7 +1051,7 @@ Completable: Cpath Value[_w] "documentation": null }] -Complete src/Completion.res 281:22 +Complete document/src/Completion.res 281:22 posCursor:[281:22] posNoWhite:[281:21] Found type:[281:21->281:22] Ptyp_constr s:[281:21->281:22] Completable: Cpath Type[s] @@ -1069,7 +1069,7 @@ Completable: Cpath Type[s] "documentation": null }] -Complete src/Completion.res 291:30 +Complete document/src/Completion.res 291:30 posCursor:[291:30] posNoWhite:[291:29] Found expr:[291:11->291:32] Pexp_apply ...[291:11->291:28] () Completable: CnamedArg(Value[funRecord].someFun, "", []) @@ -1082,7 +1082,7 @@ Found type for function (~name: string) => unit "documentation": null }] -Complete src/Completion.res 296:11 +Complete document/src/Completion.res 296:11 posCursor:[296:11] posNoWhite:[296:10] Found expr:[296:3->296:11] Pexp_field [296:3->296:10] _:[299:0->296:11] Completable: Cpath Value[retAA](Nolabel)."" @@ -1100,7 +1100,7 @@ Completable: Cpath Value[retAA](Nolabel)."" "documentation": null }] -Complete src/Completion.res 301:13 +Complete document/src/Completion.res 301:13 posCursor:[301:13] posNoWhite:[301:12] Found expr:[301:3->301:13] Pexp_apply ...[301:3->301:11] () Completable: CnamedArg(Value[ff](~c), "", []) @@ -1138,7 +1138,7 @@ Found type for function ( "documentation": null }] -Complete src/Completion.res 304:15 +Complete document/src/Completion.res 304:15 posCursor:[304:15] posNoWhite:[304:14] Found expr:[304:3->304:15] Pexp_apply ...[304:3->304:13] () Completable: CnamedArg(Value[ff](~c)(Nolabel), "", []) @@ -1163,7 +1163,7 @@ Found type for function (~a: int, ~b: int, ~opt2: int=?, unit) => int "documentation": null }] -Complete src/Completion.res 307:17 +Complete document/src/Completion.res 307:17 posCursor:[307:17] posNoWhite:[307:16] Found expr:[307:3->307:17] Pexp_apply ...[307:3->307:15] () Completable: CnamedArg(Value[ff](~c, Nolabel), "", []) @@ -1188,7 +1188,7 @@ Found type for function (~a: int, ~b: int, ~opt2: int=?, unit) => int "documentation": null }] -Complete src/Completion.res 310:21 +Complete document/src/Completion.res 310:21 posCursor:[310:21] posNoWhite:[310:20] Found expr:[310:3->310:21] Pexp_apply ...[310:3->310:19] () Completable: CnamedArg(Value[ff](~c, Nolabel, Nolabel), "", []) @@ -1207,7 +1207,7 @@ Found type for function (~a: int, ~b: int) => int "documentation": null }] -Complete src/Completion.res 313:23 +Complete document/src/Completion.res 313:23 posCursor:[313:23] posNoWhite:[313:22] Found expr:[313:3->313:23] Pexp_apply ...[313:3->313:21] () Completable: CnamedArg(Value[ff](~c, Nolabel, ~b), "", []) @@ -1226,7 +1226,7 @@ Found type for function (~a: int, ~opt2: int=?, unit) => int "documentation": null }] -Complete src/Completion.res 316:16 +Complete document/src/Completion.res 316:16 posCursor:[316:16] posNoWhite:[316:15] Found expr:[316:3->316:16] Pexp_apply ...[316:3->316:14] () Completable: CnamedArg(Value[ff](~opt2), "", []) @@ -1257,7 +1257,7 @@ Found type for function (~opt1: int=?, ~a: int, ~b: int, unit, unit, ~c: int) => "documentation": null }] -Complete src/Completion.res 323:17 +Complete document/src/Completion.res 323:17 posCursor:[323:17] posNoWhite:[323:16] Found expr:[323:3->323:17] Pexp_apply ...[323:3->323:15] () Completable: CnamedArg(Value[withCallback], "", []) @@ -1276,7 +1276,7 @@ Found type for function (~b: int) => callback "documentation": null }] -Complete src/Completion.res 326:21 +Complete document/src/Completion.res 326:21 posCursor:[326:21] posNoWhite:[326:20] Found expr:[326:3->326:21] Pexp_apply ...[326:3->326:19] () Completable: CnamedArg(Value[withCallback](~a), "", []) @@ -1289,7 +1289,7 @@ Found type for function (~b: int) => int "documentation": null }] -Complete src/Completion.res 329:21 +Complete document/src/Completion.res 329:21 posCursor:[329:21] posNoWhite:[329:20] Found expr:[329:3->329:21] Pexp_apply ...[329:3->329:19] () Completable: CnamedArg(Value[withCallback](~b), "", []) @@ -1302,7 +1302,7 @@ Found type for function (~a: int) => int "documentation": null }] -Complete src/Completion.res 336:26 +Complete document/src/Completion.res 336:26 posCursor:[336:26] posNoWhite:[336:25] Found expr:[333:3->346:23] JSX 333:6] onClick[334:4->334:11]=...[334:13->346:23]> _children:None posCursor:[336:26] posNoWhite:[336:25] Found expr:[334:13->346:23] @@ -1327,7 +1327,7 @@ Completable: Cpath Type[Res] "documentation": null }] -Complete src/Completion.res 343:57 +Complete document/src/Completion.res 343:57 posCursor:[343:57] posNoWhite:[343:56] Found expr:[343:10->346:23] posCursor:[343:57] posNoWhite:[343:56] Found expr:[343:53->346:23] posCursor:[343:57] posNoWhite:[343:56] Found expr:[343:53->343:57] @@ -1341,14 +1341,14 @@ Completable: Cpath Value[this] "documentation": null }] -Hover src/Completion.res 346:14 +Hover document/src/Completion.res 346:14 Nothing at that position. Now trying to use completion. posCursor:[346:14] posNoWhite:[346:13] Found expr:[346:9->346:23] JSX 346:12] name[346:13->346:17]=...[346:18->346:20]> _children:346:21 Completable: Cjsx([div], name, [name]) {"contents": "```rescript\nstring\n```"} -Hover src/Completion.res 349:17 +Hover document/src/Completion.res 349:17 Nothing at that position. Now trying to use completion. posCursor:[349:17] posNoWhite:[349:16] Found expr:[349:11->349:35] Pexp_send age[349:30->349:33] e:[349:11->349:28] @@ -1357,7 +1357,7 @@ Pexp_ident FAO.forAutoObject:[349:11->349:28] Completable: Cpath Value[FAO, forAutoObject] {"contents": "```rescript\n{\"age\": int, \"forAutoLabel\": FAR.forAutoRecord}\n```"} -Hover src/Completion.res 352:17 +Hover document/src/Completion.res 352:17 Nothing at that position. Now trying to use completion. posCursor:[352:17] posNoWhite:[352:16] Found expr:[352:11->352:22] Pexp_apply ...[352:11->352:13] (~opt1352:15->352:19=...[352:20->352:21]) @@ -1373,12 +1373,12 @@ Found type for function ( ) => int {"contents": "```rescript\noption\n```"} -Complete src/Completion.res 355:23 +Complete document/src/Completion.res 355:23 posCursor:[355:23] posNoWhite:[355:22] Found expr:[0:-1->355:23] posCursor:[355:23] posNoWhite:[355:22] Found expr:[355:12->355:23] [] -Complete src/Completion.res 362:8 +Complete document/src/Completion.res 362:8 posCursor:[362:8] posNoWhite:[362:7] Found expr:[360:8->365:3] posCursor:[362:8] posNoWhite:[362:7] Found expr:[361:2->365:3] posCursor:[362:8] posNoWhite:[362:7] Found pattern:[362:7->364:5] @@ -1411,7 +1411,7 @@ Completable: Cpath Value[T] "documentation": null }] -Complete src/Completion.res 373:21 +Complete document/src/Completion.res 373:21 posCursor:[373:21] posNoWhite:[373:20] Found expr:[371:8->376:3] posCursor:[373:21] posNoWhite:[373:20] Found expr:[372:2->376:3] posCursor:[373:21] posNoWhite:[373:20] Found pattern:[373:7->375:5] @@ -1426,7 +1426,7 @@ Completable: Cpath Value[AndThatOther, T] "documentation": null }] -Complete src/Completion.res 378:24 +Complete document/src/Completion.res 378:24 posCursor:[378:24] posNoWhite:[378:23] Found expr:[378:12->378:26] Pexp_apply ...__ghost__[0:-1->0:-1] (...[378:12->378:24], ...[378:24->378:25]) posCursor:[378:24] posNoWhite:[378:23] Found expr:[378:12->378:24] @@ -1448,7 +1448,7 @@ Completable: Cpath Value[ForAuto, ""] "documentation": null }] -Complete src/Completion.res 381:38 +Complete document/src/Completion.res 381:38 posCursor:[381:38] posNoWhite:[381:37] Found expr:[381:12->381:41] Pexp_apply ...__ghost__[0:-1->0:-1] (...[381:12->381:39], ...[381:39->381:40]) posCursor:[381:38] posNoWhite:[381:37] Found expr:[381:12->381:39] @@ -1470,7 +1470,7 @@ Completable: Cpath Value[FAO, forAutoObject][""] "documentation": null }] -Complete src/Completion.res 384:24 +Complete document/src/Completion.res 384:24 posCursor:[384:24] posNoWhite:[384:23] Found expr:[384:11->384:26] Pexp_apply ...__ghost__[0:-1->0:-1] (...[384:11->384:24], ...[384:24->384:25]) posCursor:[384:24] posNoWhite:[384:23] Found expr:[384:11->384:24] @@ -1492,7 +1492,7 @@ Completable: Cpath Value[funRecord]."" "documentation": null }] -Complete src/Completion.res 389:12 +Complete document/src/Completion.res 389:12 posCursor:[389:12] posNoWhite:[389:11] Found expr:[387:8->392:1] posCursor:[389:12] posNoWhite:[389:11] Found expr:[388:2->391:4] posCursor:[389:12] posNoWhite:[389:11] Found expr:[389:6->391:4] @@ -1512,7 +1512,7 @@ Completable: Cpath array->ma "documentation": {"kind": "markdown", "value": "\nApplies the function (the second argument) to each item in the array, returning\na new array. The result array does not have to have elements of the same type\nas the input array. See\n[`Array.map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)\non MDN.\n\n```res example\nJs.Array2.map([12, 4, 8], x => x * x) == [144, 16, 64]\nJs.Array2.map([\"animal\", \"vegetable\", \"mineral\"], Js.String.length) == [6, 9, 7]\n```\n"} }] -Complete src/Completion.res 397:14 +Complete document/src/Completion.res 397:14 posCursor:[397:14] posNoWhite:[397:13] Found expr:[396:14->397:20] Pexp_apply ...__ghost__[0:-1->0:-1] (...[396:14->397:16], ...[397:16->397:19]) posCursor:[397:14] posNoWhite:[397:13] Found expr:[396:14->397:16] @@ -1528,7 +1528,7 @@ Completable: Cpath Value[red] "documentation": null }] -Complete src/Completion.res 402:25 +Complete document/src/Completion.res 402:25 posCursor:[402:25] posNoWhite:[402:24] Found expr:[400:14->402:31] Pexp_apply ...__ghost__[0:-1->0:-1] (...[400:14->402:27], ...[402:27->402:30]) posCursor:[402:25] posNoWhite:[402:24] Found expr:[400:14->402:27] @@ -1544,7 +1544,7 @@ Completable: Cpath Value[red] "documentation": null }] -Complete src/Completion.res 405:22 +Complete document/src/Completion.res 405:22 posCursor:[405:22] posNoWhite:[405:21] Found expr:[405:11->408:0] Pexp_apply ...__ghost__[0:-1->0:-1] (...[405:11->405:22], ...[408:0->408:0]) posCursor:[405:22] posNoWhite:[405:21] Found expr:[405:11->405:22] diff --git a/analysis/tests/src/expected/Component.res.txt b/analysis/tests/document/src/expected/Component.res.txt similarity index 100% rename from analysis/tests/src/expected/Component.res.txt rename to analysis/tests/document/src/expected/Component.res.txt diff --git a/analysis/tests/src/expected/Component.resi.txt b/analysis/tests/document/src/expected/Component.resi.txt similarity index 100% rename from analysis/tests/src/expected/Component.resi.txt rename to analysis/tests/document/src/expected/Component.resi.txt diff --git a/analysis/tests/src/expected/CreateInterface.res.txt b/analysis/tests/document/src/expected/CreateInterface.res.txt similarity index 97% rename from analysis/tests/src/expected/CreateInterface.res.txt rename to analysis/tests/document/src/expected/CreateInterface.res.txt index f4eee32f2..48f38ffdc 100644 --- a/analysis/tests/src/expected/CreateInterface.res.txt +++ b/analysis/tests/document/src/expected/CreateInterface.res.txt @@ -1,4 +1,4 @@ -Create Interface src/CreateInterface.res +Create Interface document/src/CreateInterface.res type r = {name: string, age: int} let add: (~x: int, ~y: int) => int @react.component diff --git a/analysis/tests/src/expected/Cross.res.txt b/analysis/tests/document/src/expected/Cross.res.txt similarity index 89% rename from analysis/tests/src/expected/Cross.res.txt rename to analysis/tests/document/src/expected/Cross.res.txt index b045e8a02..8ae48dd44 100644 --- a/analysis/tests/src/expected/Cross.res.txt +++ b/analysis/tests/document/src/expected/Cross.res.txt @@ -1,4 +1,4 @@ -References src/Cross.res 0:17 +References document/src/Cross.res 0:17 [ {"uri": "Cross.res", "range": {"start": {"line": 0, "character": 15}, "end": {"line": 0, "character": 25}}}, {"uri": "Cross.res", "range": {"start": {"line": 3, "character": 16}, "end": {"line": 3, "character": 26}}}, @@ -7,7 +7,7 @@ References src/Cross.res 0:17 {"uri": "References.res", "range": {"start": {"line": 0, "character": 0}, "end": {"line": 0, "character": 0}}} ] -References src/Cross.res 9:31 +References document/src/Cross.res 9:31 [ {"uri": "Cross.res", "range": {"start": {"line": 9, "character": 28}, "end": {"line": 9, "character": 51}}}, {"uri": "Cross.res", "range": {"start": {"line": 12, "character": 29}, "end": {"line": 12, "character": 52}}}, @@ -17,7 +17,7 @@ References src/Cross.res 9:31 {"uri": "ReferencesWithInterface.resi", "range": {"start": {"line": 0, "character": 0}, "end": {"line": 0, "character": 0}}} ] -Rename src/Cross.res 18:13 RenameWithInterfacePrime +Rename document/src/Cross.res 18:13 RenameWithInterfacePrime [ { "kind": "rename", @@ -44,7 +44,7 @@ Rename src/Cross.res 18:13 RenameWithInterfacePrime } ] -Rename src/Cross.res 21:28 xPrime +Rename document/src/Cross.res 21:28 xPrime [ { "textDocument": { @@ -81,19 +81,19 @@ Rename src/Cross.res 21:28 xPrime } ] -TypeDefinition src/Cross.res 24:5 +TypeDefinition document/src/Cross.res 24:5 {"uri": "TypeDefinition.res", "range": {"start": {"line": 2, "character": 0}, "end": {"line": 2, "character": 28}}} -Definition src/Cross.res 27:32 +Definition document/src/Cross.res 27:32 {"uri": "DefinitionWithInterface.res", "range": {"start": {"line": 0, "character": 4}, "end": {"line": 0, "character": 5}}} -Definition src/Cross.res 30:36 +Definition document/src/Cross.res 30:36 {"uri": "DefinitionWithInterface.res", "range": {"start": {"line": 3, "character": 5}, "end": {"line": 3, "character": 6}}} -TypeDefinition src/Cross.res 33:37 +TypeDefinition document/src/Cross.res 33:37 {"uri": "DefinitionWithInterface.resi", "range": {"start": {"line": 3, "character": 0}, "end": {"line": 3, "character": 6}}} -Complete src/Cross.res 36:28 +Complete document/src/Cross.res 36:28 posCursor:[36:28] posNoWhite:[36:27] Found expr:[36:3->36:28] Pexp_ident DefinitionWithInterface.a:[36:3->36:28] Completable: Cpath Value[DefinitionWithInterface, a] diff --git a/analysis/tests/document/src/expected/Dce.res.txt b/analysis/tests/document/src/expected/Dce.res.txt new file mode 100644 index 000000000..1c0b50431 --- /dev/null +++ b/analysis/tests/document/src/expected/Dce.res.txt @@ -0,0 +1,3 @@ +DCE document/src/Dce.res +Error: cannot find project root containing bsconfig.json. +Fatal error: exception File "reanalyze/src/Paths.ml", line 23, characters 6-12: Assertion failed diff --git a/analysis/tests/document/src/expected/Debug.res.txt b/analysis/tests/document/src/expected/Debug.res.txt new file mode 100644 index 000000000..adf0b791d --- /dev/null +++ b/analysis/tests/document/src/expected/Debug.res.txt @@ -0,0 +1,95 @@ + +Definition document/src/Debug.res 1:20 +Dependencies: @rescript/react +Source directories: document/node_modules/@rescript/react/src document/node_modules/@rescript/react/src/legacy +Source files: document/node_modules/@rescript/react/src/React.res document/node_modules/@rescript/react/src/ReactDOM.res document/node_modules/@rescript/react/src/ReactDOMServer.res document/node_modules/@rescript/react/src/ReactDOMStyle.res document/node_modules/@rescript/react/src/ReactEvent.res document/node_modules/@rescript/react/src/ReactEvent.resi document/node_modules/@rescript/react/src/ReactTestUtils.res document/node_modules/@rescript/react/src/ReactTestUtils.resi document/node_modules/@rescript/react/src/RescriptReactErrorBoundary.res document/node_modules/@rescript/react/src/RescriptReactErrorBoundary.resi document/node_modules/@rescript/react/src/RescriptReactRouter.res document/node_modules/@rescript/react/src/RescriptReactRouter.resi document/node_modules/@rescript/react/src/legacy/ReactDOMRe.res document/node_modules/@rescript/react/src/legacy/ReasonReact.res +Source directories: document/src document/src/expected +Source files: document/src/Auto.res document/src/CompletePrioritize1.res document/src/CompletePrioritize2.res document/src/Completion.res document/src/Component.res document/src/Component.resi document/src/CreateInterface.res document/src/Cross.res document/src/Dce.res document/src/Debug.res document/src/Definition.res document/src/DefinitionWithInterface.res document/src/DefinitionWithInterface.resi document/src/Div.res document/src/DocumentSymbol.res document/src/Fragment.res document/src/Highlight.res document/src/Hover.res document/src/InlayHint.res document/src/Jsx.res document/src/Jsx.resi document/src/LongIdentTest.res document/src/Object.res document/src/Patterns.res document/src/RecModules.res document/src/RecordCompletion.res document/src/RecoveryOnProp.res document/src/References.res document/src/ReferencesWithInterface.res document/src/ReferencesWithInterface.resi document/src/Rename.res document/src/RenameWithInterface.res document/src/RenameWithInterface.resi document/src/TableclothMap.ml document/src/TableclothMap.mli document/src/TypeDefinition.res document/src/Xform.res +Impl cmt:document/lib/bs/src/Auto.cmt res:document/src/Auto.res +Impl cmt:document/lib/bs/src/CompletePrioritize1.cmt res:document/src/CompletePrioritize1.res +Impl cmt:document/lib/bs/src/CompletePrioritize2.cmt res:document/src/CompletePrioritize2.res +Impl cmt:document/lib/bs/src/Completion.cmt res:document/src/Completion.res +IntfAndImpl cmti:document/lib/bs/src/Component.cmti resi:document/src/Component.resi cmt:document/lib/bs/src/Component.cmt res:document/src/Component.res +Impl cmt:document/lib/bs/src/CreateInterface.cmt res:document/src/CreateInterface.res +Impl cmt:document/lib/bs/src/Cross.cmt res:document/src/Cross.res +Impl cmt:document/lib/bs/src/Dce.cmt res:document/src/Dce.res +Impl cmt:document/lib/bs/src/Debug.cmt res:document/src/Debug.res +Impl cmt:document/lib/bs/src/Definition.cmt res:document/src/Definition.res +IntfAndImpl cmti:document/lib/bs/src/DefinitionWithInterface.cmti resi:document/src/DefinitionWithInterface.resi cmt:document/lib/bs/src/DefinitionWithInterface.cmt res:document/src/DefinitionWithInterface.res +Impl cmt:document/lib/bs/src/Div.cmt res:document/src/Div.res +Impl cmt:document/lib/bs/src/DocumentSymbol.cmt res:document/src/DocumentSymbol.res +Impl cmt:document/lib/bs/src/Fragment.cmt res:document/src/Fragment.res +Impl cmt:document/lib/bs/src/Highlight.cmt res:document/src/Highlight.res +Impl cmt:document/lib/bs/src/Hover.cmt res:document/src/Hover.res +Impl cmt:document/lib/bs/src/InlayHint.cmt res:document/src/InlayHint.res +IntfAndImpl cmti:document/lib/bs/src/Jsx.cmti resi:document/src/Jsx.resi cmt:document/lib/bs/src/Jsx.cmt res:document/src/Jsx.res +Impl cmt:document/lib/bs/src/LongIdentTest.cmt res:document/src/LongIdentTest.res +Impl cmt:document/lib/bs/src/Object.cmt res:document/src/Object.res +Impl cmt:document/lib/bs/src/Patterns.cmt res:document/src/Patterns.res +Impl cmt:document/lib/bs/src/RecModules.cmt res:document/src/RecModules.res +Impl cmt:document/lib/bs/src/RecordCompletion.cmt res:document/src/RecordCompletion.res +Impl cmt:document/lib/bs/src/RecoveryOnProp.cmt res:document/src/RecoveryOnProp.res +Impl cmt:document/lib/bs/src/References.cmt res:document/src/References.res +IntfAndImpl cmti:document/lib/bs/src/ReferencesWithInterface.cmti resi:document/src/ReferencesWithInterface.resi cmt:document/lib/bs/src/ReferencesWithInterface.cmt res:document/src/ReferencesWithInterface.res +Impl cmt:document/lib/bs/src/Rename.cmt res:document/src/Rename.res +IntfAndImpl cmti:document/lib/bs/src/RenameWithInterface.cmti resi:document/src/RenameWithInterface.resi cmt:document/lib/bs/src/RenameWithInterface.cmt res:document/src/RenameWithInterface.res +IntfAndImpl cmti:document/lib/bs/src/TableclothMap.cmti resi:document/src/TableclothMap.mli cmt:document/lib/bs/src/TableclothMap.cmt res:document/src/TableclothMap.ml +Impl cmt:document/lib/bs/src/TypeDefinition.cmt res:document/src/TypeDefinition.res +Impl cmt:document/lib/bs/src/Xform.cmt res:document/src/Xform.res +Dependency dirs: document/node_modules/@rescript/react/lib/bs/src document/node_modules/@rescript/react/lib/bs/src/legacy +Opens from bsconfig: +locItems: + 1:18-1:21 Typed map (Belt.List.t<'a>, 'a => 'b) => Belt.List.t<'b> GlobalReference +[ref] Typed GlobalReference moduleName:Belt path:List.map tip:Value +fileForModule Impl cmt:document/node_modules/rescript/lib/ocaml/belt.cmt res:document/node_modules/rescript/lib/ocaml/belt.ml +resolvePath path:List.map +resolvePath Global path:map module:Belt_List +fileForModule Impl cmt:document/node_modules/rescript/lib/ocaml/belt_List.cmti res:document/node_modules/rescript/lib/ocaml/belt_List.mli +resolvePath path:map +[ref] resolved path:map +[ref] Got stamp 1024 +[ref] alternateDeclared for Belt_List not found +[ref] Inner uri belt_List.mli +{"uri": "belt_List.mli", "range": {"start": {"line": 245, "character": 4}, "end": {"line": 245, "character": 7}}} + +Definition document/src/Debug.res 4:14 +locItems: + 4:13-4:16 Typed map ('a => 'b, list<'a>) => list<'b> GlobalReference +[ref] Typed GlobalReference moduleName:List path:map tip:Value +fileForModule Impl cmt:document/node_modules/rescript/lib/ocaml/list.cmti res:document/node_modules/rescript/lib/ocaml/list.mli +resolvePath path:map +[ref] resolved path:map +[ref] Got stamp 1018 +[ref] alternateDeclared for List not found +[ref] Inner uri list.mli +{"uri": "list.mli", "range": {"start": {"line": 116, "character": 4}, "end": {"line": 116, "character": 7}}} + +Complete document/src/Debug.res 13:8 +posCursor:[13:8] posNoWhite:[13:7] Found expr:[13:5->13:8] +Pexp_ident eqN:[13:5->13:8] +Completable: Cpath Value[eqN] +Raw ppens: 1 Js.place holder +Package opens +resolving open Js.place holder +resolvePath path:Js.place holder +Not local +fileForModule Impl cmt:document/node_modules/rescript/lib/ocaml/js.cmt res:document/node_modules/rescript/lib/ocaml/js.ml +resolvePath path:place holder +Resolved opens 1 js.ml +findLocalCompletionsWithOpens uri:Debug.res pos:13:8 +findAllCompletions uri:js.ml +[{ + "label": "eqNullable", + "kind": 12, + "tags": [], + "detail": "('a, nullable<'a>) => bool", + "documentation": null + }, { + "label": "eqNull", + "kind": 12, + "tags": [], + "detail": "('a, null<'a>) => bool", + "documentation": null + }] + + diff --git a/analysis/tests/src/expected/Definition.res.txt b/analysis/tests/document/src/expected/Definition.res.txt similarity index 77% rename from analysis/tests/src/expected/Definition.res.txt rename to analysis/tests/document/src/expected/Definition.res.txt index daf47eb9c..656f818a3 100644 --- a/analysis/tests/src/expected/Definition.res.txt +++ b/analysis/tests/document/src/expected/Definition.res.txt @@ -1,18 +1,18 @@ -Definition src/Definition.res 2:8 +Definition document/src/Definition.res 2:8 {"uri": "Definition.res", "range": {"start": {"line": 0, "character": 4}, "end": {"line": 0, "character": 6}}} -Definition src/Definition.res 10:23 +Definition document/src/Definition.res 10:23 {"uri": "Definition.res", "range": {"start": {"line": 6, "character": 7}, "end": {"line": 6, "character": 13}}} -Hover src/Definition.res 14:14 +Hover document/src/Definition.res 14:14 {"contents": "```rescript\n('a => 'b, list<'a>) => list<'b>\n```\n\n [List.map f [a1; ...; an]] applies function [f] to [a1, ..., an],\n and builds the list [[f a1; ...; f an]]\n with the results returned by [f]. Not tail-recursive. "} -Hover src/Definition.res 18:14 +Hover document/src/Definition.res 18:14 {"contents": "```rescript\n(Belt.List.t<'a>, 'a => 'b) => Belt.List.t<'b>\n```\n\n\n Returns a new list with `f` applied to each element of `someList`.\n\n ```res example\n list{1, 2}->Belt.List.map(x => x + 1) // list{3, 4}\n ```\n"} -Hover src/Definition.res 23:3 +Hover document/src/Definition.res 23:3 {"contents": "```rescript\n(. int, int) => int\n```"} -Definition src/Definition.res 26:3 +Definition document/src/Definition.res 26:3 {"uri": "Definition.res", "range": {"start": {"line": 21, "character": 4}, "end": {"line": 21, "character": 13}}} diff --git a/analysis/tests/src/expected/DefinitionWithInterface.res.txt b/analysis/tests/document/src/expected/DefinitionWithInterface.res.txt similarity index 69% rename from analysis/tests/src/expected/DefinitionWithInterface.res.txt rename to analysis/tests/document/src/expected/DefinitionWithInterface.res.txt index a133d7fbf..450a7f09c 100644 --- a/analysis/tests/src/expected/DefinitionWithInterface.res.txt +++ b/analysis/tests/document/src/expected/DefinitionWithInterface.res.txt @@ -1,3 +1,3 @@ -Definition src/DefinitionWithInterface.res 0:4 +Definition document/src/DefinitionWithInterface.res 0:4 {"uri": "DefinitionWithInterface.resi", "range": {"start": {"line": 0, "character": 4}, "end": {"line": 0, "character": 5}}} diff --git a/analysis/tests/src/expected/DefinitionWithInterface.resi.txt b/analysis/tests/document/src/expected/DefinitionWithInterface.resi.txt similarity index 68% rename from analysis/tests/src/expected/DefinitionWithInterface.resi.txt rename to analysis/tests/document/src/expected/DefinitionWithInterface.resi.txt index 256702cc6..397c81059 100644 --- a/analysis/tests/src/expected/DefinitionWithInterface.resi.txt +++ b/analysis/tests/document/src/expected/DefinitionWithInterface.resi.txt @@ -1,3 +1,3 @@ -Definition src/DefinitionWithInterface.resi 0:4 +Definition document/src/DefinitionWithInterface.resi 0:4 {"uri": "DefinitionWithInterface.res", "range": {"start": {"line": 0, "character": 4}, "end": {"line": 0, "character": 5}}} diff --git a/analysis/tests/src/expected/Div.res.txt b/analysis/tests/document/src/expected/Div.res.txt similarity index 87% rename from analysis/tests/src/expected/Div.res.txt rename to analysis/tests/document/src/expected/Div.res.txt index aeb25d150..5f6a8312a 100644 --- a/analysis/tests/src/expected/Div.res.txt +++ b/analysis/tests/document/src/expected/Div.res.txt @@ -1,8 +1,8 @@ -Hover src/Div.res 0:10 +Hover document/src/Div.res 0:10 getLocItem #3: heuristic for
{"contents": "```rescript\n(\n string,\n ~props: ReactDOMRe.domProps=?,\n array,\n) => React.element\n```"} -Complete src/Div.res 3:17 +Complete document/src/Div.res 3:17 posCursor:[3:17] posNoWhite:[3:16] Found expr:[3:4->3:17] JSX 3:7] dangerous[3:8->3:17]=...[3:8->3:17]> _children:None Completable: Cjsx([div], dangerous, [dangerous]) diff --git a/analysis/tests/src/expected/DocumentSymbol.res.txt b/analysis/tests/document/src/expected/DocumentSymbol.res.txt similarity index 95% rename from analysis/tests/src/expected/DocumentSymbol.res.txt rename to analysis/tests/document/src/expected/DocumentSymbol.res.txt index a61675dc1..c941c31d4 100644 --- a/analysis/tests/src/expected/DocumentSymbol.res.txt +++ b/analysis/tests/document/src/expected/DocumentSymbol.res.txt @@ -1,84 +1,67 @@ -DocumentSymbol src/DocumentSymbol.res -[ -{ +DocumentSymbol document/src/DocumentSymbol.res +[{ "name": "MyList", "kind": 2, "location": {"uri": "DocumentSymbol.res", "range": {"start": {"line": 0, "character": 7}, "end": {"line": 0, "character": 25}}} -}, -{ +}, { "name": "Dep", "kind": 2, "location": {"uri": "DocumentSymbol.res", "range": {"start": {"line": 2, "character": 7}, "end": {"line": 7, "character": 1}}} -}, -{ +}, { "name": "customDouble", "kind": 12, "location": {"uri": "DocumentSymbol.res", "range": {"start": {"line": 6, "character": 2}, "end": {"line": 6, "character": 35}}} -}, -{ +}, { "name": "Lib", "kind": 2, "location": {"uri": "DocumentSymbol.res", "range": {"start": {"line": 9, "character": 7}, "end": {"line": 12, "character": 1}}} -}, -{ +}, { "name": "foo", "kind": 12, "location": {"uri": "DocumentSymbol.res", "range": {"start": {"line": 10, "character": 2}, "end": {"line": 10, "character": 55}}} -}, -{ +}, { "name": "next", "kind": 12, "location": {"uri": "DocumentSymbol.res", "range": {"start": {"line": 11, "character": 2}, "end": {"line": 11, "character": 48}}} -}, -{ +}, { "name": "op", "kind": 13, "location": {"uri": "DocumentSymbol.res", "range": {"start": {"line": 14, "character": 0}, "end": {"line": 14, "character": 16}}} -}, -{ +}, { "name": "ForAuto", "kind": 2, "location": {"uri": "DocumentSymbol.res", "range": {"start": {"line": 16, "character": 7}, "end": {"line": 20, "character": 1}}} -}, -{ +}, { "name": "t", "kind": 26, "location": {"uri": "DocumentSymbol.res", "range": {"start": {"line": 17, "character": 2}, "end": {"line": 17, "character": 14}}} -}, -{ +}, { "name": "abc", "kind": 12, "location": {"uri": "DocumentSymbol.res", "range": {"start": {"line": 18, "character": 2}, "end": {"line": 18, "character": 32}}} -}, -{ +}, { "name": "abd", "kind": 12, "location": {"uri": "DocumentSymbol.res", "range": {"start": {"line": 19, "character": 2}, "end": {"line": 19, "character": 32}}} -}, -{ +}, { "name": "fa", "kind": 16, "location": {"uri": "DocumentSymbol.res", "range": {"start": {"line": 22, "character": 0}, "end": {"line": 22, "character": 22}}} -}, -{ +}, { "name": "O", "kind": 2, "location": {"uri": "DocumentSymbol.res", "range": {"start": {"line": 24, "character": 7}, "end": {"line": 29, "character": 1}}} -}, -{ +}, { "name": "Comp", "kind": 2, "location": {"uri": "DocumentSymbol.res", "range": {"start": {"line": 25, "character": 9}, "end": {"line": 28, "character": 3}}} -}, -{ +}, { "name": "make", "kind": 12, "location": {"uri": "DocumentSymbol.res", "range": {"start": {"line": 27, "character": 4}, "end": {"line": 27, "character": 98}}} -}, -{ +}, { "name": "zzz", "kind": 16, "location": {"uri": "DocumentSymbol.res", "range": {"start": {"line": 31, "character": 0}, "end": {"line": 31, "character": 12}}} -} -] +}] diff --git a/analysis/tests/src/expected/Fragment.res.txt b/analysis/tests/document/src/expected/Fragment.res.txt similarity index 90% rename from analysis/tests/src/expected/Fragment.res.txt rename to analysis/tests/document/src/expected/Fragment.res.txt index 10a05f5ab..b2fd12fce 100644 --- a/analysis/tests/src/expected/Fragment.res.txt +++ b/analysis/tests/document/src/expected/Fragment.res.txt @@ -1,9 +1,9 @@ -Hover src/Fragment.res 6:19 +Hover document/src/Fragment.res 6:19 getLocItem #4: heuristic for within fragments: take make as makeProps does not work the type is not great but jump to definition works {"contents": "```rescript\nReact.component<{\"children\": React.element}>\n```\n\n```rescript\ntype component<'props> = componentLike<'props, element>\n```"} -Hover src/Fragment.res 9:56 +Hover document/src/Fragment.res 9:56 Nothing at that position. Now trying to use completion. posCursor:[9:56] posNoWhite:[9:55] Found expr:[9:10->9:67] Pexp_construct :::[9:13->9:67] [9:13->9:67] diff --git a/analysis/tests/src/expected/Highlight.res.txt b/analysis/tests/document/src/expected/Highlight.res.txt similarity index 99% rename from analysis/tests/src/expected/Highlight.res.txt rename to analysis/tests/document/src/expected/Highlight.res.txt index 0e88a0c17..0c2105526 100644 --- a/analysis/tests/src/expected/Highlight.res.txt +++ b/analysis/tests/document/src/expected/Highlight.res.txt @@ -1,4 +1,4 @@ -Highlight src/Highlight.res +Highlight document/src/Highlight.res structure items:38 diagnostics:0 Lident: M 0:7 Class Lident: C 1:9 Class diff --git a/analysis/tests/src/expected/Hover.res.txt b/analysis/tests/document/src/expected/Hover.res.txt similarity index 79% rename from analysis/tests/src/expected/Hover.res.txt rename to analysis/tests/document/src/expected/Hover.res.txt index f1b882d13..82a25c27a 100644 --- a/analysis/tests/src/expected/Hover.res.txt +++ b/analysis/tests/document/src/expected/Hover.res.txt @@ -1,32 +1,32 @@ -Hover src/Hover.res 0:4 +Hover document/src/Hover.res 0:4 {"contents": "```rescript\nint\n```"} -Hover src/Hover.res 3:5 +Hover document/src/Hover.res 3:5 {"contents": "```rescript\ntype t = (int, float)\n```"} -Hover src/Hover.res 6:7 +Hover document/src/Hover.res 6:7 {"contents": "```rescript\nmodule Id = {\n type x = int\n}\n```"} -Hover src/Hover.res 19:11 +Hover document/src/Hover.res 19:11 {"contents": "\nThis module is commented\n```rescript\nmodule Dep = {\n let customDouble: int => int\n}\n```"} -Hover src/Hover.res 22:11 +Hover document/src/Hover.res 22:11 {"contents": "```rescript\nint => int\n```\n\nSome doc comment"} -Hover src/Hover.res 26:6 +Hover document/src/Hover.res 26:6 {"contents": "```rescript\nint\n```"} -Hover src/Hover.res 33:4 +Hover document/src/Hover.res 33:4 {"contents": "```rescript\nunit => int\n```\n\nDoc comment for functionWithTypeAnnotation"} -Hover src/Hover.res 37:13 +Hover document/src/Hover.res 37:13 getLocItem #5: heuristic for JSX and compiler combined: ~x becomes Props#x heuristic for: [Props, x], give loc of `x` n1:Props n2:name {"contents": "```rescript\nstring\n```"} -Hover src/Hover.res 41:13 +Hover document/src/Hover.res 41:13 getLocItem #7: heuristic for JSX on type-annotated labeled (~arg:t): (~arg:t) becomes Props#arg Props has the location range of arg:t @@ -35,66 +35,66 @@ heuristic for: [Props, arg], give loc of `arg` n1:Props n2:name {"contents": "```rescript\nstring\n```"} -Hover src/Hover.res 44:10 +Hover document/src/Hover.res 44:10 {"contents": "```rescript\nint\n```"} -Hover src/Hover.res 47:13 +Hover document/src/Hover.res 47:13 {"contents": "```rescript\nmodule Logger = {\n let log: string => unit\n}\n```"} -Hover src/Hover.res 52:7 +Hover document/src/Hover.res 52:7 {"contents": "```rescript\nmodule Logger = {\n let log: string => unit\n}\n```"} -Definition src/Hover.res 58:14 +Definition document/src/Hover.res 58:14 {"uri": "Hover.res", "range": {"start": {"line": 47, "character": 12}, "end": {"line": 47, "character": 18}}} -Hover src/Hover.res 61:9 +Hover document/src/Hover.res 61:9 {"contents": "```rescript\nmodule IdDefinedTwice = {\n let y: int\n let _x: int\n}\n```"} -Hover src/Hover.res 72:7 +Hover document/src/Hover.res 72:7 {"contents": "```rescript\nmodule A = {\n let x: int\n}\n```"} -Hover src/Hover.res 75:7 +Hover document/src/Hover.res 75:7 {"contents": "```rescript\nmodule A = {\n let x: int\n}\n```"} -Hover src/Hover.res 85:10 +Hover document/src/Hover.res 85:10 getLocItem #9: heuristic for JSX variadic, e.g. {x} {y} heuristic for: [React.null, makeProps, make, createElementVariadic], give the loc of `make` n1:null n2:makeProps n3:make n4:createElementVariadic {"contents": "```rescript\nReact.component<{\"children\": React.element}>\n```\n\n```rescript\ntype component<'props> = componentLike<'props, element>\n```"} -Hover src/Hover.res 88:10 +Hover document/src/Hover.res 88:10 getLocItem #9: heuristic for JSX variadic, e.g. {x} {y} heuristic for: [React.null, makeProps, make, createElementVariadic], give the loc of `make` n1:null n2:makeProps n3:make n4:createElementVariadic {"contents": "```rescript\nReact.component<{\"children\": React.element}>\n```\n\n```rescript\ntype component<'props> = componentLike<'props, element>\n```"} -Hover src/Hover.res 93:25 +Hover document/src/Hover.res 93:25 {"contents": "```rescript\nfloat\n```"} -Hover src/Hover.res 96:21 +Hover document/src/Hover.res 96:21 {"contents": "```rescript\nint\n```"} -Hover src/Hover.res 106:16 +Hover document/src/Hover.res 106:16 {"contents": "```rescript\nAA.cond<[< #str(string)]> => AA.cond<[< #str(string)]>\n```"} -Hover src/Hover.res 109:25 +Hover document/src/Hover.res 109:25 {"contents": "```rescript\nAA.cond<[< #str(string)]> => AA.cond<[< #str(string)]>\n```"} -Hover src/Hover.res 112:3 +Hover document/src/Hover.res 112:3 Nothing at that position. Now trying to use completion. Attribute id:live:[112:0->112:5] label:live Completable: Cdecorator(live) {"contents": "The `@live` decorator is for reanalyze, a static analysis tool for ReScript that can do dead code analysis.\n\n`@live` tells the dead code analysis that the value should be considered live, even though it might appear to be dead. This is typically used in case of FFI where there are indirect ways to access values. It can be added to everything that could otherwise be considered unused by the dead code analysis - values, functions, arguments, records, individual record fields, and so on.\n\n[Read more and see examples in the documentation](https://rescript-lang.org/syntax-lookup#live-decorator).\n\nHint: Did you know you can run an interactive code analysis in your project by running the command `> ReScript: Start Code Analyzer`? Try it!"} -Hover src/Hover.res 115:4 +Hover document/src/Hover.res 115:4 {"contents": "```rescript\n(. ()) => unit => int\n```"} -Hover src/Hover.res 121:4 +Hover document/src/Hover.res 121:4 {"contents": "```rescript\n(. ()) => (. ()) => int\n```"} -Hover src/Hover.res 124:4 +Hover document/src/Hover.res 124:4 {"contents": "```rescript\n(. unit, unit) => int\n```"} -Hover src/Hover.res 127:5 +Hover document/src/Hover.res 127:5 {"contents": "```rescript\n(. ()) => unit => int\n```"} diff --git a/analysis/tests/src/expected/InlayHint.res.txt b/analysis/tests/document/src/expected/InlayHint.res.txt similarity index 95% rename from analysis/tests/src/expected/InlayHint.res.txt rename to analysis/tests/document/src/expected/InlayHint.res.txt index a129f9331..e23c95e57 100644 --- a/analysis/tests/src/expected/InlayHint.res.txt +++ b/analysis/tests/document/src/expected/InlayHint.res.txt @@ -1,4 +1,4 @@ -Inlay Hint src/InlayHint.res 0:6 +Inlay Hint document/src/InlayHint.res 0:6 [{ "position": {"line": 5, "character": 15}, "label": ": int", diff --git a/analysis/tests/src/expected/Jsx.res.txt b/analysis/tests/document/src/expected/Jsx.res.txt similarity index 90% rename from analysis/tests/src/expected/Jsx.res.txt rename to analysis/tests/document/src/expected/Jsx.res.txt index 041c8d867..7f0dc2aba 100644 --- a/analysis/tests/src/expected/Jsx.res.txt +++ b/analysis/tests/document/src/expected/Jsx.res.txt @@ -1,9 +1,9 @@ -Definition src/Jsx.res 5:9 +Definition document/src/Jsx.res 5:9 getLocItem #4: heuristic for within fragments: take make as makeProps does not work the type is not great but jump to definition works {"uri": "Jsx.res", "range": {"start": {"line": 2, "character": 6}, "end": {"line": 2, "character": 10}}} -Complete src/Jsx.res 8:15 +Complete document/src/Jsx.res 8:15 posCursor:[8:15] posNoWhite:[8:14] Found expr:[8:4->8:15] JSX 8:5] second[8:6->8:12]=...[8:13->8:15]> _children:None posCursor:[8:15] posNoWhite:[8:14] Found expr:[8:13->8:15] @@ -11,7 +11,7 @@ Pexp_ident fi:[8:13->8:15] Completable: Cpath Value[fi] [] -Complete src/Jsx.res 11:20 +Complete document/src/Jsx.res 11:20 posCursor:[11:20] posNoWhite:[11:19] Found expr:[11:4->11:20] JSX 11:5] second[11:6->11:12]=...[11:13->11:18] f[11:19->11:20]=...[11:19->11:20]> _children:None Completable: Cjsx([M], f, [second, f]) @@ -29,7 +29,7 @@ Completable: Cjsx([M], f, [second, f]) "documentation": null }] -Complete src/Jsx.res 14:13 +Complete document/src/Jsx.res 14:13 posCursor:[14:13] posNoWhite:[14:12] Found expr:[14:12->14:13] JSX 14:13] > _children:None Completable: Cpath Module[M] @@ -59,7 +59,7 @@ Completable: Cpath Module[M] "documentation": null }] -Complete src/Jsx.res 22:19 +Complete document/src/Jsx.res 22:19 posCursor:[22:19] posNoWhite:[22:18] Found expr:[22:4->22:19] JSX 22:5] prop[22:6->22:10]=...[22:12->22:16] k[22:18->22:19]=...[22:18->22:19]> _children:None Completable: Cjsx([M], k, [prop, k]) @@ -71,7 +71,7 @@ Completable: Cjsx([M], k, [prop, k]) "documentation": null }] -Complete src/Jsx.res 25:17 +Complete document/src/Jsx.res 25:17 posCursor:[25:17] posNoWhite:[25:16] Found expr:[25:4->25:17] JSX 25:5] prop[25:6->25:10]=...[25:11->25:15] k[25:16->25:17]=...[25:16->25:17]> _children:None Completable: Cjsx([M], k, [prop, k]) @@ -83,7 +83,7 @@ Completable: Cjsx([M], k, [prop, k]) "documentation": null }] -Complete src/Jsx.res 28:21 +Complete document/src/Jsx.res 28:21 posCursor:[28:21] posNoWhite:[28:20] Found expr:[28:4->28:21] JSX 28:5] prop[28:6->28:10]=...[28:11->28:19] k[28:20->28:21]=...[28:20->28:21]> _children:None Completable: Cjsx([M], k, [prop, k]) @@ -95,7 +95,7 @@ Completable: Cjsx([M], k, [prop, k]) "documentation": null }] -Complete src/Jsx.res 31:24 +Complete document/src/Jsx.res 31:24 posCursor:[31:24] posNoWhite:[31:23] Found expr:[31:4->31:24] JSX 31:5] prop[31:6->31:10]=...[31:11->31:22] k[31:23->31:24]=...[31:23->31:24]> _children:None Completable: Cjsx([M], k, [prop, k]) @@ -107,7 +107,7 @@ Completable: Cjsx([M], k, [prop, k]) "documentation": null }] -Complete src/Jsx.res 34:18 +Complete document/src/Jsx.res 34:18 posCursor:[34:18] posNoWhite:[34:17] Found expr:[34:4->34:18] JSX 34:5] prop[34:6->34:10]=...[34:12->34:16] k[34:17->34:18]=...[34:17->34:18]> _children:None Completable: Cjsx([M], k, [prop, k]) @@ -119,7 +119,7 @@ Completable: Cjsx([M], k, [prop, k]) "documentation": null }] -Complete src/Jsx.res 37:16 +Complete document/src/Jsx.res 37:16 posCursor:[37:16] posNoWhite:[37:15] Found expr:[37:4->37:16] JSX 37:5] prop[37:6->37:10]=...[37:11->37:14] k[37:15->37:16]=...[37:15->37:16]> _children:None Completable: Cjsx([M], k, [prop, k]) @@ -131,7 +131,7 @@ Completable: Cjsx([M], k, [prop, k]) "documentation": null }] -Complete src/Jsx.res 40:17 +Complete document/src/Jsx.res 40:17 posCursor:[40:17] posNoWhite:[40:16] Found expr:[40:4->40:17] JSX 40:5] prop[40:6->40:10]=...[40:11->40:15] k[40:16->40:17]=...[40:16->40:17]> _children:None Completable: Cjsx([M], k, [prop, k]) @@ -143,7 +143,7 @@ Completable: Cjsx([M], k, [prop, k]) "documentation": null }] -Complete src/Jsx.res 43:18 +Complete document/src/Jsx.res 43:18 posCursor:[43:18] posNoWhite:[43:17] Found expr:[43:4->43:18] JSX 43:5] prop[43:6->43:10]=...[43:11->43:16] k[43:17->43:18]=...[43:17->43:18]> _children:None Completable: Cjsx([M], k, [prop, k]) @@ -155,7 +155,7 @@ Completable: Cjsx([M], k, [prop, k]) "documentation": null }] -Complete src/Jsx.res 46:16 +Complete document/src/Jsx.res 46:16 posCursor:[46:16] posNoWhite:[46:15] Found expr:[46:4->46:16] JSX 46:5] prop[46:6->46:10]=...[46:11->46:14] k[46:15->46:16]=...[46:15->46:16]> _children:None Completable: Cjsx([M], k, [prop, k]) @@ -167,7 +167,7 @@ Completable: Cjsx([M], k, [prop, k]) "documentation": null }] -Complete src/Jsx.res 49:27 +Complete document/src/Jsx.res 49:27 posCursor:[49:27] posNoWhite:[49:26] Found expr:[49:4->49:27] JSX 49:5] prop[49:6->49:10]=...[49:11->49:25] k[49:26->49:27]=...[49:26->49:27]> _children:None Completable: Cjsx([M], k, [prop, k]) @@ -179,7 +179,7 @@ Completable: Cjsx([M], k, [prop, k]) "documentation": null }] -Complete src/Jsx.res 52:38 +Complete document/src/Jsx.res 52:38 posCursor:[52:38] posNoWhite:[52:37] Found expr:[52:4->52:38] JSX 52:5] prop[52:6->52:10]=...[52:11->52:36] k[52:37->52:38]=...[52:37->52:38]> _children:None Completable: Cjsx([M], k, [prop, k]) @@ -191,7 +191,7 @@ Completable: Cjsx([M], k, [prop, k]) "documentation": null }] -Complete src/Jsx.res 55:25 +Complete document/src/Jsx.res 55:25 posCursor:[55:25] posNoWhite:[55:24] Found expr:[55:4->55:25] JSX 55:5] prop[55:6->55:10]=...[55:11->55:23] k[55:24->55:25]=...[55:24->55:25]> _children:None Completable: Cjsx([M], k, [prop, k]) @@ -203,12 +203,12 @@ Completable: Cjsx([M], k, [prop, k]) "documentation": null }] -Definition src/Jsx.res 58:11 +Definition document/src/Jsx.res 58:11 getLocItem #4: heuristic for within fragments: take make as makeProps does not work the type is not great but jump to definition works {"uri": "Component.res", "range": {"start": {"line": 1, "character": 4}, "end": {"line": 1, "character": 8}}} -Complete src/Jsx.res 68:10 +Complete document/src/Jsx.res 68:10 posCursor:[68:10] posNoWhite:[68:9] Found expr:[68:4->68:10] JSX 68:7] al[68:8->68:10]=...[68:8->68:10]> _children:None Completable: Cjsx([Ext], al, [al]) @@ -220,13 +220,13 @@ Completable: Cjsx([Ext], al, [al]) "documentation": null }] -Complete src/Jsx.res 71:11 +Complete document/src/Jsx.res 71:11 posCursor:[71:11] posNoWhite:[71:10] Found expr:[71:4->71:11] JSX 71:5] first[71:6->71:11]=...[71:6->71:11]> _children:None Completable: Cjsx([M], first, [first]) [] -Complete src/Jsx.res 74:16 +Complete document/src/Jsx.res 74:16 posCursor:[74:16] posNoWhite:[74:15] Found expr:[74:4->74:16] JSX 74:5] first[74:6->74:11]=...[74:12->74:14] k[74:15->74:16]=...[74:15->74:16]> _children:None Completable: Cjsx([M], k, [first, k]) @@ -238,7 +238,7 @@ Completable: Cjsx([M], k, [first, k]) "documentation": null }] -Complete src/Jsx.res 77:23 +Complete document/src/Jsx.res 77:23 posCursor:[77:23] posNoWhite:[77:22] Found expr:[77:4->77:23] JSX 77:5] first[77:6->77:11]=...[77:19->77:21] k[77:22->77:23]=...[77:22->77:23]> _children:None Completable: Cjsx([M], k, [first, k]) @@ -250,7 +250,7 @@ Completable: Cjsx([M], k, [first, k]) "documentation": null }] -Complete src/Jsx.res 80:6 +Complete document/src/Jsx.res 80:6 posCursor:[80:6] posNoWhite:[80:5] Found expr:[80:4->85:69] Pexp_apply ...[83:20->83:21] (...[80:4->83:19], ...[84:2->85:69]) posCursor:[80:6] posNoWhite:[80:5] Found expr:[80:4->83:19] @@ -261,7 +261,7 @@ posCursor:[80:6] posNoWhite:[80:5] Found expr:__ghost__[80:5->83:20] Pexp_construct []:__ghost__[80:5->83:20] None [] -Complete src/Jsx.res 89:16 +Complete document/src/Jsx.res 89:16 posCursor:[89:16] posNoWhite:[89:15] Found expr:[89:4->89:16] JSX 89:16] > _children:None Completable: Cpath Module[WithChildren] @@ -273,7 +273,7 @@ Completable: Cpath Module[WithChildren] "documentation": null }] -Complete src/Jsx.res 91:18 +Complete document/src/Jsx.res 91:18 posCursor:[91:18] posNoWhite:[91:17] Found expr:[91:4->91:18] JSX 91:16] n[91:17->91:18]=...[91:17->91:18]> _children:None Completable: Cjsx([WithChildren], n, [n]) @@ -285,7 +285,7 @@ Completable: Cjsx([WithChildren], n, [n]) "documentation": null }] -Complete src/Jsx.res 94:18 +Complete document/src/Jsx.res 94:18 posCursor:[94:18] posNoWhite:[94:17] Found pattern:[94:7->94:18] posCursor:[94:18] posNoWhite:[94:17] Found type:[94:11->94:18] Ptyp_constr React.e:[94:11->94:18] @@ -298,7 +298,7 @@ Completable: Cpath Type[React, e] "documentation": null }] -Complete src/Jsx.res 96:20 +Complete document/src/Jsx.res 96:20 posCursor:[96:20] posNoWhite:[96:19] Found pattern:[96:7->99:6] posCursor:[96:20] posNoWhite:[96:19] Found type:[96:11->99:6] Ptyp_constr ReactDOMR:[96:11->99:6] @@ -311,7 +311,7 @@ Completable: Cpath Type[ReactDOMR] "documentation": null }] -Complete src/Jsx.res 102:21 +Complete document/src/Jsx.res 102:21 posCursor:[102:21] posNoWhite:[102:20] Found expr:[102:13->102:21] Pexp_apply ...[102:15->102:16] (...[102:13->102:14], ...[102:17->102:21]) posCursor:[102:21] posNoWhite:[102:20] Found expr:[102:17->102:21] @@ -319,7 +319,7 @@ Pexp_field [102:17->102:18] th:[102:19->102:21] Completable: Cpath Value[x].th [] -Complete src/Jsx.res 106:28 +Complete document/src/Jsx.res 106:28 posCursor:[106:28] posNoWhite:[106:27] Found expr:[106:11->106:28] Pexp_ident DefineSomeFields.:[106:11->106:28] Completable: Cpath Value[DefineSomeFields, ""] @@ -331,7 +331,7 @@ Completable: Cpath Value[DefineSomeFields, ""] "documentation": null }] -Complete src/Jsx.res 108:36 +Complete document/src/Jsx.res 108:36 posCursor:[108:36] posNoWhite:[108:35] Found expr:[108:11->108:36] Pexp_apply ...[108:13->108:14] (...[108:11->108:12], ...[108:15->108:36]) posCursor:[108:36] posNoWhite:[108:35] Found expr:[108:15->108:36] @@ -351,7 +351,7 @@ Completable: Cpath Module[DefineSomeFields].th "documentation": null }] -Complete src/Jsx.res 122:20 +Complete document/src/Jsx.res 122:20 posCursor:[122:20] posNoWhite:[122:19] Found expr:[121:3->125:4] JSX 121:6] x[122:5->122:6]=...[122:7->122:20] name[124:4->124:8]=...[124:9->124:11]> _children:125:2 posCursor:[122:20] posNoWhite:[122:19] Found expr:[122:7->122:20] @@ -365,7 +365,7 @@ Completable: Cpath Value[Outer, Inner, h] "documentation": null }] -Complete src/Jsx.res 129:19 +Complete document/src/Jsx.res 129:19 posCursor:[129:19] posNoWhite:[129:18] Found expr:[128:3->131:9] JSX 128:6] x[129:5->129:6]=...[129:7->131:8]> _children:None posCursor:[129:19] posNoWhite:[129:18] Found expr:[129:7->131:8] @@ -379,12 +379,12 @@ Completable: Cpath Value[Outer, Inner, ""] "documentation": null }] -Complete src/Jsx.res 136:7 +Complete document/src/Jsx.res 136:7 posCursor:[136:7] posNoWhite:[136:6] Found expr:[135:3->138:9] JSX 135:6] x[136:5->136:6]=...[138:4->138:8]> _children:None [] -Complete src/Jsx.res 150:21 +Complete document/src/Jsx.res 150:21 posCursor:[150:21] posNoWhite:[150:20] Found expr:[150:12->150:32] JSX 150:21] name[150:22->150:26]=...[150:27->150:29]> _children:150:30 Completable: Cpath Module[Nested, Co] @@ -396,7 +396,7 @@ Completable: Cpath Module[Nested, Co] "documentation": null }] -Complete src/Jsx.res 153:19 +Complete document/src/Jsx.res 153:19 posCursor:[153:19] posNoWhite:[153:18] Found expr:[153:12->153:25] JSX 153:24] > _children:None Completable: Cpath Module[Nested, ""] @@ -408,7 +408,7 @@ Completable: Cpath Module[Nested, ""] "documentation": null }] -Hover src/Jsx.res 162:12 +Hover document/src/Jsx.res 162:12 Nothing at that position. Now trying to use completion. posCursor:[162:12] posNoWhite:[162:11] Found expr:[162:3->162:21] Pexp_construct :::[162:6->162:21] [162:6->162:21] @@ -418,7 +418,7 @@ JSX 162:10] age[162:11->162:14]=...[162:15->162:17]> _children:162 Completable: Cjsx([Comp], age, [age]) {"contents": "```rescript\nint\n```"} -Hover src/Jsx.res 167:16 +Hover document/src/Jsx.res 167:16 Nothing at that position. Now trying to use completion. posCursor:[167:16] posNoWhite:[167:15] Found expr:[167:3->167:30] Pexp_construct :::[167:7->167:30] [167:7->167:30] diff --git a/analysis/tests/src/expected/Jsx.resi.txt b/analysis/tests/document/src/expected/Jsx.resi.txt similarity index 84% rename from analysis/tests/src/expected/Jsx.resi.txt rename to analysis/tests/document/src/expected/Jsx.resi.txt index b0b987154..784a2aad3 100644 --- a/analysis/tests/src/expected/Jsx.resi.txt +++ b/analysis/tests/document/src/expected/Jsx.resi.txt @@ -1,12 +1,12 @@ -Hover src/Jsx.resi 1:4 +Hover document/src/Jsx.resi 1:4 getLocItem #1: heuristic for makeProps in interface files n1:componentLike n2:unit n3:string {"contents": "```rescript\n(~first: string, ~key: string=?, unit) => {\"first\": string}\n```"} -Hover src/Jsx.resi 4:4 +Hover document/src/Jsx.resi 4:4 {"contents": "```rescript\nint\n```"} -Complete src/Jsx.resi 7:19 +Complete document/src/Jsx.resi 7:19 posCursor:[7:19] posNoWhite:[7:18] Found type:[7:12->7:19] Ptyp_constr React.e:[7:12->7:19] Completable: Cpath Type[React, e] @@ -18,7 +18,7 @@ Completable: Cpath Type[React, e] "documentation": null }] -Complete src/Jsx.resi 10:18 +Complete document/src/Jsx.resi 10:18 posCursor:[10:18] posNoWhite:[10:17] Found type:[10:11->10:18] Ptyp_constr React.e:[10:11->10:18] Completable: Cpath Type[React, e] diff --git a/analysis/tests/document/src/expected/LongIdentTest.res.txt b/analysis/tests/document/src/expected/LongIdentTest.res.txt new file mode 100644 index 000000000..5d9e457f9 --- /dev/null +++ b/analysis/tests/document/src/expected/LongIdentTest.res.txt @@ -0,0 +1,3 @@ +Hover document/src/LongIdentTest.res 2:13 +{"contents": "```rescript\nint\n```"} + diff --git a/analysis/tests/src/expected/Object.res.txt b/analysis/tests/document/src/expected/Object.res.txt similarity index 100% rename from analysis/tests/src/expected/Object.res.txt rename to analysis/tests/document/src/expected/Object.res.txt diff --git a/analysis/tests/src/expected/Patterns.res.txt b/analysis/tests/document/src/expected/Patterns.res.txt similarity index 72% rename from analysis/tests/src/expected/Patterns.res.txt rename to analysis/tests/document/src/expected/Patterns.res.txt index 5c119ffb7..5dc4fb372 100644 --- a/analysis/tests/src/expected/Patterns.res.txt +++ b/analysis/tests/document/src/expected/Patterns.res.txt @@ -1,15 +1,15 @@ -Definition src/Patterns.res 20:10 +Definition document/src/Patterns.res 20:10 {"uri": "Patterns.res", "range": {"start": {"line": 3, "character": 7}, "end": {"line": 3, "character": 10}}} -Definition src/Patterns.res 25:11 +Definition document/src/Patterns.res 25:11 {"uri": "Patterns.res", "range": {"start": {"line": 9, "character": 7}, "end": {"line": 9, "character": 11}}} -Definition src/Patterns.res 28:11 +Definition document/src/Patterns.res 28:11 {"uri": "Patterns.res", "range": {"start": {"line": 11, "character": 7}, "end": {"line": 11, "character": 8}}} -Definition src/Patterns.res 31:11 +Definition document/src/Patterns.res 31:11 {"uri": "Patterns.res", "range": {"start": {"line": 15, "character": 9}, "end": {"line": 15, "character": 11}}} -Definition src/Patterns.res 34:11 +Definition document/src/Patterns.res 34:11 {"uri": "Patterns.res", "range": {"start": {"line": 17, "character": 11}, "end": {"line": 17, "character": 16}}} diff --git a/analysis/tests/src/expected/RecModules.res.txt b/analysis/tests/document/src/expected/RecModules.res.txt similarity index 68% rename from analysis/tests/src/expected/RecModules.res.txt rename to analysis/tests/document/src/expected/RecModules.res.txt index 8fec94205..1f0b1292c 100644 --- a/analysis/tests/src/expected/RecModules.res.txt +++ b/analysis/tests/document/src/expected/RecModules.res.txt @@ -1,6 +1,6 @@ -Hover src/RecModules.res 18:12 +Hover document/src/RecModules.res 18:12 {"contents": "```rescript\nmodule C = {\n type t\n let createA: t => A.t\n}\n```"} -Hover src/RecModules.res 20:12 +Hover document/src/RecModules.res 20:12 {"contents": "```rescript\nmodule A = {\n type t\n let child: t => B.t\n}\n```"} diff --git a/analysis/tests/src/expected/RecordCompletion.res.txt b/analysis/tests/document/src/expected/RecordCompletion.res.txt similarity index 94% rename from analysis/tests/src/expected/RecordCompletion.res.txt rename to analysis/tests/document/src/expected/RecordCompletion.res.txt index d5d0b47dc..0b0e28026 100644 --- a/analysis/tests/src/expected/RecordCompletion.res.txt +++ b/analysis/tests/document/src/expected/RecordCompletion.res.txt @@ -1,4 +1,4 @@ -Complete src/RecordCompletion.res 8:9 +Complete document/src/RecordCompletion.res 8:9 posCursor:[8:9] posNoWhite:[8:8] Found expr:[8:3->8:9] Completable: Cpath Value[t].n->m [{ @@ -15,7 +15,7 @@ Completable: Cpath Value[t].n->m "documentation": {"kind": "markdown", "value": "\nApplies the function (the second argument) to each item in the array, returning\na new array. The result array does not have to have elements of the same type\nas the input array. See\n[`Array.map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)\non MDN.\n\n```res example\nJs.Array2.map([12, 4, 8], x => x * x) == [144, 16, 64]\nJs.Array2.map([\"animal\", \"vegetable\", \"mineral\"], Js.String.length) == [6, 9, 7]\n```\n"} }] -Complete src/RecordCompletion.res 11:13 +Complete document/src/RecordCompletion.res 11:13 posCursor:[11:13] posNoWhite:[11:12] Found expr:[11:3->11:13] Completable: Cpath Value[t2].n2.n->m [{ @@ -32,7 +32,7 @@ Completable: Cpath Value[t2].n2.n->m "documentation": {"kind": "markdown", "value": "\nApplies the function (the second argument) to each item in the array, returning\na new array. The result array does not have to have elements of the same type\nas the input array. See\n[`Array.map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)\non MDN.\n\n```res example\nJs.Array2.map([12, 4, 8], x => x * x) == [144, 16, 64]\nJs.Array2.map([\"animal\", \"vegetable\", \"mineral\"], Js.String.length) == [6, 9, 7]\n```\n"} }] -Complete src/RecordCompletion.res 19:7 +Complete document/src/RecordCompletion.res 19:7 posCursor:[19:7] posNoWhite:[19:6] Found expr:[19:3->19:7] Pexp_field [19:3->19:4] R.:[19:5->19:7] Completable: Cpath Module[R]."" @@ -44,7 +44,7 @@ Completable: Cpath Module[R]."" "documentation": null }] -Complete src/RecordCompletion.res 22:7 +Complete document/src/RecordCompletion.res 22:7 posCursor:[22:7] posNoWhite:[22:6] Found expr:[22:3->22:10] Pexp_field [22:3->22:4] R.xx:[22:5->22:10] Completable: Cpath Module[R]."" diff --git a/analysis/tests/src/expected/RecoveryOnProp.res.txt b/analysis/tests/document/src/expected/RecoveryOnProp.res.txt similarity index 94% rename from analysis/tests/src/expected/RecoveryOnProp.res.txt rename to analysis/tests/document/src/expected/RecoveryOnProp.res.txt index fe509d768..f6363654b 100644 --- a/analysis/tests/src/expected/RecoveryOnProp.res.txt +++ b/analysis/tests/document/src/expected/RecoveryOnProp.res.txt @@ -1,4 +1,4 @@ -Complete src/RecoveryOnProp.res 6:26 +Complete document/src/RecoveryOnProp.res 6:26 posCursor:[6:26] posNoWhite:[6:25] Found expr:[3:3->11:8] JSX 3:6] onClick[4:4->4:11]=...[4:13->0:-1]> _children:None posCursor:[6:26] posNoWhite:[6:25] Found expr:[4:13->8:6] diff --git a/analysis/tests/src/expected/References.res.txt b/analysis/tests/document/src/expected/References.res.txt similarity index 91% rename from analysis/tests/src/expected/References.res.txt rename to analysis/tests/document/src/expected/References.res.txt index 64c02fb92..d22a73ba7 100644 --- a/analysis/tests/src/expected/References.res.txt +++ b/analysis/tests/document/src/expected/References.res.txt @@ -1,4 +1,4 @@ -References src/References.res 0:4 +References document/src/References.res 0:4 [ {"uri": "Cross.res", "range": {"start": {"line": 0, "character": 26}, "end": {"line": 0, "character": 27}}}, {"uri": "Cross.res", "range": {"start": {"line": 3, "character": 27}, "end": {"line": 3, "character": 28}}}, @@ -8,7 +8,7 @@ References src/References.res 0:4 {"uri": "References.res", "range": {"start": {"line": 7, "character": 8}, "end": {"line": 7, "character": 9}}} ] -References src/References.res 9:19 +References document/src/References.res 9:19 [ {"uri": "References.res", "range": {"start": {"line": 9, "character": 11}, "end": {"line": 9, "character": 14}}}, {"uri": "References.res", "range": {"start": {"line": 9, "character": 19}, "end": {"line": 9, "character": 21}}} diff --git a/analysis/tests/src/expected/ReferencesWithInterface.res.txt b/analysis/tests/document/src/expected/ReferencesWithInterface.res.txt similarity index 91% rename from analysis/tests/src/expected/ReferencesWithInterface.res.txt rename to analysis/tests/document/src/expected/ReferencesWithInterface.res.txt index 33f2d105d..2f08e8be6 100644 --- a/analysis/tests/src/expected/ReferencesWithInterface.res.txt +++ b/analysis/tests/document/src/expected/ReferencesWithInterface.res.txt @@ -1,4 +1,4 @@ -References src/ReferencesWithInterface.res 0:4 +References document/src/ReferencesWithInterface.res 0:4 [ {"uri": "Cross.res", "range": {"start": {"line": 9, "character": 52}, "end": {"line": 9, "character": 53}}}, {"uri": "Cross.res", "range": {"start": {"line": 12, "character": 53}, "end": {"line": 12, "character": 54}}}, diff --git a/analysis/tests/src/expected/ReferencesWithInterface.resi.txt b/analysis/tests/document/src/expected/ReferencesWithInterface.resi.txt similarity index 91% rename from analysis/tests/src/expected/ReferencesWithInterface.resi.txt rename to analysis/tests/document/src/expected/ReferencesWithInterface.resi.txt index 3e96fbc75..7b1afbc2c 100644 --- a/analysis/tests/src/expected/ReferencesWithInterface.resi.txt +++ b/analysis/tests/document/src/expected/ReferencesWithInterface.resi.txt @@ -1,4 +1,4 @@ -References src/ReferencesWithInterface.resi 0:4 +References document/src/ReferencesWithInterface.resi 0:4 [ {"uri": "Cross.res", "range": {"start": {"line": 9, "character": 52}, "end": {"line": 9, "character": 53}}}, {"uri": "Cross.res", "range": {"start": {"line": 12, "character": 53}, "end": {"line": 12, "character": 54}}}, diff --git a/analysis/tests/src/expected/Rename.res.txt b/analysis/tests/document/src/expected/Rename.res.txt similarity index 90% rename from analysis/tests/src/expected/Rename.res.txt rename to analysis/tests/document/src/expected/Rename.res.txt index 5cd2adfee..e0623c94f 100644 --- a/analysis/tests/src/expected/Rename.res.txt +++ b/analysis/tests/document/src/expected/Rename.res.txt @@ -1,4 +1,4 @@ -Rename src/Rename.res 0:4 y +Rename document/src/Rename.res 0:4 y [ { "textDocument": { @@ -18,7 +18,7 @@ Rename src/Rename.res 0:4 y } ] -Rename src/Rename.res 9:19 yy +Rename document/src/Rename.res 9:19 yy [ { "textDocument": { diff --git a/analysis/tests/src/expected/RenameWithInterface.res.txt b/analysis/tests/document/src/expected/RenameWithInterface.res.txt similarity index 93% rename from analysis/tests/src/expected/RenameWithInterface.res.txt rename to analysis/tests/document/src/expected/RenameWithInterface.res.txt index a13988fa9..b1c62593a 100644 --- a/analysis/tests/src/expected/RenameWithInterface.res.txt +++ b/analysis/tests/document/src/expected/RenameWithInterface.res.txt @@ -1,4 +1,4 @@ -Rename src/RenameWithInterface.res 0:4 y +Rename document/src/RenameWithInterface.res 0:4 y [ { "textDocument": { diff --git a/analysis/tests/src/expected/RenameWithInterface.resi.txt b/analysis/tests/document/src/expected/RenameWithInterface.resi.txt similarity index 93% rename from analysis/tests/src/expected/RenameWithInterface.resi.txt rename to analysis/tests/document/src/expected/RenameWithInterface.resi.txt index 2a1dabb44..a864f108c 100644 --- a/analysis/tests/src/expected/RenameWithInterface.resi.txt +++ b/analysis/tests/document/src/expected/RenameWithInterface.resi.txt @@ -1,4 +1,4 @@ -Rename src/RenameWithInterface.resi 0:4 y +Rename document/src/RenameWithInterface.resi 0:4 y [ { "textDocument": { diff --git a/analysis/tests/src/expected/TypeDefinition.res.txt b/analysis/tests/document/src/expected/TypeDefinition.res.txt similarity index 69% rename from analysis/tests/src/expected/TypeDefinition.res.txt rename to analysis/tests/document/src/expected/TypeDefinition.res.txt index 46a968e8f..fe27d945a 100644 --- a/analysis/tests/src/expected/TypeDefinition.res.txt +++ b/analysis/tests/document/src/expected/TypeDefinition.res.txt @@ -1,18 +1,18 @@ -TypeDefinition src/TypeDefinition.res 2:9 +TypeDefinition document/src/TypeDefinition.res 2:9 {"uri": "TypeDefinition.res", "range": {"start": {"line": 2, "character": 5}, "end": {"line": 2, "character": 11}}} -TypeDefinition src/TypeDefinition.res 5:4 +TypeDefinition document/src/TypeDefinition.res 5:4 {"uri": "TypeDefinition.res", "range": {"start": {"line": 0, "character": 0}, "end": {"line": 0, "character": 24}}} -TypeDefinition src/TypeDefinition.res 8:4 +TypeDefinition document/src/TypeDefinition.res 8:4 {"uri": "TypeDefinition.res", "range": {"start": {"line": 2, "character": 0}, "end": {"line": 2, "character": 28}}} -TypeDefinition src/TypeDefinition.res 13:4 +TypeDefinition document/src/TypeDefinition.res 13:4 {"uri": "TypeDefinition.res", "range": {"start": {"line": 11, "character": 0}, "end": {"line": 11, "character": 26}}} -TypeDefinition src/TypeDefinition.res 16:13 +TypeDefinition document/src/TypeDefinition.res 16:13 {"uri": "TypeDefinition.res", "range": {"start": {"line": 2, "character": 0}, "end": {"line": 2, "character": 28}}} -TypeDefinition src/TypeDefinition.res 20:9 +TypeDefinition document/src/TypeDefinition.res 20:9 {"uri": "TypeDefinition.res", "range": {"start": {"line": 0, "character": 0}, "end": {"line": 0, "character": 24}}} diff --git a/analysis/tests/src/expected/Xform.res.txt b/analysis/tests/document/src/expected/Xform.res.txt similarity index 82% rename from analysis/tests/src/expected/Xform.res.txt rename to analysis/tests/document/src/expected/Xform.res.txt index d298604ae..1e78db926 100644 --- a/analysis/tests/src/expected/Xform.res.txt +++ b/analysis/tests/document/src/expected/Xform.res.txt @@ -1,4 +1,4 @@ -Xform src/Xform.res 6:5 +Xform document/src/Xform.res 6:5 Hit: Replace with switch {"start": {"line": 6, "character": 0}, "end": {"line": 11, "character": 1}} newText: @@ -10,7 +10,7 @@ switch kind { | _ => ret("Not First") } -Xform src/Xform.res 13:15 +Xform document/src/Xform.res 13:15 Hit: Replace with switch {"start": {"line": 13, "character": 0}, "end": {"line": 13, "character": 79}} newText: @@ -20,23 +20,23 @@ switch kind { | _ => ret("Not First") } -Xform src/Xform.res 16:5 +Xform document/src/Xform.res 16:5 Hit: Add type annotation {"start": {"line": 16, "character": 8}, "end": {"line": 16, "character": 8}} newText: <--here : string -Xform src/Xform.res 19:5 +Xform document/src/Xform.res 19:5 -Xform src/Xform.res 26:10 +Xform document/src/Xform.res 26:10 Hit: Add type annotation {"start": {"line": 26, "character": 10}, "end": {"line": 26, "character": 11}} newText: <--here (x: option) -Xform src/Xform.res 30:9 +Xform document/src/Xform.res 30:9 Hit: Add braces to function {"start": {"line": 26, "character": 0}, "end": {"line": 32, "character": 3}} newText: @@ -50,23 +50,23 @@ let foo = x => { } } -Xform src/Xform.res 34:21 +Xform document/src/Xform.res 34:21 Hit: Add type annotation {"start": {"line": 34, "character": 24}, "end": {"line": 34, "character": 24}} newText: <--here : int -Xform src/Xform.res 38:5 +Xform document/src/Xform.res 38:5 -Xform src/Xform.res 41:9 +Xform document/src/Xform.res 41:9 Hit: Add type annotation {"start": {"line": 41, "character": 11}, "end": {"line": 41, "character": 11}} newText: <--here : int -Xform src/Xform.res 48:21 +Xform document/src/Xform.res 48:21 Hit: Add braces to function {"start": {"line": 48, "character": 0}, "end": {"line": 48, "character": 25}} newText: @@ -75,7 +75,7 @@ let noBraces = () => { name } -Xform src/Xform.res 52:34 +Xform document/src/Xform.res 52:34 Hit: Add braces to function {"start": {"line": 51, "character": 0}, "end": {"line": 54, "character": 1}} newText: @@ -87,7 +87,7 @@ let nested = () => { // ^xfm } -Xform src/Xform.res 62:6 +Xform document/src/Xform.res 62:6 Hit: Add braces to function {"start": {"line": 58, "character": 4}, "end": {"line": 62, "character": 7}} newText: diff --git a/analysis/tests/src/expected/Debug.res.txt b/analysis/tests/src/expected/Debug.res.txt deleted file mode 100644 index a95597eae..000000000 --- a/analysis/tests/src/expected/Debug.res.txt +++ /dev/null @@ -1,96 +0,0 @@ - -Definition src/Debug.res 1:20 -Dependencies: @rescript/react -Source directories: ./node_modules/@rescript/react/src ./node_modules/@rescript/react/src/legacy -Source files: ./node_modules/@rescript/react/src/React.res ./node_modules/@rescript/react/src/ReactDOM.res ./node_modules/@rescript/react/src/ReactDOMServer.res ./node_modules/@rescript/react/src/ReactDOMStyle.res ./node_modules/@rescript/react/src/ReactEvent.res ./node_modules/@rescript/react/src/ReactEvent.resi ./node_modules/@rescript/react/src/ReactTestUtils.res ./node_modules/@rescript/react/src/ReactTestUtils.resi ./node_modules/@rescript/react/src/RescriptReactErrorBoundary.res ./node_modules/@rescript/react/src/RescriptReactErrorBoundary.resi ./node_modules/@rescript/react/src/RescriptReactRouter.res ./node_modules/@rescript/react/src/RescriptReactRouter.resi ./node_modules/@rescript/react/src/legacy/ReactDOMRe.res ./node_modules/@rescript/react/src/legacy/ReasonReact.res -Source directories: ./src ./src/expected -Source files: ./src/Auto.res ./src/CodeLens.res ./src/CompletePrioritize1.res ./src/CompletePrioritize2.res ./src/Completion.res ./src/Component.res ./src/Component.resi ./src/CreateInterface.res ./src/Cross.res ./src/Dce.res ./src/Debug.res ./src/Definition.res ./src/DefinitionWithInterface.res ./src/DefinitionWithInterface.resi ./src/Div.res ./src/DocumentSymbol.res ./src/Fragment.res ./src/Highlight.res ./src/Hover.res ./src/InlayHint.res ./src/Jsx.res ./src/Jsx.resi ./src/LongIdentTest.res ./src/Object.res ./src/Patterns.res ./src/RecModules.res ./src/RecordCompletion.res ./src/RecoveryOnProp.res ./src/References.res ./src/ReferencesWithInterface.res ./src/ReferencesWithInterface.resi ./src/Rename.res ./src/RenameWithInterface.res ./src/RenameWithInterface.resi ./src/TableclothMap.ml ./src/TableclothMap.mli ./src/TypeDefinition.res ./src/Xform.res -Impl cmt:./lib/bs/src/Auto.cmt res:./src/Auto.res -Impl cmt:./lib/bs/src/CodeLens.cmt res:./src/CodeLens.res -Impl cmt:./lib/bs/src/CompletePrioritize1.cmt res:./src/CompletePrioritize1.res -Impl cmt:./lib/bs/src/CompletePrioritize2.cmt res:./src/CompletePrioritize2.res -Impl cmt:./lib/bs/src/Completion.cmt res:./src/Completion.res -IntfAndImpl cmti:./lib/bs/src/Component.cmti resi:./src/Component.resi cmt:./lib/bs/src/Component.cmt res:./src/Component.res -Impl cmt:./lib/bs/src/CreateInterface.cmt res:./src/CreateInterface.res -Impl cmt:./lib/bs/src/Cross.cmt res:./src/Cross.res -Impl cmt:./lib/bs/src/Dce.cmt res:./src/Dce.res -Impl cmt:./lib/bs/src/Debug.cmt res:./src/Debug.res -Impl cmt:./lib/bs/src/Definition.cmt res:./src/Definition.res -IntfAndImpl cmti:./lib/bs/src/DefinitionWithInterface.cmti resi:./src/DefinitionWithInterface.resi cmt:./lib/bs/src/DefinitionWithInterface.cmt res:./src/DefinitionWithInterface.res -Impl cmt:./lib/bs/src/Div.cmt res:./src/Div.res -Impl cmt:./lib/bs/src/DocumentSymbol.cmt res:./src/DocumentSymbol.res -Impl cmt:./lib/bs/src/Fragment.cmt res:./src/Fragment.res -Impl cmt:./lib/bs/src/Highlight.cmt res:./src/Highlight.res -Impl cmt:./lib/bs/src/Hover.cmt res:./src/Hover.res -Impl cmt:./lib/bs/src/InlayHint.cmt res:./src/InlayHint.res -IntfAndImpl cmti:./lib/bs/src/Jsx.cmti resi:./src/Jsx.resi cmt:./lib/bs/src/Jsx.cmt res:./src/Jsx.res -Impl cmt:./lib/bs/src/LongIdentTest.cmt res:./src/LongIdentTest.res -Impl cmt:./lib/bs/src/Object.cmt res:./src/Object.res -Impl cmt:./lib/bs/src/Patterns.cmt res:./src/Patterns.res -Impl cmt:./lib/bs/src/RecModules.cmt res:./src/RecModules.res -Impl cmt:./lib/bs/src/RecordCompletion.cmt res:./src/RecordCompletion.res -Impl cmt:./lib/bs/src/RecoveryOnProp.cmt res:./src/RecoveryOnProp.res -Impl cmt:./lib/bs/src/References.cmt res:./src/References.res -IntfAndImpl cmti:./lib/bs/src/ReferencesWithInterface.cmti resi:./src/ReferencesWithInterface.resi cmt:./lib/bs/src/ReferencesWithInterface.cmt res:./src/ReferencesWithInterface.res -Impl cmt:./lib/bs/src/Rename.cmt res:./src/Rename.res -IntfAndImpl cmti:./lib/bs/src/RenameWithInterface.cmti resi:./src/RenameWithInterface.resi cmt:./lib/bs/src/RenameWithInterface.cmt res:./src/RenameWithInterface.res -IntfAndImpl cmti:./lib/bs/src/TableclothMap.cmti resi:./src/TableclothMap.mli cmt:./lib/bs/src/TableclothMap.cmt res:./src/TableclothMap.ml -Impl cmt:./lib/bs/src/TypeDefinition.cmt res:./src/TypeDefinition.res -Impl cmt:./lib/bs/src/Xform.cmt res:./src/Xform.res -Dependency dirs: ./node_modules/@rescript/react/lib/bs/src ./node_modules/@rescript/react/lib/bs/src/legacy -Opens from bsconfig: -locItems: - 1:18-1:21 Typed map (Belt.List.t<'a>, 'a => 'b) => Belt.List.t<'b> GlobalReference -[ref] Typed GlobalReference moduleName:Belt path:List.map tip:Value -fileForModule Impl cmt:./node_modules/rescript/lib/ocaml/belt.cmt res:./node_modules/rescript/lib/ocaml/belt.ml -resolvePath path:List.map -resolvePath Global path:map module:Belt_List -fileForModule Impl cmt:./node_modules/rescript/lib/ocaml/belt_List.cmti res:./node_modules/rescript/lib/ocaml/belt_List.mli -resolvePath path:map -[ref] resolved path:map -[ref] Got stamp 1024 -[ref] alternateDeclared for Belt_List not found -[ref] Inner uri belt_List.mli -{"uri": "belt_List.mli", "range": {"start": {"line": 245, "character": 4}, "end": {"line": 245, "character": 7}}} - -Definition src/Debug.res 4:14 -locItems: - 4:13-4:16 Typed map ('a => 'b, list<'a>) => list<'b> GlobalReference -[ref] Typed GlobalReference moduleName:List path:map tip:Value -fileForModule Impl cmt:./node_modules/rescript/lib/ocaml/list.cmti res:./node_modules/rescript/lib/ocaml/list.mli -resolvePath path:map -[ref] resolved path:map -[ref] Got stamp 1018 -[ref] alternateDeclared for List not found -[ref] Inner uri list.mli -{"uri": "list.mli", "range": {"start": {"line": 116, "character": 4}, "end": {"line": 116, "character": 7}}} - -Complete src/Debug.res 13:8 -posCursor:[13:8] posNoWhite:[13:7] Found expr:[13:5->13:8] -Pexp_ident eqN:[13:5->13:8] -Completable: Cpath Value[eqN] -Raw ppens: 1 Js.place holder -Package opens -resolving open Js.place holder -resolvePath path:Js.place holder -Not local -fileForModule Impl cmt:./node_modules/rescript/lib/ocaml/js.cmt res:./node_modules/rescript/lib/ocaml/js.ml -resolvePath path:place holder -Resolved opens 1 js.ml -findLocalCompletionsWithOpens uri:Debug.res pos:13:8 -findAllCompletions uri:js.ml -[{ - "label": "eqNullable", - "kind": 12, - "tags": [], - "detail": "('a, nullable<'a>) => bool", - "documentation": null - }, { - "label": "eqNull", - "kind": 12, - "tags": [], - "detail": "('a, null<'a>) => bool", - "documentation": null - }] - - diff --git a/analysis/tests/src/expected/LongIdentTest.res.txt b/analysis/tests/src/expected/LongIdentTest.res.txt deleted file mode 100644 index fd8238152..000000000 --- a/analysis/tests/src/expected/LongIdentTest.res.txt +++ /dev/null @@ -1,3 +0,0 @@ -Hover src/LongIdentTest.res 2:13 -{"contents": "```rescript\nint\n```"} - diff --git a/analysis/tests/test.sh b/analysis/tests/test.sh index c931641e9..439b0e051 100755 --- a/analysis/tests/test.sh +++ b/analysis/tests/test.sh @@ -1,4 +1,4 @@ -for file in src/*.{res,resi}; do +for file in document/src/*.{res,resi}; do output="$(dirname $file)/expected/$(basename $file).txt" ../rescript-editor-analysis.exe test $file &> $output # CI. We use LF, and the CI OCaml fork prints CRLF. Convert. @@ -7,7 +7,7 @@ for file in src/*.{res,resi}; do fi done -for file in not_compiled/*.res; do +for file in document/not_compiled/*.res; do output="$(dirname $file)/expected/$(basename $file).txt" ../rescript-editor-analysis.exe test $file &> $output # CI. We use LF, and the CI OCaml fork prints CRLF. Convert. @@ -16,15 +16,24 @@ for file in not_compiled/*.res; do fi done +# Workspaces tests +output="workspaceSymbols/expected/workspaceSymbols.txt" +../rescript-editor-analysis.exe workspaceSymbols workspaceSymbols/ &> $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 +fi + + warningYellow='\033[0;33m' successGreen='\033[0;32m' reset='\033[0m' -diff=$(git ls-files --modified src/expected) +diff=$(git ls-files --modified document/src/expected workspaceSymbols/expected) if [[ $diff = "" ]]; then printf "${successGreen}✅ No unstaged tests difference.${reset}\n" else printf "${warningYellow}⚠️ There are unstaged differences in tests/! Did you break a test?\n${diff}\n${reset}" - git --no-pager diff src/expected + git --no-pager diff document/src/expected workspaceSymbols/expected exit 1 fi diff --git a/analysis/tests/workspaceSymbols/Makefile b/analysis/tests/workspaceSymbols/Makefile new file mode 100644 index 000000000..d355dec33 --- /dev/null +++ b/analysis/tests/workspaceSymbols/Makefile @@ -0,0 +1,14 @@ +SHELL = /bin/bash + +build: node_modules/.bin/rescript + node_modules/.bin/rescript + +install: node_modules/.bin/rescript + +node_modules/.bin/rescript: + npm install + +clean: + rm -rf node_modules lib + +.PHONY: clean build \ No newline at end of file diff --git a/analysis/tests/workspaceSymbols/bsconfig.json b/analysis/tests/workspaceSymbols/bsconfig.json new file mode 100644 index 000000000..2938b33b5 --- /dev/null +++ b/analysis/tests/workspaceSymbols/bsconfig.json @@ -0,0 +1,15 @@ +{ + "name": "test-workspace-symbol", + "sources": [ + { + "dir": "src", + "subdirs": true + }, + { + "dir": "sec", + "subdirs": true + } + ], + "bsc-flags": ["-w -33-44"] + } + \ No newline at end of file diff --git a/analysis/tests/workspaceSymbols/expected/workspaceSymbols.txt b/analysis/tests/workspaceSymbols/expected/workspaceSymbols.txt new file mode 100644 index 000000000..5c08c930e --- /dev/null +++ b/analysis/tests/workspaceSymbols/expected/workspaceSymbols.txt @@ -0,0 +1,13 @@ +[{ + "name": "Inner", + "kind": 2, + "location": {"uri": "file://workspaceSymbols/src/inner/Inner.res", "range": {"start": {"line": 0, "character": 7}, "end": {"line": 2, "character": 1}}} +}, { + "name": "a", + "kind": 16, + "location": {"uri": "file://workspaceSymbols/src/inner/Inner.res", "range": {"start": {"line": 1, "character": 1}, "end": {"line": 1, "character": 10}}} +}, { + "name": "aaababab", + "kind": 16, + "location": {"uri": "file://workspaceSymbols/sec/SomeFile.res", "range": {"start": {"line": 0, "character": 0}, "end": {"line": 0, "character": 17}}} +}] diff --git a/analysis/tests/workspaceSymbols/package-lock.json b/analysis/tests/workspaceSymbols/package-lock.json new file mode 100644 index 000000000..98b0467f4 --- /dev/null +++ b/analysis/tests/workspaceSymbols/package-lock.json @@ -0,0 +1,31 @@ +{ + "name": "workspaceSymbols", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "dependencies": { + "rescript": "^10.0.0-beta.3" + } + }, + "node_modules/rescript": { + "version": "10.0.0-rc.1", + "resolved": "https://registry.npmjs.org/rescript/-/rescript-10.0.0-rc.1.tgz", + "integrity": "sha512-NrB+hr1TcK7ZORw/wu6eAd5J4tu6PwbN5rmcx8NUiVYpuaPAXmX/4DpC0gV2j86cU2QGK/DrEIWeZlchWNDKWg==", + "hasInstallScript": true, + "bin": { + "bsc": "bsc", + "bsrefmt": "bsrefmt", + "bstracing": "lib/bstracing", + "rescript": "rescript" + } + } + }, + "dependencies": { + "rescript": { + "version": "10.0.0-rc.1", + "resolved": "https://registry.npmjs.org/rescript/-/rescript-10.0.0-rc.1.tgz", + "integrity": "sha512-NrB+hr1TcK7ZORw/wu6eAd5J4tu6PwbN5rmcx8NUiVYpuaPAXmX/4DpC0gV2j86cU2QGK/DrEIWeZlchWNDKWg==" + } + } +} diff --git a/analysis/tests/workspaceSymbols/package.json b/analysis/tests/workspaceSymbols/package.json new file mode 100644 index 000000000..0a79d3c14 --- /dev/null +++ b/analysis/tests/workspaceSymbols/package.json @@ -0,0 +1,10 @@ +{ + "scripts": { + "build": "rescript", + "clean": "rescript clean -with-deps" + }, + "private": true, + "dependencies": { + "rescript": "^10.0.0-beta.3" + } +} diff --git a/analysis/tests/workspaceSymbols/sec/SomeFile.res b/analysis/tests/workspaceSymbols/sec/SomeFile.res new file mode 100644 index 000000000..1d1447d94 --- /dev/null +++ b/analysis/tests/workspaceSymbols/sec/SomeFile.res @@ -0,0 +1 @@ +let aaababab = 12 \ No newline at end of file diff --git a/analysis/tests/workspaceSymbols/src/inner/Inner.res b/analysis/tests/workspaceSymbols/src/inner/Inner.res new file mode 100644 index 000000000..f3222e576 --- /dev/null +++ b/analysis/tests/workspaceSymbols/src/inner/Inner.res @@ -0,0 +1,3 @@ +module Inner = { + let a = 2 +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 91d42ef88..7926edc07 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,7 +5,6 @@ "requires": true, "packages": { "": { - "name": "rescript-vscode", "version": "1.4.2", "hasInstallScript": true, "license": "MIT", diff --git a/package.json b/package.json index 6227aef59..940d56b9b 100644 --- a/package.json +++ b/package.json @@ -194,7 +194,7 @@ "vscode:prepublish": "npm run clean && npm run compile", "compile": "tsc -b", "watch": "tsc -b -w", - "postinstall": "cd server && npm i && cd ../client && npm i && cd ../analysis/tests && npm i && cd ../reanalyze/examples/deadcode && npm i && cd ../termination && npm i" + "postinstall": "cd server && npm i && cd ../client && npm i && cd ../analysis/reanalyze/examples/deadcode && npm i && cd ../termination && npm i" }, "devDependencies": { "@types/node": "^14.14.41", diff --git a/server/src/server.ts b/server/src/server.ts index 76c78e0b7..02432d5ab 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -11,6 +11,7 @@ import { DidCloseTextDocumentNotification, DidChangeConfigurationNotification, InitializeParams, + WorkspaceSymbol, InlayHintParams, CodeLensParams, } from "vscode-languageserver-protocol"; @@ -569,6 +570,20 @@ function documentSymbol(msg: p.RequestMessage) { return response; } +function workspaceSymbol(msg: p.RequestMessage) { + // https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_symbol + let result: p.WorkspaceSymbol[] | null = utils.runAnalysis( + ["workspaceSymbols", process.cwd()], + ); + + let response: p.ResponseMessage = { + jsonrpc: c.jsonrpcVersion, + id: msg.id, + result + }; + return response; +} + function askForAllCurrentConfiguration() { // https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_configuration let params: p.ConfigurationParams = { @@ -1016,6 +1031,7 @@ function onMessage(msg: p.Message) { codeActionProvider: true, renameProvider: { prepareProvider: true }, documentSymbolProvider: true, + workspaceSymbolProvider: true, completionProvider: { triggerCharacters: [".", ">", "@", "~", '"'] }, semanticTokensProvider: { legend: { @@ -1120,6 +1136,8 @@ function onMessage(msg: p.Message) { send(createInterface(msg)); } else if (msg.method === openCompiledFileRequest.method) { send(openCompiledFile(msg)); + } else if (msg.method === p.WorkspaceSymbolRequest.method) { + send(workspaceSymbol(msg)) } else if (msg.method === p.InlayHintRequest.method) { let params = msg.params as InlayHintParams; let extName = path.extname(params.textDocument.uri); diff --git a/server/src/utils.ts b/server/src/utils.ts index e5ec43b8e..63a9e3ebf 100644 --- a/server/src/utils.ts +++ b/server/src/utils.ts @@ -14,6 +14,16 @@ import * as os from "os"; let tempFilePrefix = "rescript_format_file_" + process.pid + "_"; let tempFileId = 0; +let getAnalysisBinaryPath = (): string | null => { + if (fs.existsSync(c.analysisDevPath)) { + return c.analysisDevPath; + } else if (fs.existsSync(c.analysisProdPath)) { + return c.analysisProdPath; + } else { + return null; + } +}; + export let createFileInTempDir = (extension = "") => { let tempFileName = tempFilePrefix + tempFileId + extension; tempFileId = tempFileId + 1; @@ -129,31 +139,32 @@ export let formatCode = ( } }; +export let runAnalysis = (args: Array, cwd?: string) => { + let binaryPath = getAnalysisBinaryPath() + + if (binaryPath == null) { + return null + } + + let options: childProcess.ExecFileSyncOptions = { + cwd: cwd, + maxBuffer: Infinity, + }; + let stdout = childProcess.execFileSync(binaryPath, args, options); + + return JSON.parse(stdout.toString()); +}; + export let runAnalysisAfterSanityCheck = ( filePath: p.DocumentUri, args: Array, projectRequired = false ) => { - let binaryPath; - if (fs.existsSync(c.analysisDevPath)) { - binaryPath = c.analysisDevPath; - } else if (fs.existsSync(c.analysisProdPath)) { - binaryPath = c.analysisProdPath; - } else { - return null; - } - let projectRootPath = findProjectRootOfFile(filePath); if (projectRootPath == null && projectRequired) { return null; } - let options: childProcess.ExecFileSyncOptions = { - cwd: projectRootPath || undefined, - maxBuffer: Infinity, - }; - let stdout = childProcess.execFileSync(binaryPath, args, options); - - return JSON.parse(stdout.toString()); + return runAnalysis(args, projectRootPath == null ? undefined : projectRootPath) }; export let runAnalysisCommand = (