diff --git a/CHANGELOG.md b/CHANGELOG.md index d2f0743c2..8b23c91d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ - Fix bug where type args stopped working in some completions when passed through inline records. https://github.com/rescript-lang/rescript-vscode/pull/1064 - Fix bug where objects weren't actually iterated on, making completions inside of them not work. https://github.com/rescript-lang/rescript-vscode/pull/1065 +- Fix bug where pipe completions would not trigger with generic type arguments. https://github.com/rescript-lang/rescript-vscode/pull/1067 ## 1.60.0 diff --git a/analysis/src/TypeUtils.ml b/analysis/src/TypeUtils.ml index e21433aac..5c33f0f7f 100644 --- a/analysis/src/TypeUtils.ml +++ b/analysis/src/TypeUtils.ml @@ -275,7 +275,7 @@ let rec 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/analysis/tests/src/Firebase.res b/analysis/tests/src/Firebase.res new file mode 100644 index 000000000..53e8d84c0 --- /dev/null +++ b/analysis/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> => Js.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/analysis/tests/src/expected/Firebase.res.txt b/analysis/tests/src/expected/Firebase.res.txt new file mode 100644 index 000000000..bedc7d15a --- /dev/null +++ b/analysis/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 2 pervasives Firebase.res +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> => Js.Promise.t>", + "documentation": null, + "sortText": "getDoc", + "insertText": "->Firestore.getDoc", + "additionalTextEdits": [{ + "range": {"start": {"line": 30, "character": 8}, "end": {"line": 30, "character": 9}}, + "newText": "" + }] + }] +