From 89a6c8f0ec75323d3e1544acd901d94458553815 Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Fri, 15 Dec 2023 11:10:49 +0100 Subject: [PATCH 1/3] look up and propagate ReScript version to analysis so we can default uncurried by default properly --- analysis/src/Packages.ml | 22 +++++- analysis/src/SharedTypes.ml | 1 + .../tests/src/expected/Completion.res.txt | 26 ++++--- .../CompletionFunctionArguments.res.txt | 2 + .../expected/CompletionInferValues.res.txt | 15 ++++- .../tests/src/expected/CompletionJsx.res.txt | 8 +++ .../src/expected/CompletionPipeChain.res.txt | 2 + .../tests/src/expected/Definition.res.txt | 2 +- .../tests/src/expected/Destructuring.res.txt | 2 + analysis/tests/src/expected/Hover.res.txt | 8 +-- .../tests/src/expected/SignatureHelp.res.txt | 67 +++++++++---------- analysis/tests/src/expected/Xform.res.txt | 1 + server/src/utils.ts | 28 ++++++++ 13 files changed, 131 insertions(+), 53 deletions(-) diff --git a/analysis/src/Packages.ml b/analysis/src/Packages.ml index ae0ea1e7a..b330eac99 100644 --- a/analysis/src/Packages.ml +++ b/analysis/src/Packages.ml @@ -11,6 +11,22 @@ let makePathsForModule ~projectFilesAndPaths ~dependenciesFilesAndPaths = Hashtbl.replace pathsForModule modName paths); pathsForModule +let getReScriptVersion () = + (* TODO: Include patch stuff when needed *) + let defaultVersion = (10, 1) in + try + let value = Sys.getenv "RESCRIPT_VERSION" in + let version = + match value |> String.split_on_char '.' with + | major :: minor :: _rest -> ( + match (int_of_string_opt major, int_of_string_opt minor) with + | Some major, Some minor -> (major, minor) + | _ -> defaultVersion) + | _ -> defaultVersion + in + version + with Not_found -> defaultVersion + let newBsPackage ~rootPath = let rescriptJson = Filename.concat rootPath "rescript.json" in let bsconfigJson = Filename.concat rootPath "bsconfig.json" in @@ -27,9 +43,12 @@ let newBsPackage ~rootPath = | Some libBs -> Some (let namespace = FindFiles.getNamespace config in + let rescriptVersion = getReScriptVersion () in let uncurried = let ns = config |> Json.get "uncurried" in - Option.bind ns Json.bool + match (rescriptVersion, ns) with + | (major, _), None when major >= 11 -> Some true + | _, ns -> Option.bind ns Json.bool in let uncurried = uncurried = Some true in let sourceDirectories = @@ -93,6 +112,7 @@ let newBsPackage ~rootPath = ("Opens from ReScript config file: " ^ (opens |> List.map pathToString |> String.concat " ")); { + rescriptVersion; rootPath; projectFiles = projectFilesAndPaths |> List.map fst |> FileSet.of_list; diff --git a/analysis/src/SharedTypes.ml b/analysis/src/SharedTypes.ml index 5cbbce741..7917509f0 100644 --- a/analysis/src/SharedTypes.ml +++ b/analysis/src/SharedTypes.ml @@ -493,6 +493,7 @@ type package = { builtInCompletionModules: builtInCompletionModules; opens: path list; uncurried: bool; + rescriptVersion: int * int; } let allFilesInPackage package = diff --git a/analysis/tests/src/expected/Completion.res.txt b/analysis/tests/src/expected/Completion.res.txt index 95c71aeb6..f1c0a5d66 100644 --- a/analysis/tests/src/expected/Completion.res.txt +++ b/analysis/tests/src/expected/Completion.res.txt @@ -28,7 +28,7 @@ Path MyList.m "label": "mapReverse2U", "kind": 12, "tags": [], - "detail": "(t<'a>, t<'b>, (. 'a, 'b) => 'c) => t<'c>", + "detail": "(t<'a>, t<'b>, ('a, 'b) => 'c) => t<'c>", "documentation": {"kind": "markdown", "value": " Uncurried version of [mapReverse2](#mapReverse2). "} }, { "label": "map", @@ -40,19 +40,19 @@ Path MyList.m "label": "mapWithIndexU", "kind": 12, "tags": [], - "detail": "(t<'a>, (. int, 'a) => 'b) => t<'b>", + "detail": "(t<'a>, (int, 'a) => 'b) => t<'b>", "documentation": {"kind": "markdown", "value": " Uncurried version of [mapWithIndex](#mapWithIndex). "} }, { "label": "mapU", "kind": 12, "tags": [], - "detail": "(t<'a>, (. 'a) => 'b) => t<'b>", + "detail": "(t<'a>, 'a => 'b) => t<'b>", "documentation": {"kind": "markdown", "value": " Uncurried version of [map](#map). "} }, { "label": "makeByU", "kind": 12, "tags": [], - "detail": "(int, (. int) => 'a) => t<'a>", + "detail": "(int, int => 'a) => t<'a>", "documentation": {"kind": "markdown", "value": " Uncurried version of [makeBy](#makeBy) "} }, { "label": "mapReverse2", @@ -70,7 +70,7 @@ Path MyList.m "label": "mapReverseU", "kind": 12, "tags": [], - "detail": "(t<'a>, (. 'a) => 'b) => t<'b>", + "detail": "(t<'a>, 'a => 'b) => t<'b>", "documentation": {"kind": "markdown", "value": " Uncurried version of [mapReverse](#mapReverse). "} }] @@ -451,7 +451,7 @@ Path Belt.Option.e "label": "Belt.Option.eqU", "kind": 12, "tags": [], - "detail": "(option<'a>, option<'b>, (. 'a, 'b) => bool) => bool", + "detail": "(option<'a>, option<'b>, ('a, 'b) => bool) => bool", "documentation": {"kind": "markdown", "value": "\n Uncurried version of `eq`\n"} }, { "label": "Belt.Option.eq", @@ -508,7 +508,7 @@ Path Js.Dict.u "label": "unsafeDeleteKey", "kind": 12, "tags": [], - "detail": "(. t, string) => unit", + "detail": "(t, string) => unit", "documentation": {"kind": "markdown", "value": " Experimental internal function "} }] @@ -765,6 +765,7 @@ Path Objects.Rec.recordVal Complete 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:[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] Pexp_ident my:[120:5->120:7] @@ -1285,6 +1286,7 @@ Path SomeLocal Complete 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:[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] Pexp_ident _w:[275:13->275:15] @@ -1630,6 +1632,7 @@ 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] posCursor:[336:26] posNoWhite:[336:25] Found expr:[334:13->338:6] +posCursor:[336:26] posNoWhite:[336:25] Found expr:[334:13->338:6] posCursor:[336:26] posNoWhite:[336:25] Found expr:[335:6->338:5] posCursor:[336:26] posNoWhite:[336:25] Found expr:[336:16->338:5] posCursor:[336:26] posNoWhite:[336:25] Found pattern:[336:20->338:5] @@ -1731,6 +1734,7 @@ posCursor:[355:23] posNoWhite:[355:22] Found expr:[355:12->355:23] Complete 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:[360:8->365:3] posCursor:[362:8] posNoWhite:[362:7] Found pattern:[362:7->364:5] posCursor:[362:8] posNoWhite:[362:7] Found pattern:[362:7->362:8] Ppat_construct T:[362:7->362:8] @@ -1780,6 +1784,7 @@ Path T Complete 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:[371:8->376:3] posCursor:[373:21] posNoWhite:[373:20] Found pattern:[373:7->375:5] posCursor:[373:21] posNoWhite:[373:20] Found pattern:[373:7->373:21] Ppat_construct AndThatOther.T:[373:7->373:21] @@ -1882,6 +1887,7 @@ Path funRecord Complete 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:[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] posCursor:[389:12] posNoWhite:[389:11] Found expr:[389:6->389:12] @@ -1985,6 +1991,7 @@ Path r Complete src/Completion.res 409:21 posCursor:[409:21] posNoWhite:[409:20] Found expr:[408:14->415:1] +posCursor:[409:21] posNoWhite:[409:20] Found expr:[408:14->415:1] posCursor:[409:21] posNoWhite:[409:20] Found expr:[409:5->414:17] posCursor:[409:21] posNoWhite:[409:20] Found expr:[409:5->411:42] posCursor:[409:21] posNoWhite:[409:20] Found expr:[409:5->411:5] @@ -2011,6 +2018,7 @@ Path SomeLocalModule. Complete src/Completion.res 412:21 posCursor:[412:21] posNoWhite:[412:20] Found expr:[408:14->415:1] +posCursor:[412:21] posNoWhite:[412:20] Found expr:[408:14->415:1] posCursor:[412:21] posNoWhite:[412:20] Found expr:[411:2->414:17] posCursor:[412:21] posNoWhite:[412:20] Found expr:[412:5->414:17] Pexp_apply ...[412:5->414:8] (...[414:9->414:16]) @@ -2196,13 +2204,13 @@ Resolved opens 3 pervasives Completion.res Completion.res ContextPath Type[withUncurried] Path withUncurried [{ - "label": "(. v) => {}", + "label": "v => {}", "kind": 12, "tags": [], "detail": "int => unit", "documentation": null, "sortText": "A", - "insertText": "(. ${1:v}) => {$0}", + "insertText": "${1:v} => {$0}", "insertTextFormat": 2 }] diff --git a/analysis/tests/src/expected/CompletionFunctionArguments.res.txt b/analysis/tests/src/expected/CompletionFunctionArguments.res.txt index d15f00087..7ca6e7bc8 100644 --- a/analysis/tests/src/expected/CompletionFunctionArguments.res.txt +++ b/analysis/tests/src/expected/CompletionFunctionArguments.res.txt @@ -370,6 +370,7 @@ Complete src/CompletionFunctionArguments.res 109:29 posCursor:[109:29] posNoWhite:[109:28] Found expr:[105:3->114:4] JSX 105:6] onMouseDown[106:4->106:15]=...[106:35->113:5]> _children:114:2 posCursor:[109:29] posNoWhite:[109:28] Found expr:[106:35->113:5] +posCursor:[109:29] posNoWhite:[109:28] Found expr:[106:16->113:5] posCursor:[109:29] posNoWhite:[109:28] Found expr:[107:6->109:29] posCursor:[109:29] posNoWhite:[109:28] Found expr:[108:6->109:29] posCursor:[109:29] posNoWhite:[109:28] Found expr:[109:9->109:29] @@ -395,6 +396,7 @@ Complete src/CompletionFunctionArguments.res 111:27 posCursor:[111:27] posNoWhite:[111:26] Found expr:[105:3->114:4] JSX 105:6] onMouseDown[106:4->106:15]=...[106:35->113:5]> _children:114:2 posCursor:[111:27] posNoWhite:[111:26] Found expr:[106:35->113:5] +posCursor:[111:27] posNoWhite:[111:26] Found expr:[106:16->113:5] posCursor:[111:27] posNoWhite:[111:26] Found expr:[107:6->111:27] posCursor:[111:27] posNoWhite:[111:26] Found expr:[108:6->111:27] posCursor:[111:27] posNoWhite:[111:26] Found expr:[111:9->111:27] diff --git a/analysis/tests/src/expected/CompletionInferValues.res.txt b/analysis/tests/src/expected/CompletionInferValues.res.txt index 55b527da6..34004efb5 100644 --- a/analysis/tests/src/expected/CompletionInferValues.res.txt +++ b/analysis/tests/src/expected/CompletionInferValues.res.txt @@ -83,6 +83,7 @@ Complete src/CompletionInferValues.res 24:63 posCursor:[24:63] posNoWhite:[24:62] Found expr:[24:3->24:64] Pexp_apply ...[24:3->24:21] (...[24:22->24:63]) posCursor:[24:63] posNoWhite:[24:62] Found expr:[24:22->24:63] +posCursor:[24:63] posNoWhite:[24:62] Found expr:[24:23->24:63] posCursor:[24:63] posNoWhite:[24:62] Found expr:[24:36->24:63] posCursor:[24:63] posNoWhite:[24:62] Found expr:[24:42->24:63] posCursor:[24:63] posNoWhite:[24:62] Found expr:[24:52->24:63] @@ -115,6 +116,7 @@ Complete src/CompletionInferValues.res 27:90 posCursor:[27:90] posNoWhite:[27:89] Found expr:[27:39->27:91] Pexp_apply ...[27:39->27:48] (...[27:49->27:90]) posCursor:[27:90] posNoWhite:[27:89] Found expr:[27:49->27:90] +posCursor:[27:90] posNoWhite:[27:89] Found expr:[27:50->27:90] posCursor:[27:90] posNoWhite:[27:89] Found expr:[27:56->27:90] posCursor:[27:90] posNoWhite:[27:89] Found expr:[27:69->27:90] posCursor:[27:90] posNoWhite:[27:89] Found expr:[27:79->27:90] @@ -149,6 +151,7 @@ Complete src/CompletionInferValues.res 30:36 posCursor:[30:36] posNoWhite:[30:35] Found expr:[30:3->30:39] Pexp_apply ...[30:3->30:15] (...[30:16->30:38]) posCursor:[30:36] posNoWhite:[30:35] Found expr:[30:16->30:38] +posCursor:[30:36] posNoWhite:[30:35] Found expr:[30:16->30:38] posCursor:[30:36] posNoWhite:[30:35] Found expr:[30:27->30:36] Completable: Cpath Value[event]->pr Package opens Pervasives.JsxModules.place holder @@ -176,6 +179,7 @@ Complete src/CompletionInferValues.res 41:50 posCursor:[41:50] posNoWhite:[41:49] Found expr:[41:12->41:56] JSX 41:15] onMouseEnter[41:16->41:28]=...[41:36->41:52]> _children:41:54 posCursor:[41:50] posNoWhite:[41:49] Found expr:[41:36->41:52] +posCursor:[41:50] posNoWhite:[41:49] Found expr:[41:29->41:52] posCursor:[41:50] posNoWhite:[41:49] Found expr:[41:41->41:50] Completable: Cpath Value[event]->pr <> Package opens Pervasives.JsxModules.place holder @@ -203,6 +207,7 @@ Complete src/CompletionInferValues.res 44:50 posCursor:[44:50] posNoWhite:[44:49] Found expr:[44:12->44:56] JSX 44:15] onMouseEnter[44:16->44:28]=...[44:36->44:52]> _children:44:54 posCursor:[44:50] posNoWhite:[44:49] Found expr:[44:36->44:52] +posCursor:[44:50] posNoWhite:[44:49] Found expr:[44:29->44:52] posCursor:[44:50] posNoWhite:[44:49] Found expr:[44:41->44:50] Completable: Cpath Value[event]->pr <> Package opens Pervasives.JsxModules.place holder @@ -229,6 +234,7 @@ Complete src/CompletionInferValues.res 47:87 posCursor:[47:87] posNoWhite:[47:86] Found expr:[47:12->47:93] JSX 47:15] onMouseEnter[47:16->47:28]=...[47:36->47:89]> _children:47:91 posCursor:[47:87] posNoWhite:[47:86] Found expr:[47:36->47:89] +posCursor:[47:87] posNoWhite:[47:86] Found expr:[47:29->47:89] posCursor:[47:87] posNoWhite:[47:86] Found expr:[47:41->47:87] posCursor:[47:87] posNoWhite:[47:86] Found expr:[47:81->47:87] Completable: Cpath Value[btn]->t <> @@ -240,7 +246,7 @@ Path btn ContextPath Value[JsxEvent, Mouse, button](Nolabel) ContextPath Value[JsxEvent, Mouse, button] Path JsxEvent.Mouse.button -CPPipe env:CompletionInferValues envFromCompletionItem:JsxEventC.Mouse +CPPipe env:CompletionInferValues envFromCompletionItem:JsxEventU.Mouse Path Belt.Int.t [{ "label": "Belt.Int.toString", @@ -260,6 +266,7 @@ Complete src/CompletionInferValues.res 50:108 posCursor:[50:108] posNoWhite:[50:107] Found expr:[50:12->50:114] JSX 50:15] onMouseEnter[50:16->50:28]=...[50:36->50:110]> _children:50:112 posCursor:[50:108] posNoWhite:[50:107] Found expr:[50:36->50:110] +posCursor:[50:108] posNoWhite:[50:107] Found expr:[50:29->50:110] posCursor:[50:108] posNoWhite:[50:107] Found expr:[50:41->50:108] posCursor:[50:108] posNoWhite:[50:107] Found expr:[50:100->50:108] Completable: Cpath Value[btn]->spl <> @@ -303,6 +310,7 @@ Complete src/CompletionInferValues.res 53:130 posCursor:[53:130] posNoWhite:[53:129] Found expr:[53:12->53:136] JSX 53:15] onMouseEnter[53:16->53:28]=...[53:36->53:132]> _children:53:134 posCursor:[53:130] posNoWhite:[53:129] Found expr:[53:36->53:132] +posCursor:[53:130] posNoWhite:[53:129] Found expr:[53:29->53:132] posCursor:[53:130] posNoWhite:[53:129] Found expr:[53:41->53:130] posCursor:[53:130] posNoWhite:[53:129] Found expr:[53:123->53:130] Completable: Cpath Value[btn]->ma <> @@ -679,6 +687,7 @@ Complete src/CompletionInferValues.res 130:26 posCursor:[130:26] posNoWhite:[130:25] Found expr:[130:3->130:37] Pexp_apply ...[130:3->130:23] (...[130:24->130:36]) posCursor:[130:26] posNoWhite:[130:25] Found expr:[130:24->130:36] +posCursor:[130:26] posNoWhite:[130:25] Found expr:[130:25->130:36] posCursor:[130:26] posNoWhite:[130:25] Found pattern:[130:25->130:27] posCursor:[130:26] posNoWhite:[130:25] Found pattern:[130:25->130:27] Completable: Cpattern CArgument CArgument Value[fnWithRecordCallback]($0)($0)->recordBody @@ -706,6 +715,7 @@ Complete src/CompletionInferValues.res 137:30 posCursor:[137:30] posNoWhite:[137:29] Found expr:[137:3->137:33] Pexp_apply ...[137:3->137:6] (~cb137:8->137:10=...[137:11->137:32]) posCursor:[137:30] posNoWhite:[137:29] Found expr:[137:11->137:32] +posCursor:[137:30] posNoWhite:[137:29] Found expr:[137:12->137:32] posCursor:[137:30] posNoWhite:[137:29] Found expr:[137:24->0:-1] posCursor:[137:30] posNoWhite:[137:29] Found expr:[137:24->0:-1] Completable: Cpath Value[root]-> @@ -741,6 +751,7 @@ Complete src/CompletionInferValues.res 146:30 posCursor:[146:30] posNoWhite:[146:29] Found expr:[146:3->146:33] Pexp_apply ...[146:3->146:6] (~cb146:8->146:10=...[146:11->146:32]) posCursor:[146:30] posNoWhite:[146:29] Found expr:[146:11->146:32] +posCursor:[146:30] posNoWhite:[146:29] Found expr:[146:12->146:32] posCursor:[146:30] posNoWhite:[146:29] Found expr:[146:24->0:-1] posCursor:[146:30] posNoWhite:[146:29] Found expr:[146:24->0:-1] Completable: Cpath Value[root]-> @@ -820,6 +831,7 @@ Complete src/CompletionInferValues.res 158:105 posCursor:[158:105] posNoWhite:[158:104] Found expr:[158:18->158:110] Pexp_apply ...[158:18->158:49] (~prepare158:51->158:58=...[158:59->158:72], ~render158:74->158:80=...[158:81->158:106], ...[158:107->158:109]) posCursor:[158:105] posNoWhite:[158:104] Found expr:[158:81->158:106] +posCursor:[158:105] posNoWhite:[158:104] Found expr:[158:82->158:106] posCursor:[158:105] posNoWhite:[158:104] Found expr:[158:97->158:105] Pexp_field [158:97->158:104] _:[158:105->158:105] Completable: Cpath Value[support]."" @@ -845,6 +857,7 @@ Complete src/CompletionInferValues.res 162:110 posCursor:[162:110] posNoWhite:[162:109] Found expr:[162:18->162:115] Pexp_apply ...[162:18->162:49] (~prepare162:51->162:58=...[162:59->162:72], ~render162:74->162:80=...[162:81->162:111], ...[162:112->162:114]) posCursor:[162:110] posNoWhite:[162:109] Found expr:[162:81->162:111] +posCursor:[162:110] posNoWhite:[162:109] Found expr:[162:82->162:111] posCursor:[162:110] posNoWhite:[162:109] Found expr:[162:104->0:-1] posCursor:[162:110] posNoWhite:[162:109] Found expr:[162:104->0:-1] Completable: Cpath Value[root]-> diff --git a/analysis/tests/src/expected/CompletionJsx.res.txt b/analysis/tests/src/expected/CompletionJsx.res.txt index fba67fac1..3d239e202 100644 --- a/analysis/tests/src/expected/CompletionJsx.res.txt +++ b/analysis/tests/src/expected/CompletionJsx.res.txt @@ -24,6 +24,7 @@ Path Js.String2.st Complete src/CompletionJsx.res 13:21 posCursor:[13:21] posNoWhite:[13:20] Found expr:[8:13->33:3] +posCursor:[13:21] posNoWhite:[13:20] Found expr:[8:14->33:3] posCursor:[13:21] posNoWhite:[13:20] Found expr:[9:4->32:10] posCursor:[13:21] posNoWhite:[13:20] Found expr:[10:4->32:10] posCursor:[13:21] posNoWhite:[13:20] Found expr:[11:4->32:10] @@ -62,6 +63,7 @@ Path Js.String2.st Complete src/CompletionJsx.res 18:24 posCursor:[18:24] posNoWhite:[18:23] Found expr:[8:13->33:3] +posCursor:[18:24] posNoWhite:[18:23] Found expr:[8:14->33:3] posCursor:[18:24] posNoWhite:[18:23] Found expr:[9:4->32:10] posCursor:[18:24] posNoWhite:[18:23] Found expr:[10:4->32:10] posCursor:[18:24] posNoWhite:[18:23] Found expr:[11:4->32:10] @@ -110,6 +112,7 @@ Path Js.String2.st Complete src/CompletionJsx.res 20:27 posCursor:[20:27] posNoWhite:[20:26] Found expr:[8:13->33:3] +posCursor:[20:27] posNoWhite:[20:26] Found expr:[8:14->33:3] posCursor:[20:27] posNoWhite:[20:26] Found expr:[9:4->32:10] posCursor:[20:27] posNoWhite:[20:26] Found expr:[10:4->32:10] posCursor:[20:27] posNoWhite:[20:26] Found expr:[11:4->32:10] @@ -157,6 +160,7 @@ Path Js.String2.st Complete src/CompletionJsx.res 22:44 posCursor:[22:44] posNoWhite:[22:43] Found expr:[8:13->33:3] +posCursor:[22:44] posNoWhite:[22:43] Found expr:[8:14->33:3] posCursor:[22:44] posNoWhite:[22:43] Found expr:[9:4->32:10] posCursor:[22:44] posNoWhite:[22:43] Found expr:[10:4->32:10] posCursor:[22:44] posNoWhite:[22:43] Found expr:[11:4->32:10] @@ -206,6 +210,7 @@ Path Js.String2.st Complete src/CompletionJsx.res 24:19 posCursor:[24:19] posNoWhite:[24:18] Found expr:[8:13->33:3] +posCursor:[24:19] posNoWhite:[24:18] Found expr:[8:14->33:3] posCursor:[24:19] posNoWhite:[24:18] Found expr:[9:4->32:10] posCursor:[24:19] posNoWhite:[24:18] Found expr:[10:4->32:10] posCursor:[24:19] posNoWhite:[24:18] Found expr:[11:4->32:10] @@ -290,6 +295,7 @@ Path Belt.Int. Complete src/CompletionJsx.res 26:14 posCursor:[26:14] posNoWhite:[26:13] Found expr:[8:13->33:3] +posCursor:[26:14] posNoWhite:[26:13] Found expr:[8:14->33:3] posCursor:[26:14] posNoWhite:[26:13] Found expr:[9:4->32:10] posCursor:[26:14] posNoWhite:[26:13] Found expr:[10:4->32:10] posCursor:[26:14] posNoWhite:[26:13] Found expr:[11:4->32:10] @@ -373,6 +379,7 @@ Path Belt.Int. Complete src/CompletionJsx.res 28:20 posCursor:[28:20] posNoWhite:[28:19] Found expr:[8:13->33:3] +posCursor:[28:20] posNoWhite:[28:19] Found expr:[8:14->33:3] posCursor:[28:20] posNoWhite:[28:19] Found expr:[9:4->32:10] posCursor:[28:20] posNoWhite:[28:19] Found expr:[10:4->32:10] posCursor:[28:20] posNoWhite:[28:19] Found expr:[11:4->32:10] @@ -415,6 +422,7 @@ Path Js.Array2.a Complete src/CompletionJsx.res 30:12 posCursor:[30:12] posNoWhite:[30:11] Found expr:[8:13->33:3] +posCursor:[30:12] posNoWhite:[30:11] Found expr:[8:14->33:3] posCursor:[30:12] posNoWhite:[30:11] Found expr:[9:4->32:10] posCursor:[30:12] posNoWhite:[30:11] Found expr:[10:4->32:10] posCursor:[30:12] posNoWhite:[30:11] Found expr:[11:4->32:10] diff --git a/analysis/tests/src/expected/CompletionPipeChain.res.txt b/analysis/tests/src/expected/CompletionPipeChain.res.txt index 52bfb0631..f17db8b79 100644 --- a/analysis/tests/src/expected/CompletionPipeChain.res.txt +++ b/analysis/tests/src/expected/CompletionPipeChain.res.txt @@ -440,6 +440,7 @@ Complete src/CompletionPipeChain.res 82:30 posCursor:[82:30] posNoWhite:[82:29] Found expr:[76:15->93:1] Pexp_apply ...[76:15->76:46] (~prepare77:3->77:10=...[77:11->77:24], ~render78:3->78:9=...[78:10->91:3], ...[92:2->92:4]) posCursor:[82:30] posNoWhite:[82:29] Found expr:[78:10->91:3] +posCursor:[82:30] posNoWhite:[82:29] Found expr:[78:10->91:3] posCursor:[82:30] posNoWhite:[82:29] Found expr:[79:4->90:14] posCursor:[82:30] posNoWhite:[82:29] Found expr:[82:7->90:14] posCursor:[82:30] posNoWhite:[82:29] Found expr:[82:7->82:30] @@ -467,6 +468,7 @@ Complete src/CompletionPipeChain.res 88:16 posCursor:[88:16] posNoWhite:[88:15] Found expr:[76:15->93:1] Pexp_apply ...[76:15->76:46] (~prepare77:3->77:10=...[77:11->77:24], ~render78:3->78:9=...[78:10->91:3], ...[92:2->92:4]) posCursor:[88:16] posNoWhite:[88:15] Found expr:[78:10->91:3] +posCursor:[88:16] posNoWhite:[88:15] Found expr:[78:10->91:3] posCursor:[88:16] posNoWhite:[88:15] Found expr:[79:4->90:14] posCursor:[88:16] posNoWhite:[88:15] Found expr:[84:4->90:14] posCursor:[88:16] posNoWhite:[88:15] Found expr:[85:4->90:14] diff --git a/analysis/tests/src/expected/Definition.res.txt b/analysis/tests/src/expected/Definition.res.txt index 158b7d271..ea5b53000 100644 --- a/analysis/tests/src/expected/Definition.res.txt +++ b/analysis/tests/src/expected/Definition.res.txt @@ -11,7 +11,7 @@ Hover src/Definition.res 18:14 {"contents": {"kind": "markdown", "value": "```rescript\n(Belt.List.t<'a>, 'a => 'b) => Belt.List.t<'b>\n```\n\n---\n\n```\n \n```\n```rescript\ntype Belt.List.t<'a> = list<'a>\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22belt_List.mli%22%2C34%2C0%5D)\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 -{"contents": {"kind": "markdown", "value": "```rescript\n(. int, int) => int\n```"}} +{"contents": {"kind": "markdown", "value": "```rescript\n(int, int) => int\n```"}} Definition 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/Destructuring.res.txt b/analysis/tests/src/expected/Destructuring.res.txt index 978a78816..c85f233a6 100644 --- a/analysis/tests/src/expected/Destructuring.res.txt +++ b/analysis/tests/src/expected/Destructuring.res.txt @@ -36,6 +36,7 @@ Path x Complete src/Destructuring.res 11:13 posCursor:[11:13] posNoWhite:[11:11] Found expr:[10:8->14:1] +posCursor:[11:13] posNoWhite:[11:11] Found expr:[10:9->14:1] posCursor:[11:13] posNoWhite:[11:11] Found expr:[11:2->13:6] posCursor:[11:13] posNoWhite:[11:11] Found pattern:[11:6->11:14] Completable: Cpattern Value[x]->recordBody @@ -53,6 +54,7 @@ Path x Complete src/Destructuring.res 17:10 posCursor:[17:10] posNoWhite:[17:9] Found expr:[16:9->20:1] +posCursor:[17:10] posNoWhite:[17:9] Found expr:[16:10->20:1] posCursor:[17:10] posNoWhite:[17:9] Found expr:[17:5->19:11] posCursor:[17:10] posNoWhite:[17:9] Found pattern:[17:9->17:11] Completable: Cpattern Value[x]->recordBody diff --git a/analysis/tests/src/expected/Hover.res.txt b/analysis/tests/src/expected/Hover.res.txt index 8503e0b48..6e96f99fb 100644 --- a/analysis/tests/src/expected/Hover.res.txt +++ b/analysis/tests/src/expected/Hover.res.txt @@ -91,16 +91,16 @@ Resolved opens 1 pervasives {"contents": {"kind": "markdown", "value": "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 125:4 -{"contents": {"kind": "markdown", "value": "```rescript\n(. unit, unit) => int\n```"}} +{"contents": {"kind": "markdown", "value": "```rescript\n(unit, unit) => int\n```"}} Hover src/Hover.res 131:4 -{"contents": {"kind": "markdown", "value": "```rescript\n(. unit) => (. unit) => int\n```"}} +{"contents": {"kind": "markdown", "value": "```rescript\nunit => unit => int\n```"}} Hover src/Hover.res 134:4 -{"contents": {"kind": "markdown", "value": "```rescript\n(. unit, unit) => int\n```"}} +{"contents": {"kind": "markdown", "value": "```rescript\n(unit, unit) => int\n```"}} Hover src/Hover.res 137:5 -{"contents": {"kind": "markdown", "value": "```rescript\n(. unit, unit) => int\n```"}} +{"contents": {"kind": "markdown", "value": "```rescript\n(unit, unit) => int\n```"}} Hover src/Hover.res 144:9 {"contents": {"kind": "markdown", "value": "```rescript\nint\n```\n\ndoc comment 1"}} diff --git a/analysis/tests/src/expected/SignatureHelp.res.txt b/analysis/tests/src/expected/SignatureHelp.res.txt index 2dd482881..a2d6d3fde 100644 --- a/analysis/tests/src/expected/SignatureHelp.res.txt +++ b/analysis/tests/src/expected/SignatureHelp.res.txt @@ -10,12 +10,11 @@ ContextPath Value[someFunc] Path someFunc argAtCursor: unlabelled<0> extracted params: -[( - int, ~two: string=?, ~three: unit => unit, ~four: someVariant, unit] +[int, ~two: string=?, ~three: unit => unit, ~four: someVariant, unit] { "signatures": [{ "label": "(\n int,\n ~two: string=?,\n ~three: unit => unit,\n ~four: someVariant,\n unit,\n) => unit", - "parameters": [{"label": [0, 7], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [11, 25], "documentation": {"kind": "markdown", "value": "```rescript\noption\n```"}}, {"label": [29, 49], "documentation": {"kind": "markdown", "value": ""}}, {"label": [53, 71], "documentation": {"kind": "markdown", "value": "```rescript\nsomeVariant\n```\n```rescript\ntype someVariant = One | Two | Three\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22SignatureHelp.res%22%2C0%2C0%5D)"}}, {"label": [75, 79], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}], + "parameters": [{"label": [4, 7], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [11, 25], "documentation": {"kind": "markdown", "value": "```rescript\noption\n```"}}, {"label": [29, 49], "documentation": {"kind": "markdown", "value": ""}}, {"label": [53, 71], "documentation": {"kind": "markdown", "value": "```rescript\nsomeVariant\n```\n```rescript\ntype someVariant = One | Two | Three\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22SignatureHelp.res%22%2C0%2C0%5D)"}}, {"label": [75, 79], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}], "documentation": {"kind": "markdown", "value": " Does stuff. "} }], "activeSignature": 0, @@ -34,12 +33,11 @@ ContextPath Value[someFunc] Path someFunc argAtCursor: unlabelled<0> extracted params: -[( - int, ~two: string=?, ~three: unit => unit, ~four: someVariant, unit] +[int, ~two: string=?, ~three: unit => unit, ~four: someVariant, unit] { "signatures": [{ "label": "(\n int,\n ~two: string=?,\n ~three: unit => unit,\n ~four: someVariant,\n unit,\n) => unit", - "parameters": [{"label": [0, 7], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [11, 25], "documentation": {"kind": "markdown", "value": "```rescript\noption\n```"}}, {"label": [29, 49], "documentation": {"kind": "markdown", "value": ""}}, {"label": [53, 71], "documentation": {"kind": "markdown", "value": "```rescript\nsomeVariant\n```\n```rescript\ntype someVariant = One | Two | Three\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22SignatureHelp.res%22%2C0%2C0%5D)"}}, {"label": [75, 79], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}], + "parameters": [{"label": [4, 7], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [11, 25], "documentation": {"kind": "markdown", "value": "```rescript\noption\n```"}}, {"label": [29, 49], "documentation": {"kind": "markdown", "value": ""}}, {"label": [53, 71], "documentation": {"kind": "markdown", "value": "```rescript\nsomeVariant\n```\n```rescript\ntype someVariant = One | Two | Three\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22SignatureHelp.res%22%2C0%2C0%5D)"}}, {"label": [75, 79], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}], "documentation": {"kind": "markdown", "value": " Does stuff. "} }], "activeSignature": 0, @@ -58,12 +56,11 @@ ContextPath Value[someFunc] Path someFunc argAtCursor: ~two extracted params: -[( - int, ~two: string=?, ~three: unit => unit, ~four: someVariant, unit] +[int, ~two: string=?, ~three: unit => unit, ~four: someVariant, unit] { "signatures": [{ "label": "(\n int,\n ~two: string=?,\n ~three: unit => unit,\n ~four: someVariant,\n unit,\n) => unit", - "parameters": [{"label": [0, 7], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [11, 25], "documentation": {"kind": "markdown", "value": "```rescript\noption\n```"}}, {"label": [29, 49], "documentation": {"kind": "markdown", "value": ""}}, {"label": [53, 71], "documentation": {"kind": "markdown", "value": "```rescript\nsomeVariant\n```\n```rescript\ntype someVariant = One | Two | Three\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22SignatureHelp.res%22%2C0%2C0%5D)"}}, {"label": [75, 79], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}], + "parameters": [{"label": [4, 7], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [11, 25], "documentation": {"kind": "markdown", "value": "```rescript\noption\n```"}}, {"label": [29, 49], "documentation": {"kind": "markdown", "value": ""}}, {"label": [53, 71], "documentation": {"kind": "markdown", "value": "```rescript\nsomeVariant\n```\n```rescript\ntype someVariant = One | Two | Three\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22SignatureHelp.res%22%2C0%2C0%5D)"}}, {"label": [75, 79], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}], "documentation": {"kind": "markdown", "value": " Does stuff. "} }], "activeSignature": 0, @@ -82,12 +79,11 @@ ContextPath Value[someFunc] Path someFunc argAtCursor: ~two extracted params: -[( - int, ~two: string=?, ~three: unit => unit, ~four: someVariant, unit] +[int, ~two: string=?, ~three: unit => unit, ~four: someVariant, unit] { "signatures": [{ "label": "(\n int,\n ~two: string=?,\n ~three: unit => unit,\n ~four: someVariant,\n unit,\n) => unit", - "parameters": [{"label": [0, 7], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [11, 25], "documentation": {"kind": "markdown", "value": "```rescript\noption\n```"}}, {"label": [29, 49], "documentation": {"kind": "markdown", "value": ""}}, {"label": [53, 71], "documentation": {"kind": "markdown", "value": "```rescript\nsomeVariant\n```\n```rescript\ntype someVariant = One | Two | Three\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22SignatureHelp.res%22%2C0%2C0%5D)"}}, {"label": [75, 79], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}], + "parameters": [{"label": [4, 7], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [11, 25], "documentation": {"kind": "markdown", "value": "```rescript\noption\n```"}}, {"label": [29, 49], "documentation": {"kind": "markdown", "value": ""}}, {"label": [53, 71], "documentation": {"kind": "markdown", "value": "```rescript\nsomeVariant\n```\n```rescript\ntype someVariant = One | Two | Three\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22SignatureHelp.res%22%2C0%2C0%5D)"}}, {"label": [75, 79], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}], "documentation": {"kind": "markdown", "value": " Does stuff. "} }], "activeSignature": 0, @@ -106,12 +102,11 @@ ContextPath Value[someFunc] Path someFunc argAtCursor: ~four extracted params: -[( - int, ~two: string=?, ~three: unit => unit, ~four: someVariant, unit] +[int, ~two: string=?, ~three: unit => unit, ~four: someVariant, unit] { "signatures": [{ "label": "(\n int,\n ~two: string=?,\n ~three: unit => unit,\n ~four: someVariant,\n unit,\n) => unit", - "parameters": [{"label": [0, 7], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [11, 25], "documentation": {"kind": "markdown", "value": "```rescript\noption\n```"}}, {"label": [29, 49], "documentation": {"kind": "markdown", "value": ""}}, {"label": [53, 71], "documentation": {"kind": "markdown", "value": "```rescript\nsomeVariant\n```\n```rescript\ntype someVariant = One | Two | Three\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22SignatureHelp.res%22%2C0%2C0%5D)"}}, {"label": [75, 79], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}], + "parameters": [{"label": [4, 7], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [11, 25], "documentation": {"kind": "markdown", "value": "```rescript\noption\n```"}}, {"label": [29, 49], "documentation": {"kind": "markdown", "value": ""}}, {"label": [53, 71], "documentation": {"kind": "markdown", "value": "```rescript\nsomeVariant\n```\n```rescript\ntype someVariant = One | Two | Three\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22SignatureHelp.res%22%2C0%2C0%5D)"}}, {"label": [75, 79], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}], "documentation": {"kind": "markdown", "value": " Does stuff. "} }], "activeSignature": 0, @@ -130,12 +125,11 @@ ContextPath Value[someFunc] Path someFunc argAtCursor: ~four extracted params: -[( - int, ~two: string=?, ~three: unit => unit, ~four: someVariant, unit] +[int, ~two: string=?, ~three: unit => unit, ~four: someVariant, unit] { "signatures": [{ "label": "(\n int,\n ~two: string=?,\n ~three: unit => unit,\n ~four: someVariant,\n unit,\n) => unit", - "parameters": [{"label": [0, 7], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [11, 25], "documentation": {"kind": "markdown", "value": "```rescript\noption\n```"}}, {"label": [29, 49], "documentation": {"kind": "markdown", "value": ""}}, {"label": [53, 71], "documentation": {"kind": "markdown", "value": "```rescript\nsomeVariant\n```\n```rescript\ntype someVariant = One | Two | Three\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22SignatureHelp.res%22%2C0%2C0%5D)"}}, {"label": [75, 79], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}], + "parameters": [{"label": [4, 7], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [11, 25], "documentation": {"kind": "markdown", "value": "```rescript\noption\n```"}}, {"label": [29, 49], "documentation": {"kind": "markdown", "value": ""}}, {"label": [53, 71], "documentation": {"kind": "markdown", "value": "```rescript\nsomeVariant\n```\n```rescript\ntype someVariant = One | Two | Three\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22SignatureHelp.res%22%2C0%2C0%5D)"}}, {"label": [75, 79], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}], "documentation": {"kind": "markdown", "value": " Does stuff. "} }], "activeSignature": 0, @@ -154,11 +148,11 @@ ContextPath Value[otherFunc] Path otherFunc argAtCursor: unlabelled<0> extracted params: -[(string, int, float] +[string, int, float] { "signatures": [{ "label": "(string, int, float) => unit", - "parameters": [{"label": [0, 7], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}, {"label": [9, 12], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}, {"label": [14, 19], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}] + "parameters": [{"label": [1, 7], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}, {"label": [9, 12], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}, {"label": [14, 19], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}] }], "activeSignature": 0, "activeParameter": 0 @@ -176,11 +170,11 @@ ContextPath Value[otherFunc] Path otherFunc argAtCursor: unlabelled<0> extracted params: -[(string, int, float] +[string, int, float] { "signatures": [{ "label": "(string, int, float) => unit", - "parameters": [{"label": [0, 7], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}, {"label": [9, 12], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}, {"label": [14, 19], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}] + "parameters": [{"label": [1, 7], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}, {"label": [9, 12], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}, {"label": [14, 19], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}] }], "activeSignature": 0, "activeParameter": 0 @@ -198,11 +192,11 @@ ContextPath Value[otherFunc] Path otherFunc argAtCursor: unlabelled<2> extracted params: -[(string, int, float] +[string, int, float] { "signatures": [{ "label": "(string, int, float) => unit", - "parameters": [{"label": [0, 7], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}, {"label": [9, 12], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}, {"label": [14, 19], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}] + "parameters": [{"label": [1, 7], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}, {"label": [9, 12], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}, {"label": [14, 19], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}] }], "activeSignature": 0, "activeParameter": 2 @@ -220,11 +214,11 @@ ContextPath Value[Completion, Lib, foo] Path Completion.Lib.foo argAtCursor: ~age extracted params: -[(~age: int, ~name: string] +[~age: int, ~name: string] { "signatures": [{ "label": "(~age: int, ~name: string) => string", - "parameters": [{"label": [0, 10], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [12, 25], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}] + "parameters": [{"label": [1, 10], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [12, 25], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}] }], "activeSignature": 0, "activeParameter": 0 @@ -265,11 +259,11 @@ ContextPath Value[otherFunc] Path otherFunc argAtCursor: unlabelled<1> extracted params: -[(string, int, float] +[string, int, float] { "signatures": [{ "label": "(string, int, float) => unit", - "parameters": [{"label": [0, 7], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}, {"label": [9, 12], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}, {"label": [14, 19], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}] + "parameters": [{"label": [1, 7], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}, {"label": [9, 12], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}, {"label": [14, 19], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}] }], "activeSignature": 0, "activeParameter": 1 @@ -287,11 +281,11 @@ ContextPath Value[fn] Path fn argAtCursor: unlabelled<1> extracted params: -[(int, string, int] +[int, string, int] { "signatures": [{ "label": "(int, string, int) => unit", - "parameters": [{"label": [0, 4], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [6, 12], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [14, 17], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}] + "parameters": [{"label": [1, 4], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [6, 12], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [14, 17], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}] }], "activeSignature": 0, "activeParameter": 1 @@ -309,11 +303,11 @@ ContextPath Value[fn] Path fn argAtCursor: unlabelled<1> extracted params: -[(int, string, int] +[int, string, int] { "signatures": [{ "label": "(int, string, int) => unit", - "parameters": [{"label": [0, 4], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [6, 12], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [14, 17], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}] + "parameters": [{"label": [1, 4], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [6, 12], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [14, 17], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}] }], "activeSignature": 0, "activeParameter": 1 @@ -331,11 +325,11 @@ ContextPath Value[fn] Path fn argAtCursor: unlabelled<2> extracted params: -[(int, string, int] +[int, string, int] { "signatures": [{ "label": "(int, string, int) => unit", - "parameters": [{"label": [0, 4], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [6, 12], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [14, 17], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}] + "parameters": [{"label": [1, 4], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [6, 12], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [14, 17], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}] }], "activeSignature": 0, "activeParameter": 2 @@ -381,12 +375,11 @@ ContextPath Value[someFunc] Path someFunc argAtCursor: unlabelled<0> extracted params: -[( - int, ~two: string=?, ~three: unit => unit, ~four: someVariant, unit] +[int, ~two: string=?, ~three: unit => unit, ~four: someVariant, unit] { "signatures": [{ "label": "(\n int,\n ~two: string=?,\n ~three: unit => unit,\n ~four: someVariant,\n unit,\n) => unit", - "parameters": [{"label": [0, 7], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [11, 25], "documentation": {"kind": "markdown", "value": "```rescript\noption\n```"}}, {"label": [29, 49], "documentation": {"kind": "markdown", "value": ""}}, {"label": [53, 71], "documentation": {"kind": "markdown", "value": "```rescript\nsomeVariant\n```\n```rescript\ntype someVariant = One | Two | Three\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22SignatureHelp.res%22%2C0%2C0%5D)"}}, {"label": [75, 79], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}], + "parameters": [{"label": [4, 7], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [11, 25], "documentation": {"kind": "markdown", "value": "```rescript\noption\n```"}}, {"label": [29, 49], "documentation": {"kind": "markdown", "value": ""}}, {"label": [53, 71], "documentation": {"kind": "markdown", "value": "```rescript\nsomeVariant\n```\n```rescript\ntype someVariant = One | Two | Three\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22SignatureHelp.res%22%2C0%2C0%5D)"}}, {"label": [75, 79], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}], "documentation": {"kind": "markdown", "value": " Does stuff. "} }], "activeSignature": 0, diff --git a/analysis/tests/src/expected/Xform.res.txt b/analysis/tests/src/expected/Xform.res.txt index 0af705bff..30154b591 100644 --- a/analysis/tests/src/expected/Xform.res.txt +++ b/analysis/tests/src/expected/Xform.res.txt @@ -101,6 +101,7 @@ newText: Xform src/Xform.res 48:21 posCursor:[48:21] posNoWhite:[48:19] Found expr:[48:15->48:25] +posCursor:[48:21] posNoWhite:[48:19] Found expr:[48:15->48:25] Completable: Cpath Value[name] Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives diff --git a/server/src/utils.ts b/server/src/utils.ts index a6adf8ec7..0c3b27872 100644 --- a/server/src/utils.ts +++ b/server/src/utils.ts @@ -136,6 +136,29 @@ export let formatCode = ( } }; +let findReScriptVersion = (filePath: p.DocumentUri): string | undefined => { + let projectRoot = findProjectRootOfFile(filePath); + if (projectRoot == null) { + return undefined; + } + + let rescriptBinary = lookup.findFilePathFromProjectRoot( + projectRoot, + path.join(c.nodeModulesBinDir, c.rescriptBinName) + ); + + if (rescriptBinary == null) { + return undefined; + } + + try { + let version = childProcess.execSync(`${rescriptBinary} -v`); + return version.toString().trim(); + } catch (e) { + return undefined; + } +}; + export let runAnalysisAfterSanityCheck = ( filePath: p.DocumentUri, args: Array, @@ -154,9 +177,14 @@ export let runAnalysisAfterSanityCheck = ( if (projectRootPath == null && projectRequired) { return null; } + let rescriptVersion = findReScriptVersion(filePath); let options: childProcess.ExecFileSyncOptions = { cwd: projectRootPath || undefined, maxBuffer: Infinity, + env: { + ...process.env, + RESCRIPT_VERSION: rescriptVersion, + }, }; let stdout = childProcess.execFileSync(binaryPath, args, options); From 2acaf974abc9310cc602dba721d61ccd0bca8258 Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Fri, 15 Dec 2023 11:15:44 +0100 Subject: [PATCH 2/3] revert test changes --- .../tests/src/expected/Completion.res.txt | 26 +++---- .../CompletionFunctionArguments.res.txt | 2 - .../expected/CompletionInferValues.res.txt | 15 +---- .../tests/src/expected/CompletionJsx.res.txt | 8 --- .../src/expected/CompletionPipeChain.res.txt | 2 - .../tests/src/expected/Definition.res.txt | 2 +- .../tests/src/expected/Destructuring.res.txt | 2 - analysis/tests/src/expected/Hover.res.txt | 8 +-- .../tests/src/expected/SignatureHelp.res.txt | 67 ++++++++++--------- analysis/tests/src/expected/Xform.res.txt | 1 - 10 files changed, 52 insertions(+), 81 deletions(-) diff --git a/analysis/tests/src/expected/Completion.res.txt b/analysis/tests/src/expected/Completion.res.txt index f1c0a5d66..95c71aeb6 100644 --- a/analysis/tests/src/expected/Completion.res.txt +++ b/analysis/tests/src/expected/Completion.res.txt @@ -28,7 +28,7 @@ Path MyList.m "label": "mapReverse2U", "kind": 12, "tags": [], - "detail": "(t<'a>, t<'b>, ('a, 'b) => 'c) => t<'c>", + "detail": "(t<'a>, t<'b>, (. 'a, 'b) => 'c) => t<'c>", "documentation": {"kind": "markdown", "value": " Uncurried version of [mapReverse2](#mapReverse2). "} }, { "label": "map", @@ -40,19 +40,19 @@ Path MyList.m "label": "mapWithIndexU", "kind": 12, "tags": [], - "detail": "(t<'a>, (int, 'a) => 'b) => t<'b>", + "detail": "(t<'a>, (. int, 'a) => 'b) => t<'b>", "documentation": {"kind": "markdown", "value": " Uncurried version of [mapWithIndex](#mapWithIndex). "} }, { "label": "mapU", "kind": 12, "tags": [], - "detail": "(t<'a>, 'a => 'b) => t<'b>", + "detail": "(t<'a>, (. 'a) => 'b) => t<'b>", "documentation": {"kind": "markdown", "value": " Uncurried version of [map](#map). "} }, { "label": "makeByU", "kind": 12, "tags": [], - "detail": "(int, int => 'a) => t<'a>", + "detail": "(int, (. int) => 'a) => t<'a>", "documentation": {"kind": "markdown", "value": " Uncurried version of [makeBy](#makeBy) "} }, { "label": "mapReverse2", @@ -70,7 +70,7 @@ Path MyList.m "label": "mapReverseU", "kind": 12, "tags": [], - "detail": "(t<'a>, 'a => 'b) => t<'b>", + "detail": "(t<'a>, (. 'a) => 'b) => t<'b>", "documentation": {"kind": "markdown", "value": " Uncurried version of [mapReverse](#mapReverse). "} }] @@ -451,7 +451,7 @@ Path Belt.Option.e "label": "Belt.Option.eqU", "kind": 12, "tags": [], - "detail": "(option<'a>, option<'b>, ('a, 'b) => bool) => bool", + "detail": "(option<'a>, option<'b>, (. 'a, 'b) => bool) => bool", "documentation": {"kind": "markdown", "value": "\n Uncurried version of `eq`\n"} }, { "label": "Belt.Option.eq", @@ -508,7 +508,7 @@ Path Js.Dict.u "label": "unsafeDeleteKey", "kind": 12, "tags": [], - "detail": "(t, string) => unit", + "detail": "(. t, string) => unit", "documentation": {"kind": "markdown", "value": " Experimental internal function "} }] @@ -765,7 +765,6 @@ Path Objects.Rec.recordVal Complete 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:[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] Pexp_ident my:[120:5->120:7] @@ -1286,7 +1285,6 @@ Path SomeLocal Complete 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:[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] Pexp_ident _w:[275:13->275:15] @@ -1632,7 +1630,6 @@ 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] posCursor:[336:26] posNoWhite:[336:25] Found expr:[334:13->338:6] -posCursor:[336:26] posNoWhite:[336:25] Found expr:[334:13->338:6] posCursor:[336:26] posNoWhite:[336:25] Found expr:[335:6->338:5] posCursor:[336:26] posNoWhite:[336:25] Found expr:[336:16->338:5] posCursor:[336:26] posNoWhite:[336:25] Found pattern:[336:20->338:5] @@ -1734,7 +1731,6 @@ posCursor:[355:23] posNoWhite:[355:22] Found expr:[355:12->355:23] Complete 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:[360:8->365:3] posCursor:[362:8] posNoWhite:[362:7] Found pattern:[362:7->364:5] posCursor:[362:8] posNoWhite:[362:7] Found pattern:[362:7->362:8] Ppat_construct T:[362:7->362:8] @@ -1784,7 +1780,6 @@ Path T Complete 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:[371:8->376:3] posCursor:[373:21] posNoWhite:[373:20] Found pattern:[373:7->375:5] posCursor:[373:21] posNoWhite:[373:20] Found pattern:[373:7->373:21] Ppat_construct AndThatOther.T:[373:7->373:21] @@ -1887,7 +1882,6 @@ Path funRecord Complete 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:[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] posCursor:[389:12] posNoWhite:[389:11] Found expr:[389:6->389:12] @@ -1991,7 +1985,6 @@ Path r Complete src/Completion.res 409:21 posCursor:[409:21] posNoWhite:[409:20] Found expr:[408:14->415:1] -posCursor:[409:21] posNoWhite:[409:20] Found expr:[408:14->415:1] posCursor:[409:21] posNoWhite:[409:20] Found expr:[409:5->414:17] posCursor:[409:21] posNoWhite:[409:20] Found expr:[409:5->411:42] posCursor:[409:21] posNoWhite:[409:20] Found expr:[409:5->411:5] @@ -2018,7 +2011,6 @@ Path SomeLocalModule. Complete src/Completion.res 412:21 posCursor:[412:21] posNoWhite:[412:20] Found expr:[408:14->415:1] -posCursor:[412:21] posNoWhite:[412:20] Found expr:[408:14->415:1] posCursor:[412:21] posNoWhite:[412:20] Found expr:[411:2->414:17] posCursor:[412:21] posNoWhite:[412:20] Found expr:[412:5->414:17] Pexp_apply ...[412:5->414:8] (...[414:9->414:16]) @@ -2204,13 +2196,13 @@ Resolved opens 3 pervasives Completion.res Completion.res ContextPath Type[withUncurried] Path withUncurried [{ - "label": "v => {}", + "label": "(. v) => {}", "kind": 12, "tags": [], "detail": "int => unit", "documentation": null, "sortText": "A", - "insertText": "${1:v} => {$0}", + "insertText": "(. ${1:v}) => {$0}", "insertTextFormat": 2 }] diff --git a/analysis/tests/src/expected/CompletionFunctionArguments.res.txt b/analysis/tests/src/expected/CompletionFunctionArguments.res.txt index 7ca6e7bc8..d15f00087 100644 --- a/analysis/tests/src/expected/CompletionFunctionArguments.res.txt +++ b/analysis/tests/src/expected/CompletionFunctionArguments.res.txt @@ -370,7 +370,6 @@ Complete src/CompletionFunctionArguments.res 109:29 posCursor:[109:29] posNoWhite:[109:28] Found expr:[105:3->114:4] JSX 105:6] onMouseDown[106:4->106:15]=...[106:35->113:5]> _children:114:2 posCursor:[109:29] posNoWhite:[109:28] Found expr:[106:35->113:5] -posCursor:[109:29] posNoWhite:[109:28] Found expr:[106:16->113:5] posCursor:[109:29] posNoWhite:[109:28] Found expr:[107:6->109:29] posCursor:[109:29] posNoWhite:[109:28] Found expr:[108:6->109:29] posCursor:[109:29] posNoWhite:[109:28] Found expr:[109:9->109:29] @@ -396,7 +395,6 @@ Complete src/CompletionFunctionArguments.res 111:27 posCursor:[111:27] posNoWhite:[111:26] Found expr:[105:3->114:4] JSX 105:6] onMouseDown[106:4->106:15]=...[106:35->113:5]> _children:114:2 posCursor:[111:27] posNoWhite:[111:26] Found expr:[106:35->113:5] -posCursor:[111:27] posNoWhite:[111:26] Found expr:[106:16->113:5] posCursor:[111:27] posNoWhite:[111:26] Found expr:[107:6->111:27] posCursor:[111:27] posNoWhite:[111:26] Found expr:[108:6->111:27] posCursor:[111:27] posNoWhite:[111:26] Found expr:[111:9->111:27] diff --git a/analysis/tests/src/expected/CompletionInferValues.res.txt b/analysis/tests/src/expected/CompletionInferValues.res.txt index 34004efb5..55b527da6 100644 --- a/analysis/tests/src/expected/CompletionInferValues.res.txt +++ b/analysis/tests/src/expected/CompletionInferValues.res.txt @@ -83,7 +83,6 @@ Complete src/CompletionInferValues.res 24:63 posCursor:[24:63] posNoWhite:[24:62] Found expr:[24:3->24:64] Pexp_apply ...[24:3->24:21] (...[24:22->24:63]) posCursor:[24:63] posNoWhite:[24:62] Found expr:[24:22->24:63] -posCursor:[24:63] posNoWhite:[24:62] Found expr:[24:23->24:63] posCursor:[24:63] posNoWhite:[24:62] Found expr:[24:36->24:63] posCursor:[24:63] posNoWhite:[24:62] Found expr:[24:42->24:63] posCursor:[24:63] posNoWhite:[24:62] Found expr:[24:52->24:63] @@ -116,7 +115,6 @@ Complete src/CompletionInferValues.res 27:90 posCursor:[27:90] posNoWhite:[27:89] Found expr:[27:39->27:91] Pexp_apply ...[27:39->27:48] (...[27:49->27:90]) posCursor:[27:90] posNoWhite:[27:89] Found expr:[27:49->27:90] -posCursor:[27:90] posNoWhite:[27:89] Found expr:[27:50->27:90] posCursor:[27:90] posNoWhite:[27:89] Found expr:[27:56->27:90] posCursor:[27:90] posNoWhite:[27:89] Found expr:[27:69->27:90] posCursor:[27:90] posNoWhite:[27:89] Found expr:[27:79->27:90] @@ -151,7 +149,6 @@ Complete src/CompletionInferValues.res 30:36 posCursor:[30:36] posNoWhite:[30:35] Found expr:[30:3->30:39] Pexp_apply ...[30:3->30:15] (...[30:16->30:38]) posCursor:[30:36] posNoWhite:[30:35] Found expr:[30:16->30:38] -posCursor:[30:36] posNoWhite:[30:35] Found expr:[30:16->30:38] posCursor:[30:36] posNoWhite:[30:35] Found expr:[30:27->30:36] Completable: Cpath Value[event]->pr Package opens Pervasives.JsxModules.place holder @@ -179,7 +176,6 @@ Complete src/CompletionInferValues.res 41:50 posCursor:[41:50] posNoWhite:[41:49] Found expr:[41:12->41:56] JSX 41:15] onMouseEnter[41:16->41:28]=...[41:36->41:52]> _children:41:54 posCursor:[41:50] posNoWhite:[41:49] Found expr:[41:36->41:52] -posCursor:[41:50] posNoWhite:[41:49] Found expr:[41:29->41:52] posCursor:[41:50] posNoWhite:[41:49] Found expr:[41:41->41:50] Completable: Cpath Value[event]->pr <> Package opens Pervasives.JsxModules.place holder @@ -207,7 +203,6 @@ Complete src/CompletionInferValues.res 44:50 posCursor:[44:50] posNoWhite:[44:49] Found expr:[44:12->44:56] JSX 44:15] onMouseEnter[44:16->44:28]=...[44:36->44:52]> _children:44:54 posCursor:[44:50] posNoWhite:[44:49] Found expr:[44:36->44:52] -posCursor:[44:50] posNoWhite:[44:49] Found expr:[44:29->44:52] posCursor:[44:50] posNoWhite:[44:49] Found expr:[44:41->44:50] Completable: Cpath Value[event]->pr <> Package opens Pervasives.JsxModules.place holder @@ -234,7 +229,6 @@ Complete src/CompletionInferValues.res 47:87 posCursor:[47:87] posNoWhite:[47:86] Found expr:[47:12->47:93] JSX 47:15] onMouseEnter[47:16->47:28]=...[47:36->47:89]> _children:47:91 posCursor:[47:87] posNoWhite:[47:86] Found expr:[47:36->47:89] -posCursor:[47:87] posNoWhite:[47:86] Found expr:[47:29->47:89] posCursor:[47:87] posNoWhite:[47:86] Found expr:[47:41->47:87] posCursor:[47:87] posNoWhite:[47:86] Found expr:[47:81->47:87] Completable: Cpath Value[btn]->t <> @@ -246,7 +240,7 @@ Path btn ContextPath Value[JsxEvent, Mouse, button](Nolabel) ContextPath Value[JsxEvent, Mouse, button] Path JsxEvent.Mouse.button -CPPipe env:CompletionInferValues envFromCompletionItem:JsxEventU.Mouse +CPPipe env:CompletionInferValues envFromCompletionItem:JsxEventC.Mouse Path Belt.Int.t [{ "label": "Belt.Int.toString", @@ -266,7 +260,6 @@ Complete src/CompletionInferValues.res 50:108 posCursor:[50:108] posNoWhite:[50:107] Found expr:[50:12->50:114] JSX 50:15] onMouseEnter[50:16->50:28]=...[50:36->50:110]> _children:50:112 posCursor:[50:108] posNoWhite:[50:107] Found expr:[50:36->50:110] -posCursor:[50:108] posNoWhite:[50:107] Found expr:[50:29->50:110] posCursor:[50:108] posNoWhite:[50:107] Found expr:[50:41->50:108] posCursor:[50:108] posNoWhite:[50:107] Found expr:[50:100->50:108] Completable: Cpath Value[btn]->spl <> @@ -310,7 +303,6 @@ Complete src/CompletionInferValues.res 53:130 posCursor:[53:130] posNoWhite:[53:129] Found expr:[53:12->53:136] JSX 53:15] onMouseEnter[53:16->53:28]=...[53:36->53:132]> _children:53:134 posCursor:[53:130] posNoWhite:[53:129] Found expr:[53:36->53:132] -posCursor:[53:130] posNoWhite:[53:129] Found expr:[53:29->53:132] posCursor:[53:130] posNoWhite:[53:129] Found expr:[53:41->53:130] posCursor:[53:130] posNoWhite:[53:129] Found expr:[53:123->53:130] Completable: Cpath Value[btn]->ma <> @@ -687,7 +679,6 @@ Complete src/CompletionInferValues.res 130:26 posCursor:[130:26] posNoWhite:[130:25] Found expr:[130:3->130:37] Pexp_apply ...[130:3->130:23] (...[130:24->130:36]) posCursor:[130:26] posNoWhite:[130:25] Found expr:[130:24->130:36] -posCursor:[130:26] posNoWhite:[130:25] Found expr:[130:25->130:36] posCursor:[130:26] posNoWhite:[130:25] Found pattern:[130:25->130:27] posCursor:[130:26] posNoWhite:[130:25] Found pattern:[130:25->130:27] Completable: Cpattern CArgument CArgument Value[fnWithRecordCallback]($0)($0)->recordBody @@ -715,7 +706,6 @@ Complete src/CompletionInferValues.res 137:30 posCursor:[137:30] posNoWhite:[137:29] Found expr:[137:3->137:33] Pexp_apply ...[137:3->137:6] (~cb137:8->137:10=...[137:11->137:32]) posCursor:[137:30] posNoWhite:[137:29] Found expr:[137:11->137:32] -posCursor:[137:30] posNoWhite:[137:29] Found expr:[137:12->137:32] posCursor:[137:30] posNoWhite:[137:29] Found expr:[137:24->0:-1] posCursor:[137:30] posNoWhite:[137:29] Found expr:[137:24->0:-1] Completable: Cpath Value[root]-> @@ -751,7 +741,6 @@ Complete src/CompletionInferValues.res 146:30 posCursor:[146:30] posNoWhite:[146:29] Found expr:[146:3->146:33] Pexp_apply ...[146:3->146:6] (~cb146:8->146:10=...[146:11->146:32]) posCursor:[146:30] posNoWhite:[146:29] Found expr:[146:11->146:32] -posCursor:[146:30] posNoWhite:[146:29] Found expr:[146:12->146:32] posCursor:[146:30] posNoWhite:[146:29] Found expr:[146:24->0:-1] posCursor:[146:30] posNoWhite:[146:29] Found expr:[146:24->0:-1] Completable: Cpath Value[root]-> @@ -831,7 +820,6 @@ Complete src/CompletionInferValues.res 158:105 posCursor:[158:105] posNoWhite:[158:104] Found expr:[158:18->158:110] Pexp_apply ...[158:18->158:49] (~prepare158:51->158:58=...[158:59->158:72], ~render158:74->158:80=...[158:81->158:106], ...[158:107->158:109]) posCursor:[158:105] posNoWhite:[158:104] Found expr:[158:81->158:106] -posCursor:[158:105] posNoWhite:[158:104] Found expr:[158:82->158:106] posCursor:[158:105] posNoWhite:[158:104] Found expr:[158:97->158:105] Pexp_field [158:97->158:104] _:[158:105->158:105] Completable: Cpath Value[support]."" @@ -857,7 +845,6 @@ Complete src/CompletionInferValues.res 162:110 posCursor:[162:110] posNoWhite:[162:109] Found expr:[162:18->162:115] Pexp_apply ...[162:18->162:49] (~prepare162:51->162:58=...[162:59->162:72], ~render162:74->162:80=...[162:81->162:111], ...[162:112->162:114]) posCursor:[162:110] posNoWhite:[162:109] Found expr:[162:81->162:111] -posCursor:[162:110] posNoWhite:[162:109] Found expr:[162:82->162:111] posCursor:[162:110] posNoWhite:[162:109] Found expr:[162:104->0:-1] posCursor:[162:110] posNoWhite:[162:109] Found expr:[162:104->0:-1] Completable: Cpath Value[root]-> diff --git a/analysis/tests/src/expected/CompletionJsx.res.txt b/analysis/tests/src/expected/CompletionJsx.res.txt index 3d239e202..fba67fac1 100644 --- a/analysis/tests/src/expected/CompletionJsx.res.txt +++ b/analysis/tests/src/expected/CompletionJsx.res.txt @@ -24,7 +24,6 @@ Path Js.String2.st Complete src/CompletionJsx.res 13:21 posCursor:[13:21] posNoWhite:[13:20] Found expr:[8:13->33:3] -posCursor:[13:21] posNoWhite:[13:20] Found expr:[8:14->33:3] posCursor:[13:21] posNoWhite:[13:20] Found expr:[9:4->32:10] posCursor:[13:21] posNoWhite:[13:20] Found expr:[10:4->32:10] posCursor:[13:21] posNoWhite:[13:20] Found expr:[11:4->32:10] @@ -63,7 +62,6 @@ Path Js.String2.st Complete src/CompletionJsx.res 18:24 posCursor:[18:24] posNoWhite:[18:23] Found expr:[8:13->33:3] -posCursor:[18:24] posNoWhite:[18:23] Found expr:[8:14->33:3] posCursor:[18:24] posNoWhite:[18:23] Found expr:[9:4->32:10] posCursor:[18:24] posNoWhite:[18:23] Found expr:[10:4->32:10] posCursor:[18:24] posNoWhite:[18:23] Found expr:[11:4->32:10] @@ -112,7 +110,6 @@ Path Js.String2.st Complete src/CompletionJsx.res 20:27 posCursor:[20:27] posNoWhite:[20:26] Found expr:[8:13->33:3] -posCursor:[20:27] posNoWhite:[20:26] Found expr:[8:14->33:3] posCursor:[20:27] posNoWhite:[20:26] Found expr:[9:4->32:10] posCursor:[20:27] posNoWhite:[20:26] Found expr:[10:4->32:10] posCursor:[20:27] posNoWhite:[20:26] Found expr:[11:4->32:10] @@ -160,7 +157,6 @@ Path Js.String2.st Complete src/CompletionJsx.res 22:44 posCursor:[22:44] posNoWhite:[22:43] Found expr:[8:13->33:3] -posCursor:[22:44] posNoWhite:[22:43] Found expr:[8:14->33:3] posCursor:[22:44] posNoWhite:[22:43] Found expr:[9:4->32:10] posCursor:[22:44] posNoWhite:[22:43] Found expr:[10:4->32:10] posCursor:[22:44] posNoWhite:[22:43] Found expr:[11:4->32:10] @@ -210,7 +206,6 @@ Path Js.String2.st Complete src/CompletionJsx.res 24:19 posCursor:[24:19] posNoWhite:[24:18] Found expr:[8:13->33:3] -posCursor:[24:19] posNoWhite:[24:18] Found expr:[8:14->33:3] posCursor:[24:19] posNoWhite:[24:18] Found expr:[9:4->32:10] posCursor:[24:19] posNoWhite:[24:18] Found expr:[10:4->32:10] posCursor:[24:19] posNoWhite:[24:18] Found expr:[11:4->32:10] @@ -295,7 +290,6 @@ Path Belt.Int. Complete src/CompletionJsx.res 26:14 posCursor:[26:14] posNoWhite:[26:13] Found expr:[8:13->33:3] -posCursor:[26:14] posNoWhite:[26:13] Found expr:[8:14->33:3] posCursor:[26:14] posNoWhite:[26:13] Found expr:[9:4->32:10] posCursor:[26:14] posNoWhite:[26:13] Found expr:[10:4->32:10] posCursor:[26:14] posNoWhite:[26:13] Found expr:[11:4->32:10] @@ -379,7 +373,6 @@ Path Belt.Int. Complete src/CompletionJsx.res 28:20 posCursor:[28:20] posNoWhite:[28:19] Found expr:[8:13->33:3] -posCursor:[28:20] posNoWhite:[28:19] Found expr:[8:14->33:3] posCursor:[28:20] posNoWhite:[28:19] Found expr:[9:4->32:10] posCursor:[28:20] posNoWhite:[28:19] Found expr:[10:4->32:10] posCursor:[28:20] posNoWhite:[28:19] Found expr:[11:4->32:10] @@ -422,7 +415,6 @@ Path Js.Array2.a Complete src/CompletionJsx.res 30:12 posCursor:[30:12] posNoWhite:[30:11] Found expr:[8:13->33:3] -posCursor:[30:12] posNoWhite:[30:11] Found expr:[8:14->33:3] posCursor:[30:12] posNoWhite:[30:11] Found expr:[9:4->32:10] posCursor:[30:12] posNoWhite:[30:11] Found expr:[10:4->32:10] posCursor:[30:12] posNoWhite:[30:11] Found expr:[11:4->32:10] diff --git a/analysis/tests/src/expected/CompletionPipeChain.res.txt b/analysis/tests/src/expected/CompletionPipeChain.res.txt index f17db8b79..52bfb0631 100644 --- a/analysis/tests/src/expected/CompletionPipeChain.res.txt +++ b/analysis/tests/src/expected/CompletionPipeChain.res.txt @@ -440,7 +440,6 @@ Complete src/CompletionPipeChain.res 82:30 posCursor:[82:30] posNoWhite:[82:29] Found expr:[76:15->93:1] Pexp_apply ...[76:15->76:46] (~prepare77:3->77:10=...[77:11->77:24], ~render78:3->78:9=...[78:10->91:3], ...[92:2->92:4]) posCursor:[82:30] posNoWhite:[82:29] Found expr:[78:10->91:3] -posCursor:[82:30] posNoWhite:[82:29] Found expr:[78:10->91:3] posCursor:[82:30] posNoWhite:[82:29] Found expr:[79:4->90:14] posCursor:[82:30] posNoWhite:[82:29] Found expr:[82:7->90:14] posCursor:[82:30] posNoWhite:[82:29] Found expr:[82:7->82:30] @@ -468,7 +467,6 @@ Complete src/CompletionPipeChain.res 88:16 posCursor:[88:16] posNoWhite:[88:15] Found expr:[76:15->93:1] Pexp_apply ...[76:15->76:46] (~prepare77:3->77:10=...[77:11->77:24], ~render78:3->78:9=...[78:10->91:3], ...[92:2->92:4]) posCursor:[88:16] posNoWhite:[88:15] Found expr:[78:10->91:3] -posCursor:[88:16] posNoWhite:[88:15] Found expr:[78:10->91:3] posCursor:[88:16] posNoWhite:[88:15] Found expr:[79:4->90:14] posCursor:[88:16] posNoWhite:[88:15] Found expr:[84:4->90:14] posCursor:[88:16] posNoWhite:[88:15] Found expr:[85:4->90:14] diff --git a/analysis/tests/src/expected/Definition.res.txt b/analysis/tests/src/expected/Definition.res.txt index ea5b53000..158b7d271 100644 --- a/analysis/tests/src/expected/Definition.res.txt +++ b/analysis/tests/src/expected/Definition.res.txt @@ -11,7 +11,7 @@ Hover src/Definition.res 18:14 {"contents": {"kind": "markdown", "value": "```rescript\n(Belt.List.t<'a>, 'a => 'b) => Belt.List.t<'b>\n```\n\n---\n\n```\n \n```\n```rescript\ntype Belt.List.t<'a> = list<'a>\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22belt_List.mli%22%2C34%2C0%5D)\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 -{"contents": {"kind": "markdown", "value": "```rescript\n(int, int) => int\n```"}} +{"contents": {"kind": "markdown", "value": "```rescript\n(. int, int) => int\n```"}} Definition 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/Destructuring.res.txt b/analysis/tests/src/expected/Destructuring.res.txt index c85f233a6..978a78816 100644 --- a/analysis/tests/src/expected/Destructuring.res.txt +++ b/analysis/tests/src/expected/Destructuring.res.txt @@ -36,7 +36,6 @@ Path x Complete src/Destructuring.res 11:13 posCursor:[11:13] posNoWhite:[11:11] Found expr:[10:8->14:1] -posCursor:[11:13] posNoWhite:[11:11] Found expr:[10:9->14:1] posCursor:[11:13] posNoWhite:[11:11] Found expr:[11:2->13:6] posCursor:[11:13] posNoWhite:[11:11] Found pattern:[11:6->11:14] Completable: Cpattern Value[x]->recordBody @@ -54,7 +53,6 @@ Path x Complete src/Destructuring.res 17:10 posCursor:[17:10] posNoWhite:[17:9] Found expr:[16:9->20:1] -posCursor:[17:10] posNoWhite:[17:9] Found expr:[16:10->20:1] posCursor:[17:10] posNoWhite:[17:9] Found expr:[17:5->19:11] posCursor:[17:10] posNoWhite:[17:9] Found pattern:[17:9->17:11] Completable: Cpattern Value[x]->recordBody diff --git a/analysis/tests/src/expected/Hover.res.txt b/analysis/tests/src/expected/Hover.res.txt index 6e96f99fb..8503e0b48 100644 --- a/analysis/tests/src/expected/Hover.res.txt +++ b/analysis/tests/src/expected/Hover.res.txt @@ -91,16 +91,16 @@ Resolved opens 1 pervasives {"contents": {"kind": "markdown", "value": "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 125:4 -{"contents": {"kind": "markdown", "value": "```rescript\n(unit, unit) => int\n```"}} +{"contents": {"kind": "markdown", "value": "```rescript\n(. unit, unit) => int\n```"}} Hover src/Hover.res 131:4 -{"contents": {"kind": "markdown", "value": "```rescript\nunit => unit => int\n```"}} +{"contents": {"kind": "markdown", "value": "```rescript\n(. unit) => (. unit) => int\n```"}} Hover src/Hover.res 134:4 -{"contents": {"kind": "markdown", "value": "```rescript\n(unit, unit) => int\n```"}} +{"contents": {"kind": "markdown", "value": "```rescript\n(. unit, unit) => int\n```"}} Hover src/Hover.res 137:5 -{"contents": {"kind": "markdown", "value": "```rescript\n(unit, unit) => int\n```"}} +{"contents": {"kind": "markdown", "value": "```rescript\n(. unit, unit) => int\n```"}} Hover src/Hover.res 144:9 {"contents": {"kind": "markdown", "value": "```rescript\nint\n```\n\ndoc comment 1"}} diff --git a/analysis/tests/src/expected/SignatureHelp.res.txt b/analysis/tests/src/expected/SignatureHelp.res.txt index a2d6d3fde..2dd482881 100644 --- a/analysis/tests/src/expected/SignatureHelp.res.txt +++ b/analysis/tests/src/expected/SignatureHelp.res.txt @@ -10,11 +10,12 @@ ContextPath Value[someFunc] Path someFunc argAtCursor: unlabelled<0> extracted params: -[int, ~two: string=?, ~three: unit => unit, ~four: someVariant, unit] +[( + int, ~two: string=?, ~three: unit => unit, ~four: someVariant, unit] { "signatures": [{ "label": "(\n int,\n ~two: string=?,\n ~three: unit => unit,\n ~four: someVariant,\n unit,\n) => unit", - "parameters": [{"label": [4, 7], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [11, 25], "documentation": {"kind": "markdown", "value": "```rescript\noption\n```"}}, {"label": [29, 49], "documentation": {"kind": "markdown", "value": ""}}, {"label": [53, 71], "documentation": {"kind": "markdown", "value": "```rescript\nsomeVariant\n```\n```rescript\ntype someVariant = One | Two | Three\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22SignatureHelp.res%22%2C0%2C0%5D)"}}, {"label": [75, 79], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}], + "parameters": [{"label": [0, 7], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [11, 25], "documentation": {"kind": "markdown", "value": "```rescript\noption\n```"}}, {"label": [29, 49], "documentation": {"kind": "markdown", "value": ""}}, {"label": [53, 71], "documentation": {"kind": "markdown", "value": "```rescript\nsomeVariant\n```\n```rescript\ntype someVariant = One | Two | Three\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22SignatureHelp.res%22%2C0%2C0%5D)"}}, {"label": [75, 79], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}], "documentation": {"kind": "markdown", "value": " Does stuff. "} }], "activeSignature": 0, @@ -33,11 +34,12 @@ ContextPath Value[someFunc] Path someFunc argAtCursor: unlabelled<0> extracted params: -[int, ~two: string=?, ~three: unit => unit, ~four: someVariant, unit] +[( + int, ~two: string=?, ~three: unit => unit, ~four: someVariant, unit] { "signatures": [{ "label": "(\n int,\n ~two: string=?,\n ~three: unit => unit,\n ~four: someVariant,\n unit,\n) => unit", - "parameters": [{"label": [4, 7], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [11, 25], "documentation": {"kind": "markdown", "value": "```rescript\noption\n```"}}, {"label": [29, 49], "documentation": {"kind": "markdown", "value": ""}}, {"label": [53, 71], "documentation": {"kind": "markdown", "value": "```rescript\nsomeVariant\n```\n```rescript\ntype someVariant = One | Two | Three\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22SignatureHelp.res%22%2C0%2C0%5D)"}}, {"label": [75, 79], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}], + "parameters": [{"label": [0, 7], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [11, 25], "documentation": {"kind": "markdown", "value": "```rescript\noption\n```"}}, {"label": [29, 49], "documentation": {"kind": "markdown", "value": ""}}, {"label": [53, 71], "documentation": {"kind": "markdown", "value": "```rescript\nsomeVariant\n```\n```rescript\ntype someVariant = One | Two | Three\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22SignatureHelp.res%22%2C0%2C0%5D)"}}, {"label": [75, 79], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}], "documentation": {"kind": "markdown", "value": " Does stuff. "} }], "activeSignature": 0, @@ -56,11 +58,12 @@ ContextPath Value[someFunc] Path someFunc argAtCursor: ~two extracted params: -[int, ~two: string=?, ~three: unit => unit, ~four: someVariant, unit] +[( + int, ~two: string=?, ~three: unit => unit, ~four: someVariant, unit] { "signatures": [{ "label": "(\n int,\n ~two: string=?,\n ~three: unit => unit,\n ~four: someVariant,\n unit,\n) => unit", - "parameters": [{"label": [4, 7], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [11, 25], "documentation": {"kind": "markdown", "value": "```rescript\noption\n```"}}, {"label": [29, 49], "documentation": {"kind": "markdown", "value": ""}}, {"label": [53, 71], "documentation": {"kind": "markdown", "value": "```rescript\nsomeVariant\n```\n```rescript\ntype someVariant = One | Two | Three\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22SignatureHelp.res%22%2C0%2C0%5D)"}}, {"label": [75, 79], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}], + "parameters": [{"label": [0, 7], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [11, 25], "documentation": {"kind": "markdown", "value": "```rescript\noption\n```"}}, {"label": [29, 49], "documentation": {"kind": "markdown", "value": ""}}, {"label": [53, 71], "documentation": {"kind": "markdown", "value": "```rescript\nsomeVariant\n```\n```rescript\ntype someVariant = One | Two | Three\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22SignatureHelp.res%22%2C0%2C0%5D)"}}, {"label": [75, 79], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}], "documentation": {"kind": "markdown", "value": " Does stuff. "} }], "activeSignature": 0, @@ -79,11 +82,12 @@ ContextPath Value[someFunc] Path someFunc argAtCursor: ~two extracted params: -[int, ~two: string=?, ~three: unit => unit, ~four: someVariant, unit] +[( + int, ~two: string=?, ~three: unit => unit, ~four: someVariant, unit] { "signatures": [{ "label": "(\n int,\n ~two: string=?,\n ~three: unit => unit,\n ~four: someVariant,\n unit,\n) => unit", - "parameters": [{"label": [4, 7], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [11, 25], "documentation": {"kind": "markdown", "value": "```rescript\noption\n```"}}, {"label": [29, 49], "documentation": {"kind": "markdown", "value": ""}}, {"label": [53, 71], "documentation": {"kind": "markdown", "value": "```rescript\nsomeVariant\n```\n```rescript\ntype someVariant = One | Two | Three\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22SignatureHelp.res%22%2C0%2C0%5D)"}}, {"label": [75, 79], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}], + "parameters": [{"label": [0, 7], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [11, 25], "documentation": {"kind": "markdown", "value": "```rescript\noption\n```"}}, {"label": [29, 49], "documentation": {"kind": "markdown", "value": ""}}, {"label": [53, 71], "documentation": {"kind": "markdown", "value": "```rescript\nsomeVariant\n```\n```rescript\ntype someVariant = One | Two | Three\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22SignatureHelp.res%22%2C0%2C0%5D)"}}, {"label": [75, 79], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}], "documentation": {"kind": "markdown", "value": " Does stuff. "} }], "activeSignature": 0, @@ -102,11 +106,12 @@ ContextPath Value[someFunc] Path someFunc argAtCursor: ~four extracted params: -[int, ~two: string=?, ~three: unit => unit, ~four: someVariant, unit] +[( + int, ~two: string=?, ~three: unit => unit, ~four: someVariant, unit] { "signatures": [{ "label": "(\n int,\n ~two: string=?,\n ~three: unit => unit,\n ~four: someVariant,\n unit,\n) => unit", - "parameters": [{"label": [4, 7], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [11, 25], "documentation": {"kind": "markdown", "value": "```rescript\noption\n```"}}, {"label": [29, 49], "documentation": {"kind": "markdown", "value": ""}}, {"label": [53, 71], "documentation": {"kind": "markdown", "value": "```rescript\nsomeVariant\n```\n```rescript\ntype someVariant = One | Two | Three\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22SignatureHelp.res%22%2C0%2C0%5D)"}}, {"label": [75, 79], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}], + "parameters": [{"label": [0, 7], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [11, 25], "documentation": {"kind": "markdown", "value": "```rescript\noption\n```"}}, {"label": [29, 49], "documentation": {"kind": "markdown", "value": ""}}, {"label": [53, 71], "documentation": {"kind": "markdown", "value": "```rescript\nsomeVariant\n```\n```rescript\ntype someVariant = One | Two | Three\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22SignatureHelp.res%22%2C0%2C0%5D)"}}, {"label": [75, 79], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}], "documentation": {"kind": "markdown", "value": " Does stuff. "} }], "activeSignature": 0, @@ -125,11 +130,12 @@ ContextPath Value[someFunc] Path someFunc argAtCursor: ~four extracted params: -[int, ~two: string=?, ~three: unit => unit, ~four: someVariant, unit] +[( + int, ~two: string=?, ~three: unit => unit, ~four: someVariant, unit] { "signatures": [{ "label": "(\n int,\n ~two: string=?,\n ~three: unit => unit,\n ~four: someVariant,\n unit,\n) => unit", - "parameters": [{"label": [4, 7], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [11, 25], "documentation": {"kind": "markdown", "value": "```rescript\noption\n```"}}, {"label": [29, 49], "documentation": {"kind": "markdown", "value": ""}}, {"label": [53, 71], "documentation": {"kind": "markdown", "value": "```rescript\nsomeVariant\n```\n```rescript\ntype someVariant = One | Two | Three\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22SignatureHelp.res%22%2C0%2C0%5D)"}}, {"label": [75, 79], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}], + "parameters": [{"label": [0, 7], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [11, 25], "documentation": {"kind": "markdown", "value": "```rescript\noption\n```"}}, {"label": [29, 49], "documentation": {"kind": "markdown", "value": ""}}, {"label": [53, 71], "documentation": {"kind": "markdown", "value": "```rescript\nsomeVariant\n```\n```rescript\ntype someVariant = One | Two | Three\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22SignatureHelp.res%22%2C0%2C0%5D)"}}, {"label": [75, 79], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}], "documentation": {"kind": "markdown", "value": " Does stuff. "} }], "activeSignature": 0, @@ -148,11 +154,11 @@ ContextPath Value[otherFunc] Path otherFunc argAtCursor: unlabelled<0> extracted params: -[string, int, float] +[(string, int, float] { "signatures": [{ "label": "(string, int, float) => unit", - "parameters": [{"label": [1, 7], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}, {"label": [9, 12], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}, {"label": [14, 19], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}] + "parameters": [{"label": [0, 7], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}, {"label": [9, 12], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}, {"label": [14, 19], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}] }], "activeSignature": 0, "activeParameter": 0 @@ -170,11 +176,11 @@ ContextPath Value[otherFunc] Path otherFunc argAtCursor: unlabelled<0> extracted params: -[string, int, float] +[(string, int, float] { "signatures": [{ "label": "(string, int, float) => unit", - "parameters": [{"label": [1, 7], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}, {"label": [9, 12], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}, {"label": [14, 19], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}] + "parameters": [{"label": [0, 7], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}, {"label": [9, 12], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}, {"label": [14, 19], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}] }], "activeSignature": 0, "activeParameter": 0 @@ -192,11 +198,11 @@ ContextPath Value[otherFunc] Path otherFunc argAtCursor: unlabelled<2> extracted params: -[string, int, float] +[(string, int, float] { "signatures": [{ "label": "(string, int, float) => unit", - "parameters": [{"label": [1, 7], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}, {"label": [9, 12], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}, {"label": [14, 19], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}] + "parameters": [{"label": [0, 7], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}, {"label": [9, 12], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}, {"label": [14, 19], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}] }], "activeSignature": 0, "activeParameter": 2 @@ -214,11 +220,11 @@ ContextPath Value[Completion, Lib, foo] Path Completion.Lib.foo argAtCursor: ~age extracted params: -[~age: int, ~name: string] +[(~age: int, ~name: string] { "signatures": [{ "label": "(~age: int, ~name: string) => string", - "parameters": [{"label": [1, 10], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [12, 25], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}] + "parameters": [{"label": [0, 10], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [12, 25], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}] }], "activeSignature": 0, "activeParameter": 0 @@ -259,11 +265,11 @@ ContextPath Value[otherFunc] Path otherFunc argAtCursor: unlabelled<1> extracted params: -[string, int, float] +[(string, int, float] { "signatures": [{ "label": "(string, int, float) => unit", - "parameters": [{"label": [1, 7], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}, {"label": [9, 12], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}, {"label": [14, 19], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}] + "parameters": [{"label": [0, 7], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}, {"label": [9, 12], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}, {"label": [14, 19], "documentation": {"kind": "markdown", "value": "```rescript\nstring\n```"}}] }], "activeSignature": 0, "activeParameter": 1 @@ -281,11 +287,11 @@ ContextPath Value[fn] Path fn argAtCursor: unlabelled<1> extracted params: -[int, string, int] +[(int, string, int] { "signatures": [{ "label": "(int, string, int) => unit", - "parameters": [{"label": [1, 4], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [6, 12], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [14, 17], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}] + "parameters": [{"label": [0, 4], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [6, 12], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [14, 17], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}] }], "activeSignature": 0, "activeParameter": 1 @@ -303,11 +309,11 @@ ContextPath Value[fn] Path fn argAtCursor: unlabelled<1> extracted params: -[int, string, int] +[(int, string, int] { "signatures": [{ "label": "(int, string, int) => unit", - "parameters": [{"label": [1, 4], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [6, 12], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [14, 17], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}] + "parameters": [{"label": [0, 4], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [6, 12], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [14, 17], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}] }], "activeSignature": 0, "activeParameter": 1 @@ -325,11 +331,11 @@ ContextPath Value[fn] Path fn argAtCursor: unlabelled<2> extracted params: -[int, string, int] +[(int, string, int] { "signatures": [{ "label": "(int, string, int) => unit", - "parameters": [{"label": [1, 4], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [6, 12], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [14, 17], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}] + "parameters": [{"label": [0, 4], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [6, 12], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [14, 17], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}] }], "activeSignature": 0, "activeParameter": 2 @@ -375,11 +381,12 @@ ContextPath Value[someFunc] Path someFunc argAtCursor: unlabelled<0> extracted params: -[int, ~two: string=?, ~three: unit => unit, ~four: someVariant, unit] +[( + int, ~two: string=?, ~three: unit => unit, ~four: someVariant, unit] { "signatures": [{ "label": "(\n int,\n ~two: string=?,\n ~three: unit => unit,\n ~four: someVariant,\n unit,\n) => unit", - "parameters": [{"label": [4, 7], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [11, 25], "documentation": {"kind": "markdown", "value": "```rescript\noption\n```"}}, {"label": [29, 49], "documentation": {"kind": "markdown", "value": ""}}, {"label": [53, 71], "documentation": {"kind": "markdown", "value": "```rescript\nsomeVariant\n```\n```rescript\ntype someVariant = One | Two | Three\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22SignatureHelp.res%22%2C0%2C0%5D)"}}, {"label": [75, 79], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}], + "parameters": [{"label": [0, 7], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}, {"label": [11, 25], "documentation": {"kind": "markdown", "value": "```rescript\noption\n```"}}, {"label": [29, 49], "documentation": {"kind": "markdown", "value": ""}}, {"label": [53, 71], "documentation": {"kind": "markdown", "value": "```rescript\nsomeVariant\n```\n```rescript\ntype someVariant = One | Two | Three\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22SignatureHelp.res%22%2C0%2C0%5D)"}}, {"label": [75, 79], "documentation": {"kind": "markdown", "value": "```rescript\nint\n```"}}], "documentation": {"kind": "markdown", "value": " Does stuff. "} }], "activeSignature": 0, diff --git a/analysis/tests/src/expected/Xform.res.txt b/analysis/tests/src/expected/Xform.res.txt index 30154b591..0af705bff 100644 --- a/analysis/tests/src/expected/Xform.res.txt +++ b/analysis/tests/src/expected/Xform.res.txt @@ -101,7 +101,6 @@ newText: Xform src/Xform.res 48:21 posCursor:[48:21] posNoWhite:[48:19] Found expr:[48:15->48:25] -posCursor:[48:21] posNoWhite:[48:19] Found expr:[48:15->48:25] Completable: Cpath Value[name] Package opens Pervasives.JsxModules.place holder Resolved opens 1 pervasives From 0a077119ce95bae910f6bfd35403fca64ab6a109 Mon Sep 17 00:00:00 2001 From: Gabriel Nordeborn Date: Fri, 15 Dec 2023 11:24:46 +0100 Subject: [PATCH 3/3] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec806af61..efcfa340a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ #### :bug: Bug Fix +- Proper default for `"uncurried"` in V11 projects. https://github.com/rescript-lang/rescript-vscode/pull/867 - Treat `result` type as a proper built in type. https://github.com/rescript-lang/rescript-vscode/pull/860 #### :nail_care: Polish