diff --git a/CHANGELOG.md b/CHANGELOG.md index 41775d9a98..0b51925e8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ # 12.0.0-alpha.8 (Unreleased) +#### :bug: Bug fix + +- Editor: Fix issue where pipe completions would not trigger with generic type arguments. https://github.com/rescript-lang/rescript/pull/7231 + # 12.0.0-alpha.7 #### :bug: Bug fix diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 64d0651435..392a4430d9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -119,7 +119,19 @@ After adding a new file to the repository that should go into the npm package - ```sh make lib # Build compiler and standard library -./bsc myTestFile.res +./cli/bsc myTestFile.res +``` + +To view the untyped tree of the file run: + +```sh +./cli/bsc -dparsetree myTestFile.res +``` + +To view the typed tree of the file run: + +```sh +./cli/bsc -dtypedtree myTestFile.res ``` ### Project diff --git a/analysis/README.md b/analysis/README.md index 255c185726..a498ea5dce 100644 --- a/analysis/README.md +++ b/analysis/README.md @@ -16,6 +16,12 @@ See main CONTRIBUTING.md's repo structure. Additionally, `examples/` is a conven dune exec -- rescript-editor-analysis --help ``` +Add verbose logging via: + +```shell +dune exec -- rescript-editor-analysis debug-dump verbose test +``` + ## History This project is based on a fork of [Reason Language Server](https://github.com/jaredly/reason-language-server). diff --git a/analysis/src/TypeUtils.ml b/analysis/src/TypeUtils.ml index 491df9accb..3942aae2fe 100644 --- a/analysis/src/TypeUtils.ml +++ b/analysis/src/TypeUtils.ml @@ -270,7 +270,7 @@ let extractFunctionTypeWithEnv ~env ~package typ = | Tconstr (path, typeArgs, _) -> ( match References.digConstructor ~env ~package path with | Some - ( env, + ( _env, { item = {decl = {type_manifest = Some t1; type_params = typeParams}}; } ) -> diff --git a/tests/analysis_tests/tests/package-lock.json b/tests/analysis_tests/tests/package-lock.json index 7a51892b94..d6864a9574 100644 --- a/tests/analysis_tests/tests/package-lock.json +++ b/tests/analysis_tests/tests/package-lock.json @@ -33,7 +33,7 @@ } }, "../../..": { - "version": "12.0.0-alpha.7", + "version": "12.0.0-alpha.8", "hasInstallScript": true, "license": "SEE LICENSE IN LICENSE", "bin": { diff --git a/tests/analysis_tests/tests/src/Firebase.res b/tests/analysis_tests/tests/src/Firebase.res new file mode 100644 index 0000000000..dae1130b07 --- /dev/null +++ b/tests/analysis_tests/tests/src/Firebase.res @@ -0,0 +1,33 @@ +module Firebase = { + module Firestore = { + type firestore + + type documentReference<'documentdata> = { + id: string, + path: string, + } + + type documentSnapshot<'documentdata> = { + id: string, + ref: documentReference<'documentdata>, + } + + @module("firebase/firestore") @variadic + external doc: (firestore, string, array) => documentReference<'documentdata> = "doc" + + @module("firebase/firestore") + external getDoc: documentReference<'documentdata> => Promise.t< + documentSnapshot<'documentdata>, + > = "getDoc" + } +} + +module Sample = { + open Firebase + + external store: Firestore.firestore = "store" + + let ref = store->Firestore.doc("some_id", []) + // ref. + // ^com +} diff --git a/tests/analysis_tests/tests/src/expected/Firebase.res.txt b/tests/analysis_tests/tests/src/expected/Firebase.res.txt new file mode 100644 index 0000000000..a6f55d6451 --- /dev/null +++ b/tests/analysis_tests/tests/src/expected/Firebase.res.txt @@ -0,0 +1,41 @@ +Complete src/Firebase.res 30:9 +posCursor:[30:9] posNoWhite:[30:8] Found expr:[30:5->30:9] +Pexp_field [30:5->30:8] _:[32:0->30:9] +Completable: Cpath Value[ref]."" +Raw opens: 1 Firebase.place holder +Package opens Pervasives.JsxModules.place holder +Resolved opens 1 Firebase +ContextPath Value[ref]."" +ContextPath Value[ref] +Path ref +ContextPath Value[ref]-> +ContextPath Value[ref] +Path ref +CPPipe pathFromEnv:Firebase.Firestore found:true +Path Firebase.Firestore. +[{ + "label": "id", + "kind": 5, + "tags": [], + "detail": "string", + "documentation": {"kind": "markdown", "value": "```rescript\nid: string\n```\n\n```rescript\ntype documentReference<'documentdata> = {\n id: string,\n path: string,\n}\n```"} + }, { + "label": "path", + "kind": 5, + "tags": [], + "detail": "string", + "documentation": {"kind": "markdown", "value": "```rescript\npath: string\n```\n\n```rescript\ntype documentReference<'documentdata> = {\n id: string,\n path: string,\n}\n```"} + }, { + "label": "->Firestore.getDoc", + "kind": 12, + "tags": [], + "detail": "documentReference<\n 'documentdata,\n> => Promise.t>", + "documentation": null, + "sortText": "getDoc", + "insertText": "->Firestore.getDoc", + "additionalTextEdits": [{ + "range": {"start": {"line": 30, "character": 8}, "end": {"line": 30, "character": 9}}, + "newText": "" + }] + }] +