diff --git a/analysis/tests/not_compiled/expected/Diagnostics.res.txt b/analysis/tests/not_compiled/expected/Diagnostics.res.txt index f9e063a84..a5df33b71 100644 --- a/analysis/tests/not_compiled/expected/Diagnostics.res.txt +++ b/analysis/tests/not_compiled/expected/Diagnostics.res.txt @@ -1,33 +1,17 @@ - - Syntax error! - not_compiled/Diagnostics.res:1:5 - - 1 │ let = 1 + 1.0 - 2 │ let add = =2 - 3 │ lett a = 2 - - I was expecting a name for this let-binding. Example: `let message = "hello"` - - - Syntax error! - not_compiled/Diagnostics.res:2:10-11 - - 1 │ let = 1 + 1.0 - 2 │ let add = =2 - 3 │ lett a = 2 - 4 │ - - This let-binding misses an expression - - - Syntax error! - not_compiled/Diagnostics.res:3:5-6 - - 1 │ let = 1 + 1.0 - 2 │ let add = =2 - 3 │ lett a = 2 - 4 │ - 5 │ //^dia - - consecutive statements on a line must be separated by ';' or a newline +[{ + "range": {"start": {"line": 2, "character": 4}, "end": {"line": 2, "character": 6}}, + "message": "consecutive statements on a line must be separated by ';' or a newline", + "severity": 1, + "source": "ReScript" +}, { + "range": {"start": {"line": 1, "character": 9}, "end": {"line": 1, "character": 11}}, + "message": "This let-binding misses an expression", + "severity": 1, + "source": "ReScript" +}, { + "range": {"start": {"line": 0, "character": 4}, "end": {"line": 0, "character": 5}}, + "message": "I was expecting a name for this let-binding. Example: `let message = \"hello\"`", + "severity": 1, + "source": "ReScript" +}] diff --git a/analysis/tests/not_compiled/expected/DocTemplate.res.txt b/analysis/tests/not_compiled/expected/DocTemplate.res.txt index a26747100..ce8487127 100644 --- a/analysis/tests/not_compiled/expected/DocTemplate.res.txt +++ b/analysis/tests/not_compiled/expected/DocTemplate.res.txt @@ -1,23 +1,3 @@ -type a = {a: int} -// ^xfm - -type rec t = A | B -// ^xfm -and e = C -@unboxed type name = Name(string) -// ^xfm -let a = 1 -// ^xfm -let inc = x => x + 1 -// ^xfm -module T = { - // ^xfm - let b = 1 - // ^xfm -} -@module("path") -external dirname: string => string = "dirname" -//^xfm Xform not_compiled/DocTemplate.res 3:3 can't find module DocTemplate Hit: Add Documentation template diff --git a/analysis/tests/not_compiled/expected/DocTemplate.resi.txt b/analysis/tests/not_compiled/expected/DocTemplate.resi.txt index a6e2b1d6d..ef4987a7c 100644 --- a/analysis/tests/not_compiled/expected/DocTemplate.resi.txt +++ b/analysis/tests/not_compiled/expected/DocTemplate.resi.txt @@ -1,23 +1,3 @@ -type a = {a: int} -// ^xfm - -type rec t = A | B -// ^xfm -and e = C -@unboxed type name = Name(string) -// ^xfm -let a: int -// ^xfm -let inc: int => int -// ^xfm -module T: { - // ^xfm - let b: int - // ^xfm -} -@module("path") -external dirname: string => string = "dirname" -//^xfm Xform not_compiled/DocTemplate.resi 3:3 Hit: Add Documentation template diff --git a/analysis/tests/src/expected/Auto.res.txt b/analysis/tests/src/expected/Auto.res.txt index 55e440c05..78ec26d7f 100644 --- a/analysis/tests/src/expected/Auto.res.txt +++ b/analysis/tests/src/expected/Auto.res.txt @@ -1,7 +1,3 @@ -open! ShadowedBelt - -let m = List.map -// ^hov Hover src/Auto.res 2:13 {"contents": {"kind": "markdown", "value": "```rescript\n(list<'a>, 'a => 'b) => list<'b>\n```"}} diff --git a/analysis/tests/src/expected/BrokenParserCases.res.txt b/analysis/tests/src/expected/BrokenParserCases.res.txt index 9cf22529c..8a4494a65 100644 --- a/analysis/tests/src/expected/BrokenParserCases.res.txt +++ b/analysis/tests/src/expected/BrokenParserCases.res.txt @@ -1,16 +1,3 @@ -// --- BROKEN PARSER CASES --- -// This below demonstrates an issue when what you're completing is the _last_ labelled argument, and there's a unit application after it. The parser wrongly merges the unit argument as the expression of the labelled argument assignment, where is should really let the trailing unit argument be, and set a %rescript.exprhole as the expression of the assignment, just like it normally does. -// let _ = someFn(~isOff=, ()) -// ^com - -// This should parse as a single item tuple when in a pattern? -// switch s { | (t) } -// ^com - -// Here the parser eats the arrow and considers the None in the expression part of the pattern. -// let _ = switch x { | None | => None } -// ^com - Complete src/BrokenParserCases.res 2:24 posCursor:[2:24] posNoWhite:[2:23] Found expr:[2:11->2:30] Pexp_apply ...[2:11->2:17] (~isOff2:19->2:24=...[2:27->2:29]) diff --git a/analysis/tests/src/expected/CodeLens.res.txt b/analysis/tests/src/expected/CodeLens.res.txt index 0d527f00c..06472d5e4 100644 --- a/analysis/tests/src/expected/CodeLens.res.txt +++ b/analysis/tests/src/expected/CodeLens.res.txt @@ -1,14 +1,3 @@ -let add = (x, y) => x + y - -let foo = (~age, ~name) => name ++ string_of_int(age) - -let ff = (~opt1=0, ~a, ~b, (), ~opt2=0, (), ~c) => a + b + c + opt1 + opt2 - -let compFF = Completion.ff - -@react.component -let make = (~name) => React.string(name) -//^cle Code Lens src/CodeLens.res [{ "range": {"start": {"line": 9, "character": 4}, "end": {"line": 9, "character": 8}}, diff --git a/analysis/tests/src/expected/Codemod.res.txt b/analysis/tests/src/expected/Codemod.res.txt index 12e02f4e4..5e4783d5d 100644 --- a/analysis/tests/src/expected/Codemod.res.txt +++ b/analysis/tests/src/expected/Codemod.res.txt @@ -1,12 +1,3 @@ -type someTyp = [#valid | #invalid] - -let ff = (v1: someTyp, v2: someTyp) => { - let x = switch (v1, v2) { - // ^c-a (#valid, #valid) | (#invalid, _) - | (#valid, #invalid) => () - } - x -} Codemod AddMissingCasessrc/Codemod.res 3:10 switch (v1, v2) { // ^c-a (#valid, #valid) | (#invalid, _) diff --git a/analysis/tests/src/expected/CompletableComponent.res.txt b/analysis/tests/src/expected/CompletableComponent.res.txt index 50522a3d5..e69de29bb 100644 --- a/analysis/tests/src/expected/CompletableComponent.res.txt +++ b/analysis/tests/src/expected/CompletableComponent.res.txt @@ -1,15 +0,0 @@ -type status = On | Off - -@@jsxConfig({version: 4, mode: "automatic"}) -type props<'status, 'name> = {status: 'status, name: 'name} - -let make = ({status, name, _}: props) => { - ignore(status) - ignore(name) - React.null -} -let make = { - let \"CompletableComponent" = (props: props<_>) => make(props) - - \"CompletableComponent" -} diff --git a/analysis/tests/src/expected/CompletePrioritize1.res.txt b/analysis/tests/src/expected/CompletePrioritize1.res.txt index df38c76f7..b520a84a2 100644 --- a/analysis/tests/src/expected/CompletePrioritize1.res.txt +++ b/analysis/tests/src/expected/CompletePrioritize1.res.txt @@ -1,10 +1,3 @@ -module Test = { - type t = {name: int} - let add = (a: float) => a +. 1.0 -} -let a: Test.t = {name: 4} -// a-> -// ^com Complete src/CompletePrioritize1.res 5:6 posCursor:[5:6] posNoWhite:[5:5] Found expr:[5:3->0:-1] Completable: Cpath Value[a]-> diff --git a/analysis/tests/src/expected/CompletePrioritize2.res.txt b/analysis/tests/src/expected/CompletePrioritize2.res.txt index 5115ae72b..b6bea71f9 100644 --- a/analysis/tests/src/expected/CompletePrioritize2.res.txt +++ b/analysis/tests/src/expected/CompletePrioritize2.res.txt @@ -1,17 +1,3 @@ -let ax = 4 -let _ = ax -let ax = "" -let _ = ax -module Test = { - type t = {name: int} - let add = (ax: t) => ax.name + 1 -} -let ax: Test.t = {name: 4} -// ax-> -// ^com - -// ax -// ^com Complete src/CompletePrioritize2.res 9:7 posCursor:[9:7] posNoWhite:[9:6] Found expr:[9:3->0:-1] Completable: Cpath Value[ax]-> diff --git a/analysis/tests/src/expected/Completion.res.txt b/analysis/tests/src/expected/Completion.res.txt index d155e1f76..ccadf462f 100644 --- a/analysis/tests/src/expected/Completion.res.txt +++ b/analysis/tests/src/expected/Completion.res.txt @@ -1,471 +1,3 @@ -module MyList = Belt.List -// MyList.m -// ^com -// Array. -// ^com -// Array.m -// ^com - -module Dep: { - @ocaml.doc("Some doc comment") @deprecated("Use customDouble instead") - let customDouble: int => int -} = { - let customDouble = foo => foo * 2 -} - -// let cc = Dep.c -// ^com - -module Lib = { - let foo = (~age, ~name) => name ++ string_of_int(age) - let next = (~number=0, ~year) => number + year -} - -// let x = Lib.foo(~ -// ^com - -// [1,2,3]->m -// ^com - -// "abc"->toU -// ^com - -let op = Some(3) - -// op->e -// ^com - -module ForAuto = { - type t = int - let abc = (x: t, _y: int) => x - let abd = (x: t, _y: int) => x -} - -let fa: ForAuto.t = 34 -// fa-> -// ^com - -// "hello"->Js.Dict.u -// ^com - -module O = { - module Comp = { - @react.component - let make = (~first="", ~zoo=3, ~second) => React.string(first ++ second ++ string_of_int(zoo)) - } -} - -let zzz = 11 - -// let comp = x + y - -@react.component -let make = () => { - // my - // ^com - <> -} - -// Objects.object[" -// ^com - -let foo = { - let x = { - 3 - } - let y = 4 - let add = (a, b) => - switch a { - | 3 => a + b - | _ => 42 - } - let z = assert(false) - let _ = z - module Inner = { - type z = int - let v = 44 - } - exception MyException(int, string, float, array) - let _ = raise(MyException(2, "", 1.0, [])) - add((x: Inner.z), Inner.v + y) -} - -exception MyOtherException - -// children -} -// } - let forAutoRecord: forAutoRecord = assert(false) -} - -module FAO = { - let forAutoObject = {"forAutoLabel": FAR.forAutoRecord, "age": 32} -} - -// FAO.forAutoObject[" -// ^com - -// FAO.forAutoObject["forAutoLabel"]. -// ^com - -// FAO.forAutoObject["forAutoLabel"].forAuto-> -// ^com - -// FAO.forAutoObject["forAutoLabel"].forAuto->ForAuto.a -// ^com - -let name = "abc" -// let template = `My name is ${na}` -// ^com - -let notHere = " " -// ^com - -let someR = Some(r) -let _ = switch someR { -| Some(_z) => 1 -// + _z. -// ^com -| _ => 3 -} - -module SomeLocalModule = { - let aa = 10 - let bb = 20 - type zz = int -} - -// let _ = SomeLo -// ^com -// type zz = SomeLocalModule. -// ^com - -type record = { - someProp: string, - // otherProp: SomeLocalModule. - // ^com - thirdProp: string, -} - -type someLocalVariant = SomeLocalVariantItem - -// type t = SomeLocal -// ^com - -// let _ : SomeLocal -// ^com - -let _foo = _world => { - // let _ = _w - // ^com - 3 -} - -type someType = {hello: string} -// type t = SomeType(s) -// ^com - -type funRecord = { - someFun: (~name: string) => unit, - stuff: string, -} - -let funRecord: funRecord = assert(false) - -// let _ = funRecord.someFun(~ ) -// ^com - -let retAA = () => {x: 3, name: ""} - -// retAA(). -// ^com - -let ff = (~opt1=0, ~a, ~b, (), ~opt2=0, (), ~c) => a + b + c + opt1 + opt2 - -// ff(~c=1)(~ -// ^com - -// ff(~c=1)()(~ -// ^com - -// ff(~c=1, ())(~ -// ^com - -// ff(~c=1, (), ())(~ -// ^com - -// ff(~c=1, (), ~b=1)(~ -// ^com - -// ff(~opt2=1)(~ -// ^com - -type callback = (~a: int) => int - -let withCallback: (~b: int) => callback = (~b) => { - () - (~a) => a + b -} - -// withCallback(~ -// ^com - -// withCallback(~a)(~ -// ^com - -// withCallback(~b)(~ -// ^com - -let _ = -
{ - () - // let _: Res - // ^com - }} - name="abc"> - {React.string(name)} -
- -//let _ = switch Some(3) { | Some(thisIsNotSaved) -> this -// ^com - -let _ =
-// ^hov - -// let _ = FAO.forAutoObject["age"] -// ^hov - -// let _ = ff(~opt1=3) -// ^hov - -// (let _ = ff(~opt1=3)) -// ^com - -type v = This | That - -let _ = x => - switch x { - // | T - // ^com - | _ => 4 - } - -module AndThatOther = { - type v = And | ThatOther -} - -let _ = x => - switch x { - // | AndThatOther.T - // ^com - | _ => 4 - } - -// let _ = ` ${ForAuto.}` -// ^com - -// let _ = `abc ${FAO.forAutoObject[""}` -// ^com - -// let _ = `${funRecord.}` -// ^com - -let _ = _ => { - open Js - // []->ma - // ^com - () -} - -let red = "#ff0000" - -let header1 = ` - color: ${red}; ` -// ^com - -let header2 = ` - color: ${red}; - background-color: ${red}; ` -// ^com - -// let _ = `color: ${r -// ^com - -let onClick = evt => { - // SomeLocalModule. - // ^com - evt->ReactEvent.Synthetic.preventDefault - // SomeLocalModule. - // ^com - Js.log("Hello") -} - -// let _ = 123->t -// ^com - -// let _ = 123.0->t -// ^com - -let ok = Ok(true) - -// ok->g -// ^com - -type someRecordWithDeprecatedField = { - name: string, - @deprecated - someInt: int, - @deprecated("Use 'someInt'.") - someFloat: float, -} - -let rWithDepr: someRecordWithDeprecatedField = { - name: "hej", - someInt: 12, - someFloat: 12., -} - -// Should show deprecated status -// rWithDepr.so -// ^com - -type someVariantWithDeprecated = - | @deprecated DoNotUseMe | UseMeInstead | @deprecated("Use 'UseMeInstead'") AndNotMe - -// Should show deprecated status -// let v: someVariantWithDeprecated = -// ^com - -let uncurried = (. num) => num + 2 - -// let _ = uncurried(. 1)->toS -// ^com - -type withUncurried = {fn: (. int) => unit} - -// let f: withUncurried = {fn: } -// ^com - -// let someRecord = { FAR. } -// ^com Complete src/Completion.res 1:11 posCursor:[1:11] posNoWhite:[1:10] Found expr:[1:3->1:11] Pexp_ident MyList.m:[1:3->1:11] diff --git a/analysis/tests/src/expected/CompletionAttributes.res.txt b/analysis/tests/src/expected/CompletionAttributes.res.txt index ae0cbabce..3fa299ef7 100644 --- a/analysis/tests/src/expected/CompletionAttributes.res.txt +++ b/analysis/tests/src/expected/CompletionAttributes.res.txt @@ -1,42 +1,3 @@ -// @modu -// ^com - -// @module("") external doStuff: t = "test" -// ^com - -// @@js -// ^com - -// @@jsxConfig({}) -// ^com - -// @@jsxConfig({m}) -// ^com - -// @@jsxConfig({module_: }) -// ^com - -// @@jsxConfig({module_: "", }) -// ^com - -// @module({}) external doStuff: t = "default" -// ^com - -// @module({with: }) external doStuff: t = "default" -// ^com - -// @module({with: {}}) external doStuff: t = "default" -// ^com - -// @module({from: "" }) external doStuff: t = "default" -// ^com - -// @module({from: }) external doStuff: t = "default" -// ^com - -// let dd = %t -// ^com - Complete src/CompletionAttributes.res 0:8 Attribute id:modu:[0:3->0:8] label:modu Completable: Cdecorator(modu) diff --git a/analysis/tests/src/expected/CompletionDicts.res.txt b/analysis/tests/src/expected/CompletionDicts.res.txt index 0755fdb8e..c3a423d50 100644 --- a/analysis/tests/src/expected/CompletionDicts.res.txt +++ b/analysis/tests/src/expected/CompletionDicts.res.txt @@ -1,19 +1,3 @@ -// let dict = Js.Dict.fromArray([]) -// ^com - -// let dict = Js.Dict.fromArray([()]) -// ^com - -// let dict = Js.Dict.fromArray([("key", )]) -// ^com - -// ^in+ -let dict = Js.Dict.fromArray([ - ("key", true), - // ("key2", ) - // ^com -]) -// ^in- Complete src/CompletionDicts.res 0:33 posCursor:[0:33] posNoWhite:[0:32] Found expr:[0:14->0:35] Pexp_apply ...[0:14->0:31] (...[0:32->0:34]) diff --git a/analysis/tests/src/expected/CompletionExpressions.res.txt b/analysis/tests/src/expected/CompletionExpressions.res.txt index 343473fa3..1cddba3b7 100644 --- a/analysis/tests/src/expected/CompletionExpressions.res.txt +++ b/analysis/tests/src/expected/CompletionExpressions.res.txt @@ -1,367 +1,3 @@ -let s = true -let f = Some([false]) - -// switch (s, f) { | } -// ^com - -type otherRecord = { - someField: int, - otherField: string, -} - -type rec someRecord = { - age: int, - offline: bool, - online: option, - variant: someVariant, - polyvariant: somePolyVariant, - nested: option, -} -and someVariant = One | Two | Three(int, string) -and somePolyVariant = [#one | #two(bool) | #three(someRecord, bool)] - -let fnTakingRecord = (r: someRecord) => { - ignore(r) -} - -// let _ = fnTakingRecord({}) -// ^com - -// let _ = fnTakingRecord({n}) -// ^com - -// let _ = fnTakingRecord({offline: }) -// ^com - -// let _ = fnTakingRecord({age: 123, }) -// ^com - -// let _ = fnTakingRecord({age: 123, offline: true}) -// ^com - -// let _ = fnTakingRecord({age: 123, nested: }) -// ^com - -// let _ = fnTakingRecord({age: 123, nested: {}}) -// ^com - -// let _ = fnTakingRecord({age: 123, nested: Some({})}) -// ^com - -// let _ = fnTakingRecord({age: 123, variant: }) -// ^com - -// let _ = fnTakingRecord({age: 123, variant: O }) -// ^com - -// let _ = fnTakingRecord({age: 123, polyvariant: #three() }) -// ^com - -// let _ = fnTakingRecord({age: 123, polyvariant: #three({}, ) }) -// ^com - -// let _ = fnTakingRecord({age: 123, polyvariant: #three({}, t) }) -// ^com - -let fnTakingArray = (arr: array>) => { - ignore(arr) -} - -// let _ = fnTakingArray() -// ^com - -// let _ = fnTakingArray([]) -// ^com - -// let _ = fnTakingArray(s) -// ^com - -// let _ = fnTakingArray([Some()]) -// ^com - -// let _ = fnTakingArray([None, ]) -// ^com - -// let _ = fnTakingArray([None, , None]) -// ^com - -let someBoolVar = true - -// let _ = fnTakingRecord({offline: so }) -// ^com - -let fnTakingOtherRecord = (r: otherRecord) => { - ignore(r) -} - -// let _ = fnTakingOtherRecord({otherField: }) -// ^com - -type recordWithOptionalField = { - someField: int, - someOptField?: bool, -} - -let fnTakingRecordWithOptionalField = (r: recordWithOptionalField) => { - ignore(r) -} - -// let _ = fnTakingRecordWithOptionalField({someOptField: }) -// ^com -type recordWithOptVariant = {someVariant: option} - -let fnTakingRecordWithOptVariant = (r: recordWithOptVariant) => { - ignore(r) -} - -// let _ = fnTakingRecordWithOptVariant({someVariant: }) -// ^com - -type variantWithInlineRecord = - WithInlineRecord({someBoolField: bool, otherField: option, nestedRecord: otherRecord}) - -let fnTakingInlineRecord = (r: variantWithInlineRecord) => { - ignore(r) -} - -// let _ = fnTakingInlineRecord(WithInlineRecord()) -// ^com - -// let _ = fnTakingInlineRecord(WithInlineRecord({})) -// ^com - -// let _ = fnTakingInlineRecord(WithInlineRecord({s})) -// ^com - -// let _ = fnTakingInlineRecord(WithInlineRecord({nestedRecord: })) -// ^com - -// let _ = fnTakingInlineRecord(WithInlineRecord({nestedRecord: {} })) -// ^com - -type variant = First | Second(bool) - -let fnTakingCallback = ( - cb: unit => unit, - cb2: bool => unit, - cb3: ReactEvent.Mouse.t => unit, - cb4: (~on: bool, ~off: bool=?, variant) => int, - cb5: (bool, option, bool) => unit, - cb6: (~on: bool=?, ~off: bool=?, unit) => int, -) => { - let _ = cb - let _ = cb2 - let _ = cb3 - let _ = cb4 - let _ = cb5 - let _ = cb6 -} - -// fnTakingCallback() -// ^com - -// fnTakingCallback(a) -// ^com - -// fnTakingCallback(a, ) -// ^com - -// fnTakingCallback(a, b, ) -// ^com - -// fnTakingCallback(a, b, c, ) -// ^com - -// fnTakingCallback(a, b, c, d, ) -// ^com - -// fnTakingCallback(a, b, c, d, e, ) -// ^com - -let something = { - let second = true - let second2 = 1 - ignore(second) - ignore(second2) - Js.log(s) - // ^com -} - -let fff: recordWithOptionalField = { - someField: 123, - someOptField: true, -} - -ignore(fff) - -// fff.someOpt -// ^com - -type someTyp = {test: bool} - -let takesCb = cb => { - cb({test: true}) -} - -// takesCb() -// ^com - -module Environment = { - type t = {hello: bool} -} - -let takesCb2 = cb => { - cb({Environment.hello: true}) -} - -// takesCb2() -// ^com - -type apiCallResult = {hi: bool} - -let takesCb3 = cb => { - cb({hi: true}) -} - -// takesCb3() -// ^com - -let takesCb4 = cb => { - cb(Some({hi: true})) -} - -// takesCb4() -// ^com - -let takesCb5 = cb => { - cb([Some({hi: true})]) -} - -// takesCb5() -// ^com - -module RecordSourceSelectorProxy = { - type t -} - -@val -external commitLocalUpdate: (~updater: RecordSourceSelectorProxy.t => unit) => unit = - "commitLocalUpdate" - -// commitLocalUpdate(~updater=) -// ^com - -let fnTakingAsyncCallback = (cb: unit => promise) => { - let _ = cb -} - -// fnTakingAsyncCallback() -// ^com - -let arr = ["hello"] - -// arr->Belt.Array.map() -// ^com - -type exoticPolyvariant = [#"some exotic"] - -let takesExotic = (e: exoticPolyvariant) => { - ignore(e) -} - -// takesExotic() -// ^com - -let fnTakingPolyVariant = (a: somePolyVariant) => { - ignore(a) -} - -// fnTakingPolyVariant() -// ^com - -// fnTakingPolyVariant(#) -// ^com - -// fnTakingPolyVariant(#o) -// ^com - -// fnTakingPolyVariant(o) -// ^com - -module SuperInt: { - type t - let increment: (t, int) => t - let decrement: (t, int => int) => t - let make: int => t - let toInt: t => int -} = { - type t = int - let increment = (t, num) => t + num - let decrement = (t, decrementer) => decrementer(t) - let make = t => t - let toInt = t => t -} - -type withIntLocal = {superInt: SuperInt.t} - -// let withInt: withIntLocal = {superInt: } -// ^com - -// CompletionSupport.makeTestHidden() -// ^com - -open CompletionSupport -// CompletionSupport.makeTestHidden() -// ^com - -let mkStuff = (r: Js.Re.t) => { - ignore(r) - "hello" -} - -// mkStuff() -// ^com - -module Money: { - type t - - let zero: t - - let nonTType: string - - let make: unit => t - - let fromInt: int => t - - let plus: (t, t) => t -} = { - type t = string - - let zero: t = "0" - - let nonTType = "0" - - let make = (): t => zero - - let fromInt = (int): t => int->Js.Int.toString - - let plus = (m1, _) => m1 -} - -let tArgCompletionTestFn = (_tVal: Money.t) => () - -// tArgCompletionTestFn() -// ^com - -let labeledTArgCompletionTestFn = (~tVal as _: Money.t) => () - -// labeledTArgCompletionTestFn(~tVal=) -// ^com - -let someTyp: someTyp = {test: true} - -// switch someTyp. { | _ => () } -// ^com Complete src/CompletionExpressions.res 3:20 XXX Not found! Completable: Cpattern CTuple(Value[s], Value[f]) diff --git a/analysis/tests/src/expected/CompletionFunctionArguments.res.txt b/analysis/tests/src/expected/CompletionFunctionArguments.res.txt index 98dd8dc1d..b84d25a27 100644 --- a/analysis/tests/src/expected/CompletionFunctionArguments.res.txt +++ b/analysis/tests/src/expected/CompletionFunctionArguments.res.txt @@ -1,128 +1,3 @@ -let someFn = (~isOn, ~isOff=false, ()) => { - if isOn && !isOff { - "on" - } else { - "off" - } -} - -let tLocalVar = false - -// let _ = someFn(~isOn=) -// ^com - -// let _ = someFn(~isOn=t) -// ^com - -// let _ = someFn(~isOff=) -// ^com - -let _ = - someFn( - ~isOn={ - // switch someFn(~isOn=) - // ^com - true - }, - ... - ) - -let someOtherFn = (includeName, age, includeAge) => { - "Hello" ++ - (includeName ? " Some Name" : "") ++ - ", you are age " ++ - Belt.Int.toString(includeAge ? age : 0) -} - -// let _ = someOtherFn(f) -// ^com - -module OIncludeMeInCompletions = {} - -type someVariant = One | Two | Three(int, string) - -let someFnTakingVariant = ( - configOpt: option, - ~configOpt2=One, - ~config: someVariant, -) => { - ignore(config) - ignore(configOpt) - ignore(configOpt2) -} - -// let _ = someFnTakingVariant(~config=) -// ^com - -// let _ = someFnTakingVariant(~config=O) -// ^com - -// let _ = someFnTakingVariant(So) -// ^com - -// let _ = someFnTakingVariant(~configOpt2=O) -// ^com - -// let _ = someOtherFn() -// ^com - -// let _ = someOtherFn(1, 2, ) -// ^com - -// let _ = 1->someOtherFn(1, t) -// ^com - -let fnTakingTuple = (arg: (int, int, float)) => { - ignore(arg) -} - -// let _ = fnTakingTuple() -// ^com - -type someRecord = { - age: int, - offline: bool, - online: option, -} - -let fnTakingRecord = (r: someRecord) => { - ignore(r) -} - -// let _ = fnTakingRecord({}) -// ^com - -module FineModule = { - type t = { - online: bool, - somethingElse: string, - } - - let setToFalse = (t: t) => { - ...t, - online: false, - } -} - -let _ = -
{ - let reassignedWorks = thisGetsBrokenLoc - ignore(reassignedWorks) - // thisGetsBrokenLoc->a - // ^com - // reassignedWorks->a - // ^com - }} - /> - -let fineModuleVal = { - FineModule.online: true, - somethingElse: "", -} - -// makeItem(~changefreq=Monthly, ~lastmod=fineModuleVal->, ~priority=Low) -// ^com Complete src/CompletionFunctionArguments.res 10:24 posCursor:[10:24] posNoWhite:[10:23] Found expr:[10:11->10:25] Pexp_apply ...[10:11->10:17] (~isOn10:19->10:23=...__ghost__[0:-1->0:-1]) diff --git a/analysis/tests/src/expected/CompletionInferValues.res.txt b/analysis/tests/src/expected/CompletionInferValues.res.txt index 493c6b217..356a23819 100644 --- a/analysis/tests/src/expected/CompletionInferValues.res.txt +++ b/analysis/tests/src/expected/CompletionInferValues.res.txt @@ -1,172 +1,3 @@ -let getBool = () => true -let getInt = () => 123 - -type someRecord = {name: string, age: int} - -let someFnWithCallback = (cb: (~num: int, ~someRecord: someRecord, ~isOn: bool) => unit) => { - let _ = cb -} - -let reactEventFn = (cb: ReactEvent.Mouse.t => unit) => { - let _ = cb -} - -@val external getSomeRecord: unit => someRecord = "getSomeRecord" - -// let x = 123; let aliased = x; aliased->f -// ^com - -// let x = getSomeRecord(); x. -// ^com - -// let x = getSomeRecord(); let aliased = x; aliased. -// ^com - -// someFnWithCallback((~someRecord, ~num, ~isOn) => someRecord.) -// ^com - -// let aliasedFn = someFnWithCallback; aliasedFn((~num, ~someRecord, ~isOn) => someRecord.) -// ^com - -// reactEventFn(event => { event->pr }); -// ^com - -module Div = { - @react.component - let make = (~onMouseEnter: option unit>=?) => { - let _ = onMouseEnter - React.null - } -} - -// let _ =
{ event->pr }} /> -// ^com - -// let _ =
{ event->pr }} /> -// ^com - -// let _ =
{ let btn = event->JsxEvent.Mouse.button; btn->t }} /> -// ^com - -// let _ =
{ let btn = event->JsxEvent.Mouse.button->Belt.Int.toString; btn->spl }} /> -// ^com - -// let _ =
{ let btn = event->JsxEvent.Mouse.button->Belt.Int.toString->Js.String2.split("/"); btn->ma }} /> -// ^com - -// let x: someRecord = {name: "Hello", age: 123}; x. -// ^com - -type someVariant = One | Two | Three(int, string) -type somePolyVariant = [#one | #two | #three(int, string)] -type someNestedRecord = {someRecord: someRecord} - -type someRecordWithNestedStuff = { - things: string, - someInt: int, - srecord: someRecord, - nested: someNestedRecord, - someStuff: bool, -} - -type otherNestedRecord = { - someRecord: someRecord, - someTuple: (someVariant, int, somePolyVariant), - optRecord: option, -} - -// Destructure record -// let x: someRecordWithNestedStuff = Obj.magic(); let {srecord} = x; srecord. -// ^com - -// Follow aliased -// let x: someRecordWithNestedStuff = Obj.magic(); let {nested: aliased} = x; aliased. -// ^com - -// Follow nested record -// let x: someRecordWithNestedStuff = Obj.magic(); let {srecord, nested: {someRecord}} = x; someRecord. -// ^com - -// Destructure string -// let x: someRecordWithNestedStuff = Obj.magic(); let {things} = x; things->slic -// ^com - -// Destructure int -// let x: someRecordWithNestedStuff = Obj.magic(); let {someInt} = x; someInt->toS -// ^com - -// Follow tuples -// let x: otherNestedRecord = Obj.magic(); let {someTuple} = x; let (_, someInt, _) = someTuple; someInt->toS -// ^com - -// Same as above, but follow in switch case -// let x: otherNestedRecord; switch x { | {someTuple} => let (_, someInt, _) = someTuple; someInt->toS } -// ^com - -// Follow variant payloads -// let x: otherNestedRecord; switch x { | {someTuple:(Three(_, str), _, _)} => str->slic } -// ^com - -// Follow polyvariant payloads -// let x: otherNestedRecord; switch x { | {someTuple:(_, _, #three(_, str))} => str->slic } -// ^com - -// Follow options -// let x: otherNestedRecord; switch x { | {optRecord:Some({name})} => name->slic } -// ^com - -// Follow arrays -// let x: array; switch x { | [inner] => inner.s } -// ^com - -// Infer top level return -// let x = 123; switch x { | 123 => () | v => v->toSt } -// ^com - -let fnWithRecordCallback = (cb: someRecord => unit) => { - let _ = cb -} - -// Complete pattern of function parameter -// fnWithRecordCallback(({}) => {()}) -// ^com - -let fn2 = (~cb: CompletionSupport.Nested.config => unit) => { - let _ = cb -} - -// fn2(~cb=({root}) => {root-> }) -// ^com - -type sameFileRecord = {root: CompletionSupport.Test.t, test: int} - -let fn3 = (~cb: sameFileRecord => unit) => { - let _ = cb -} - -// fn3(~cb=({root}) => {root-> }) -// ^com - -// Handles pipe chains as input for switch -// let x = 123; switch x->Belt.Int.toString { | } -// ^com - -// Handles pipe chains as input for switch -// let x = 123; switch x->Belt.Int.toString->Js.String2.split("/") { | } -// ^com - -// Regular completion works -// let renderer = CompletionSupport2.makeRenderer(~prepare=() => "hello",~render=({support}) => {support.},()) -// ^com - -// But pipe completion gets the wrong completion path. Should be `ReactDOM.Client.Root.t`, but ends up being `CompletionSupport2.ReactDOM.Client.Root.t`. -// let renderer = CompletionSupport2.makeRenderer(~prepare=() => "hello",~render=({support:{root}}) => {root->},()) -// ^com - -// Handles reusing the same name already in scope for bindings -let res = 1 -// switch res { | res => res } -// ^hov Complete src/CompletionInferValues.res 15:43 posCursor:[15:43] posNoWhite:[15:42] Found expr:[15:33->15:43] Completable: Cpath Value[aliased]->f diff --git a/analysis/tests/src/expected/CompletionJsx.res.txt b/analysis/tests/src/expected/CompletionJsx.res.txt index f6da05726..65c5e9e89 100644 --- a/analysis/tests/src/expected/CompletionJsx.res.txt +++ b/analysis/tests/src/expected/CompletionJsx.res.txt @@ -1,94 +1,3 @@ -let someString = "hello" -ignore(someString) - -// someString->st -// ^com - -module SomeComponent = { - @react.component - let make = (~someProp) => { - let someInt = 12 - let someArr = [React.null] - ignore(someInt) - ignore(someArr) - // someString->st - // ^com -
- {React.string(someProp)} -
{React.null}
- // {someString->st} - // ^com - // {"Some string"->st} - // ^com - // {"Some string"->Js.String2.trim->st} - // ^com - // {someInt->} - // ^com - // {12->} - // ^com - // {someArr->a} - // ^com - // - } -} - -module CompWithoutJsxPpx = { - type props = {name: string} - - let make = ({name}) => { - ignore(name) - React.null - } -} - -// -// ^com - -//

Jsx.element = "createElement" -} - -// { - ignore(time) - name ++ age - } -} - -// { - React.string((_type :> string)) - } -} - -// -// ^com Complete src/CompletionJsx.res 3:17 posCursor:[3:17] posNoWhite:[3:16] Found expr:[3:3->3:17] Completable: Cpath Value[someString]->st diff --git a/analysis/tests/src/expected/CompletionJsxProps.res.txt b/analysis/tests/src/expected/CompletionJsxProps.res.txt index 69d6ba6e0..7175c70e4 100644 --- a/analysis/tests/src/expected/CompletionJsxProps.res.txt +++ b/analysis/tests/src/expected/CompletionJsxProps.res.txt @@ -1,49 +1,3 @@ -// let _ = -// ^com - -// let _ =
-// ^com - -// Should wrap in {} -// let _ = Js.import(CompletableComponent.make) - let make = React.lazy_(loadComponent) -} - -// let _ = 0:47] JSX 0:43] on[0:44->0:46]=...__ghost__[0:-1->0:-1]> _children:None diff --git a/analysis/tests/src/expected/CompletionPattern.res.txt b/analysis/tests/src/expected/CompletionPattern.res.txt index 2c61e7dc4..99b8b188d 100644 --- a/analysis/tests/src/expected/CompletionPattern.res.txt +++ b/analysis/tests/src/expected/CompletionPattern.res.txt @@ -1,235 +1,3 @@ -let v = (true, Some(false), (true, true)) - -let _ = switch v { -| (true, _, _) => 1 -| _ => 2 -} - -// switch v { -// ^com - -// switch v { | } -// ^com - -// switch v { | (t, _) } -// ^com - -// switch v { | (_, _, (f, _)) } -// ^com - -let x = true - -// switch x { | -// ^com - -// switch x { | t -// ^com - -type nestedRecord = {nested: bool} - -type rec someRecord = { - first: int, - second: (bool, option), - optThird: option<[#first | #second(someRecord)]>, - nest: nestedRecord, -} - -let f: someRecord = { - first: 123, - second: (true, None), - optThird: None, - nest: {nested: true}, -} - -let z = (f, true) -ignore(z) - -// switch f { | } -// ^com - -// switch f { | {}} -// ^com - -// switch f { | {first, , second }} -// ^com - -// switch f { | {fi}} -// ^com - -// switch z { | ({o}, _)} -// ^com - -// switch f { | {nest: }} -// ^com - -// switch f { | {nest: {}}} -// ^com - -let _ = switch f { -| {first: 123, nest} => - () - // switch nest { | {}} - // ^com - nest.nested -| _ => false -} - -// let {} = f -// ^com - -// let {nest: {n}}} = f -// ^com - -type someVariant = One | Two(bool) | Three(someRecord, bool) - -let z = Two(true) -ignore(z) - -// switch z { | Two()} -// ^com - -// switch z { | Two(t)} -// ^com - -// switch z { | Three({})} -// ^com - -// switch z { | Three({}, t)} -// ^com - -type somePolyVariant = [#one | #two(bool) | #three(someRecord, bool)] -let b: somePolyVariant = #two(true) -ignore(b) - -// switch b { | #two()} -// ^com - -// switch b { | #two(t)} -// ^com - -// switch b { | #three({})} -// ^com - -// switch b { | #three({}, t)} -// ^com - -let c: array = [] -ignore(c) - -// switch c { | } -// ^com - -// switch c { | [] } -// ^com - -let o = Some(true) -ignore(o) - -// switch o { | Some() } -// ^com - -type multiPayloadVariant = Test(int, bool, option, array) - -let p = Test(1, true, Some(false), []) - -// switch p { | Test(1, )} -// ^com - -// switch p { | Test(1, true, )} -// ^com - -// switch p { | Test(1, , None)} -// ^com - -// switch p { | Test(1, true, None, )} -// ^com - -type multiPayloadPolyVariant = [#test(int, bool, option, array)] - -let v: multiPayloadPolyVariant = #test(1, true, Some(false), []) - -// switch v { | #test(1, )} -// ^com - -// switch v { | #test(1, true, )} -// ^com - -// switch v { | #test(1, , None)} -// ^com - -// switch v { | #test(1, true, None, )} -// ^com - -let s = (true, Some(true), [false]) - -// switch s { | () } -// ^com - -// switch s { | (true, ) } -// ^com - -// switch s { | (true, , []) } -// ^com - -// switch s { | (true, []) => () | } -// ^com - -// switch s { | (true, []) => () | (true, , []) } -// ^com - -// switch z { | One | } -// ^com - -// switch z { | One | Two(true | ) } -// ^com - -// switch z { | One | Three({test: true}, true | ) } -// ^com - -// switch b { | #one | #two(true | ) } -// ^com - -// switch b { | #one | #three({test: true}, true | ) } -// ^com - -// switch s { | (true, _, []) } -// ^com - -type recordWithFn = {someFn: unit => unit} - -let ff: recordWithFn = {someFn: () => ()} - -// switch ff { | {someFn: }} -// ^com - -let xn: exn = Obj.magic() - -// switch xn { | } -// ^com - -let getThing = async () => One - -// switch await getThing() { | } -// ^com - -let res: result = Ok(One) - -// switch res { | Ok() } -// ^com - -// switch res { | Error() } -// ^com - -@react.component -let make = (~thing: result) => { - switch thing { - | Ok(Three(r, _)) => - let _x = r - // switch r { | {first, }} - // ^com - | _ => () - } -} Complete src/CompletionPattern.res 7:13 posCursor:[7:13] posNoWhite:[7:12] Found expr:[7:3->7:13] [] diff --git a/analysis/tests/src/expected/CompletionPipeChain.res.txt b/analysis/tests/src/expected/CompletionPipeChain.res.txt index bf583c6e0..91f6ca0e1 100644 --- a/analysis/tests/src/expected/CompletionPipeChain.res.txt +++ b/analysis/tests/src/expected/CompletionPipeChain.res.txt @@ -1,108 +1,3 @@ -module Integer: { - type t - let increment: (t, int) => t - let decrement: (t, int => int) => t - let make: int => t - let toInt: t => int -} = { - type t = int - let increment = (t, num) => t + num - let decrement = (t, decrementer) => decrementer(t) - let make = t => t - let toInt = t => t -} - -module SuperFloat: { - type t - let fromInteger: Integer.t => t - let toInteger: t => Integer.t -} = { - type t = float - let fromInteger = t => t->Integer.toInt->Belt.Float.fromInt - let toInteger = t => t->Belt.Float.toInt->Integer.make -} - -let toFlt = i => i->SuperFloat.fromInteger -let int = Integer.make(1) -let f = int->Integer.increment(2) -// let _ = int-> -// ^com - -// let _ = int->toFlt-> -// ^com - -// let _ = int->Integer.increment(2)-> -// ^com - -// let _ = Integer.increment(int, 2)-> -// ^com - -// let _ = int->Integer.decrement(t => t - 1)-> -// ^com - -// let _ = int->Integer.increment(2)->Integer.decrement(t => t - 1)-> -// ^com - -// let _ = int->Integer.increment(2)->SuperFloat.fromInteger-> -// ^com - -// let _ = int->Integer.increment(2)->SuperFloat.fromInteger->t -// ^com - -// let _ = int->Integer.increment(2)->Integer.toInt->CompletionSupport.Test.make-> -// ^com - -// let _ = CompletionSupport.Test.make(1)->CompletionSupport.Test.addSelf(2)-> -// ^com - -let _ = [123]->Js.Array2.forEach(v => Js.log(v)) -// -> -// ^com - -let _ = [123]->Belt.Array.reduce(0, (acc, curr) => acc + curr) -// ->t -// ^com - -type aliasedType = CompletionSupport.Test.t - -let aliased: aliasedType = {name: 123} -let notAliased: CompletionSupport.Test.t = {name: 123} - -// aliased-> -// ^com - -// notAliased-> -// ^com - -let renderer = CompletionSupport2.makeRenderer( - ~prepare=() => "hello", - ~render=props => { - ignore(props) - - // Doesn't work when tried through this chain. Presumably because it now goes through multiple different files. - // props.support.root->ren - // ^com - let root = props.support.root - ignore(root) - - // Works here though when it's lifted out. Probably because it only goes through one file...? - // root->ren - // ^com - React.null - }, - (), -) - -// Console.log(int->) -// ^com - -// Console.log(int->t) -// ^com - -let r = %re("/t/g") - -// r->la -// ^com Complete src/CompletionPipeChain.res 27:16 posCursor:[27:16] posNoWhite:[27:15] Found expr:[27:11->0:-1] Completable: Cpath Value[int]-> diff --git a/analysis/tests/src/expected/CompletionPipeSubmodules.res.txt b/analysis/tests/src/expected/CompletionPipeSubmodules.res.txt index 98f964fe1..73f9ab4a5 100644 --- a/analysis/tests/src/expected/CompletionPipeSubmodules.res.txt +++ b/analysis/tests/src/expected/CompletionPipeSubmodules.res.txt @@ -1,48 +1,3 @@ -module A = { - module B1 = { - type b1 = B1 - let xx = B1 - } - module B2 = { - let yy = 20 - } - type t = {v: B1.b1} - let x = {v: B1.B1} -} - -// let _ = A.B1.xx-> -// ^com -// b1 seen from B1 is A.B1.b1 - -// let _ = A.x.v-> -// ^com -// B1.b1 seen from A is A.B1.b1 - -module C = { - type t = C -} - -module D = { - module C2 = { - type t2 = C2 - } - - type d = {v: C.t, v2: C2.t2} - let d = {v: C.C, v2: C2.C2} -} - -module E = { - type e = {v: D.d} - let e = {v: D.d} -} - -// let _ = E.e.v.v-> -// ^com -// C.t seen from D is C.t - -// let _ = E.e.v.v2-> -// ^com -// C2.t2 seen from D is D.C2.t2 Complete src/CompletionPipeSubmodules.res 12:20 posCursor:[12:20] posNoWhite:[12:19] Found expr:[12:11->20:8] Completable: Cpath Value[A, B1, xx]-> diff --git a/analysis/tests/src/expected/CompletionResolve.res.txt b/analysis/tests/src/expected/CompletionResolve.res.txt index b242f0f81..d0492d217 100644 --- a/analysis/tests/src/expected/CompletionResolve.res.txt +++ b/analysis/tests/src/expected/CompletionResolve.res.txt @@ -1,7 +1,3 @@ -// ^cre Belt_Array - -// ^cre ModuleStuff - Completion resolve: Belt_Array "\nUtilities for `Array` functions.\n\n### Note about index syntax\n\nCode like `arr[0]` does *not* compile to JavaScript `arr[0]`. Reason transforms\nthe `[]` index syntax into a function: `Array.get(arr, 0)`. By default, this\nuses the default standard library's `Array.get` function, which may raise an\nexception if the index isn't found. If you `open Belt`, it will use the\n`Belt.Array.get` function which returns options instead of raising exceptions. \n[See this for more information](../belt.mdx#array-access-runtime-safety).\n" diff --git a/analysis/tests/src/expected/CompletionSupport.res.txt b/analysis/tests/src/expected/CompletionSupport.res.txt index 3c15a0a97..e69de29bb 100644 --- a/analysis/tests/src/expected/CompletionSupport.res.txt +++ b/analysis/tests/src/expected/CompletionSupport.res.txt @@ -1,42 +0,0 @@ -module Test = { - type t = {name: int} - let add = (ax: t) => ax.name + 1 - let addSelf = (ax: t) => {name: ax.name + 1} - let make = (name: int): t => {name: name} -} - -module TestHidden: { - type t - let make: int => t - let self: t => t -} = { - type t = {name: int} - let make = (name: int): t => {name: name} - let self = t => t -} - -type testVariant = One | Two | Three(int) - -module TestComponent = { - @react.component - let make = ( - ~on: bool, - ~test: testVariant, - ~testArr: array, - ~polyArg: option<[#one | #two | #two2 | #three(int, bool)]>=?, - ) => { - ignore(on) - ignore(test) - ignore(testArr) - ignore(polyArg) - React.null - } -} - -module Nested = { - type config = {root: ReactDOM.Client.Root.t} -} - -type options = {test: TestHidden.t} - -let makeTestHidden = t => TestHidden.self(t) diff --git a/analysis/tests/src/expected/CompletionSupport2.res.txt b/analysis/tests/src/expected/CompletionSupport2.res.txt index 925fc5d57..e69de29bb 100644 --- a/analysis/tests/src/expected/CompletionSupport2.res.txt +++ b/analysis/tests/src/expected/CompletionSupport2.res.txt @@ -1,17 +0,0 @@ -module Internal = { - type prepareProps<'prepared> = { - someName: string, - support: CompletionSupport.Nested.config, - prepared: 'prepared, - } -} - -let makeRenderer = ( - ~prepare: unit => 'prepared, - ~render: Internal.prepareProps<'prepared> => React.element, - (), -) => { - let _ = prepare - let _ = render - "123" -} diff --git a/analysis/tests/src/expected/CompletionTypeAnnotation.res.txt b/analysis/tests/src/expected/CompletionTypeAnnotation.res.txt index 84bbce9f7..b00084e7f 100644 --- a/analysis/tests/src/expected/CompletionTypeAnnotation.res.txt +++ b/analysis/tests/src/expected/CompletionTypeAnnotation.res.txt @@ -1,60 +1,3 @@ -type someRecord = { - age: int, - name: string, -} - -type someVariant = One | Two(bool) - -type somePolyVariant = [#one | #two(bool)] - -// let x: someRecord = -// ^com - -// let x: someRecord = {} -// ^com - -// let x: someVariant = -// ^com - -// let x: someVariant = O -// ^com - -// let x: somePolyVariant = -// ^com - -// let x: somePolyVariant = #o -// ^com - -type someFunc = (int, string) => bool - -// let x: someFunc = -// ^com - -type someTuple = (bool, option) - -// let x: someTuple = -// ^com - -// let x: someTuple = (true, ) -// ^com - -// let x: option = -// ^com - -// let x: option = Some() -// ^com - -// let x: array = -// ^com - -// let x: array = [] -// ^com - -// let x: array> = -// ^com - -// let x: option> = Some([]) -// ^com Complete src/CompletionTypeAnnotation.res 9:22 XXX Not found! Completable: Cexpression Type[someRecord] diff --git a/analysis/tests/src/expected/CompletionTypeT.res.txt b/analysis/tests/src/expected/CompletionTypeT.res.txt index 8c7160939..30c972299 100644 --- a/analysis/tests/src/expected/CompletionTypeT.res.txt +++ b/analysis/tests/src/expected/CompletionTypeT.res.txt @@ -1,12 +1,3 @@ -let date = Some(Js.Date.make()) - -type withDate = {date: Js.Date.t} - -// let x = switch date { | } -// ^com - -// let x: withDate = {date: } -// ^com Complete src/CompletionTypeT.res 4:26 XXX Not found! Completable: Cpattern Value[date] diff --git a/analysis/tests/src/expected/Component.res.txt b/analysis/tests/src/expected/Component.res.txt index aa3f50cb0..e69de29bb 100644 --- a/analysis/tests/src/expected/Component.res.txt +++ b/analysis/tests/src/expected/Component.res.txt @@ -1,2 +0,0 @@ -@react.component -let make = () => React.null diff --git a/analysis/tests/src/expected/Component.resi.txt b/analysis/tests/src/expected/Component.resi.txt index 1ca44ce26..e69de29bb 100644 --- a/analysis/tests/src/expected/Component.resi.txt +++ b/analysis/tests/src/expected/Component.resi.txt @@ -1,2 +0,0 @@ -@react.component -let make: unit => React.element diff --git a/analysis/tests/src/expected/CreateInterface.res.txt b/analysis/tests/src/expected/CreateInterface.res.txt index b7ae7894b..4e1212948 100644 --- a/analysis/tests/src/expected/CreateInterface.res.txt +++ b/analysis/tests/src/expected/CreateInterface.res.txt @@ -1,148 +1,3 @@ -// ^int - -type r = {name: string, age: int} - -let add = (~x, ~y) => x + y - -@react.component -let make = (~name) => React.string(name) - -module Other = { - @react.component - let otherComponentName = (~name) => React.string(name) -} - -module Mod = { - @react.component - let make = (~name) => React.string(name) -} - -module type ModTyp = { - @react.component - let make: (~name: string) => React.element -} - -@module("path") external dirname: string => string = "dirname" - -@module("path") @variadic -external join: array => string = "join" - -@val -external padLeft: ( - string, - @unwrap - [ - | #Str(string) - | #Int(int) - ], -) => string = "padLeft" - -@inline -let f1 = 10 - -@inline let f2 = "some string" - -@genType @inline -let f3 = 10 - -@genType @inline -let f4 = "some string" - -@genType @inline let f5 = 5.5 - -module RFS = { - @module("fs") - external readFileSync: ( - ~name: string, - @string - [ - | #utf8 - | @as("ascii") #useAscii - ], - ) => string = "readFileSync" -} - -module Functor = () => { - @react.component - let make = () => React.null -} - -module type FT = { - module Functor: ( - X: { - let a: int - @react.component - let make: (~name: string) => React.element - let b: int - }, - Y: ModTyp, - ) => - { - @react.component - let make: (~name: string) => React.element - } -} - -module NormaList = List -open Belt -module BeltList = List - -module type MT2 = ModTyp - -module rec RM: ModTyp = D -and D: ModTyp = Mod - -module type OptT = { - @react.component - let withOpt1: (~x: int=?, ~y: int) => int - - module type Opt2 = { - @react.component - let withOpt2: (~x: int=?, ~y: int) => int - } - - module type Opt3 = { - @react.component - let withOpt3: (~x: option, ~y: int) => int - } -} - -module Opt = { - @react.component - let withOpt1 = (~x=3, ~y) => x + y - - module Opt2 = { - @react.component - let withOpt2 = (~x: option=?, ~y: int) => - switch x { - | None => 0 - | Some(x) => x - } + - y - } - module type Opt2 = module type of Opt2 - - module Opt3 = { - @react.component - let withOpt3 = (~x: option, ~y: int) => - switch x { - | None => 0 - | Some(x) => x - } + - y - } - module type Opt3 = module type of Opt3 -} - -module Opt2: OptT = Opt -module Opt3 = Opt - -module Memo = { - @react.component - let make = (~name) => React.string(name) - - let make = React.memo(make) -} Create Interface src/CreateInterface.res type r = {name: string, age: int} let add: (~x: int, ~y: int) => int diff --git a/analysis/tests/src/expected/Cross.res.txt b/analysis/tests/src/expected/Cross.res.txt index ee0e6d11c..6f5ad3e43 100644 --- a/analysis/tests/src/expected/Cross.res.txt +++ b/analysis/tests/src/expected/Cross.res.txt @@ -1,44 +1,3 @@ -let crossRef = References.x -// ^ref - -let crossRef2 = References.x - -module Ref = References - -let crossRef3 = References.x - -let crossRefWithInterface = ReferencesWithInterface.x -// ^ref - -let crossRefWithInterface2 = ReferencesWithInterface.x - -module RefWithInterface = ReferencesWithInterface - -let crossRefWithInterface3 = ReferencesWithInterface.x - -let _ = RenameWithInterface.x -// ^ren RenameWithInterfacePrime - -let _ = RenameWithInterface.x -// ^ren xPrime - -let typeDef = {TypeDefinition.item: "foobar"} -// ^typ - -let _ = DefinitionWithInterface.y -// ^def - -type defT = DefinitionWithInterface.t -// ^def - -type defT2 = DefinitionWithInterface.t -// ^typ - -// DefinitionWithInterface.a -// ^com - -let yy = DefinitionWithInterface.Inner.y -// ^def References src/Cross.res 0:17 [ {"uri": "Cross.res", "range": {"start": {"line": 0, "character": 15}, "end": {"line": 0, "character": 25}}}, diff --git a/analysis/tests/src/expected/Dce.res.txt b/analysis/tests/src/expected/Dce.res.txt index 9ccb29cb4..58c835d7a 100644 --- a/analysis/tests/src/expected/Dce.res.txt +++ b/analysis/tests/src/expected/Dce.res.txt @@ -1,7 +1,3 @@ -// Note: in test mode this only reports on src/dce - -// ^dce - DCE src/Dce.res issues:1 diff --git a/analysis/tests/src/expected/Debug.res.txt b/analysis/tests/src/expected/Debug.res.txt index 0e79eb379..2f684865b 100644 --- a/analysis/tests/src/expected/Debug.res.txt +++ b/analysis/tests/src/expected/Debug.res.txt @@ -1,20 +1,3 @@ -// turn on by adding this comment // ^db+ - -let _ = ShadowedBelt.List.map -// ^def - -open Js -module Before = { - open Belt - let _ = Id.getCmpInternal -} -module Inner = { - // eqN - // ^com - open List - let _ = map -} -// ^db- Definition src/Debug.res 2:27 {"uri": "ShadowedBelt.res", "range": {"start": {"line": 1, "character": 6}, "end": {"line": 1, "character": 9}}} diff --git a/analysis/tests/src/expected/Definition.res.txt b/analysis/tests/src/expected/Definition.res.txt index 05eba14f8..69f87b41e 100644 --- a/analysis/tests/src/expected/Definition.res.txt +++ b/analysis/tests/src/expected/Definition.res.txt @@ -1,31 +1,3 @@ -let xx = 10 - -let y = xx -// ^def - -module Inner = { - type tInner = int - let vInner = 34 -} - -type typeInner = Inner.tInner -// ^def - -// open Belt -let m1 = List.map -// ^hov - -open ShadowedBelt -let m2 = List.map -// ^hov - -let uncurried = (. x, y) => x + y - -uncurried(. 3, 12)->ignore -// ^hov - -uncurried(. 3, 12)->ignore -// ^def Definition src/Definition.res 2:8 {"uri": "Definition.res", "range": {"start": {"line": 0, "character": 4}, "end": {"line": 0, "character": 6}}} diff --git a/analysis/tests/src/expected/DefinitionWithInterface.res.txt b/analysis/tests/src/expected/DefinitionWithInterface.res.txt index 4a288ca1d..f8d85032d 100644 --- a/analysis/tests/src/expected/DefinitionWithInterface.res.txt +++ b/analysis/tests/src/expected/DefinitionWithInterface.res.txt @@ -1,15 +1,3 @@ -let y = 4 -// ^def - -type t = int - -let aabbcc = 3 -let _ = aabbcc - -module Inner = { - let y = 100 - // ^def -} Definition src/DefinitionWithInterface.res 0:4 {"uri": "DefinitionWithInterface.resi", "range": {"start": {"line": 0, "character": 4}, "end": {"line": 0, "character": 5}}} diff --git a/analysis/tests/src/expected/DefinitionWithInterface.resi.txt b/analysis/tests/src/expected/DefinitionWithInterface.resi.txt index c37da22b3..10bc34339 100644 --- a/analysis/tests/src/expected/DefinitionWithInterface.resi.txt +++ b/analysis/tests/src/expected/DefinitionWithInterface.resi.txt @@ -1,12 +1,3 @@ -let y: int -// ^def - -type t - -module Inner: { - let y: int - // ^def -} Definition src/DefinitionWithInterface.resi 0:4 {"uri": "DefinitionWithInterface.res", "range": {"start": {"line": 0, "character": 4}, "end": {"line": 0, "character": 5}}} diff --git a/analysis/tests/src/expected/Destructuring.res.txt b/analysis/tests/src/expected/Destructuring.res.txt index 76d78f933..86b03c313 100644 --- a/analysis/tests/src/expected/Destructuring.res.txt +++ b/analysis/tests/src/expected/Destructuring.res.txt @@ -1,37 +1,3 @@ -type x = {name: string, age: int} - -let x = {name: "123", age: 12} - -let {name} = x -// ^com - -// let {} = x -// ^com - -let f = (x: x) => { - let {name} = x - - // ^com - name -} - -let f2 = (x: x) => { - // let {} = x - // ^com - ignore(x) -} - -type recordWithOptField = { - someField: int, - someOptField?: bool, -} - -let x: recordWithOptField = { - someField: 123, -} - -// let {} = x -// ^com Complete src/Destructuring.res 4:11 posCursor:[4:11] posNoWhite:[4:9] Found pattern:[4:4->4:12] Completable: Cpattern Value[x]->recordBody diff --git a/analysis/tests/src/expected/Div.res.txt b/analysis/tests/src/expected/Div.res.txt index f1f30190d..b5af0d5f6 100644 --- a/analysis/tests/src/expected/Div.res.txt +++ b/analysis/tests/src/expected/Div.res.txt @@ -1,8 +1,3 @@ -let q =
-// ^hov - -//
{"contents": {"kind": "markdown", "value": "```rescript\n(\n string,\n ~props: ReactDOM_V3.domProps=?,\n array,\n) => React.element\n```\n\n---\n\n```\n \n```\n```rescript\ntype ReactDOM_V3.domProps = Props.domProps\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22ReactDOM_V3.res%22%2C57%2C2%5D)\n\n\n---\n\n```\n \n```\n```rescript\ntype React.element = Jsx.element\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22React.res%22%2C0%2C0%5D)\n"}} diff --git a/analysis/tests/src/expected/DocComments.res.txt b/analysis/tests/src/expected/DocComments.res.txt index 68943d50e..1f8ab304d 100644 --- a/analysis/tests/src/expected/DocComments.res.txt +++ b/analysis/tests/src/expected/DocComments.res.txt @@ -1,52 +1,3 @@ -@ns.doc(" Doc comment with a triple-backquote example - - ```res example - let a = 10 - /* - * stuff - */ - ``` -") -let docComment1 = 12 -// ^hov - -/** - Doc comment with a triple-backquote example - - ```res example - let a = 10 - /* - * stuff - */ - ``` -*/ -let docComment2 = 12 -// ^hov - -@ns.doc(" Doc comment with a triple-backquote example - - ```res example - let a = 10 - let b = 20 - ``` -") -let docCommentNoNested1 = 12 -// ^hov - -/** - Doc comment with a triple-backquote example - - ```res example - let a = 10 - let b = 20 - ``` -*/ -let docCommentNoNested2 = 12 -// ^hov - -/**New doc comment format*/ -let newDoc = 10 -// ^hov Hover src/DocComments.res 9:9 {"contents": {"kind": "markdown", "value": "```rescript\nint\n```\n---\n Doc comment with a triple-backquote example\\n \\n ```res example\\n let a = 10\\n /*\\n * stuff\\n */\\n ```\\n"}} diff --git a/analysis/tests/src/expected/DocumentSymbol.res.txt b/analysis/tests/src/expected/DocumentSymbol.res.txt index b09cb65ac..dc99a99d4 100644 --- a/analysis/tests/src/expected/DocumentSymbol.res.txt +++ b/analysis/tests/src/expected/DocumentSymbol.res.txt @@ -1,37 +1,3 @@ -module MyList = Belt.List - -module Dep: { - @ocaml.doc("Some doc comment") @deprecated("Use customDouble instead") - let customDouble: int => int -} = { - let customDouble = foo => foo * 2 -} - -module Lib = { - let foo = (~age, ~name) => name ++ string_of_int(age) - let next = (~number=0, ~year) => number + year -} - -let op = Some(3) - -module ForAuto = { - type t = int - let abc = (x: t, _y: int) => x - let abd = (x: t, _y: int) => x -} - -let fa: ForAuto.t = 34 - -module O = { - module Comp = { - @react.component - let make = (~first="", ~zoo=3, ~second) => React.string(first ++ second ++ string_of_int(zoo)) - } -} - -let zzz = 11 - -//^doc DocumentSymbol src/DocumentSymbol.res [ { diff --git a/analysis/tests/src/expected/EnvCompletion.res.txt b/analysis/tests/src/expected/EnvCompletion.res.txt index f03c50dda..0c8ebef34 100644 --- a/analysis/tests/src/expected/EnvCompletion.res.txt +++ b/analysis/tests/src/expected/EnvCompletion.res.txt @@ -1,66 +1,3 @@ -type things = One | Two -type things2 = Four | Five - -let res: EnvCompletionOtherFile.someResult = Okay(One) - -let use = (): EnvCompletionOtherFile.response => { - stuff: First, - res: Failure(""), -} - -// switch res { | } -// ^com - -// switch res { | Okay() } -// ^com - -// switch res { | Failure() } -// ^com - -// switch use() { | } -// ^com - -// switch use() { | {} } -// ^com - -// switch use() { | {stuff: } } -// ^com - -// switch use() { | {stuff: Second() } } -// ^com - -// switch use() { | {stuff: Second({}) } } -// ^com - -// switch use() { | {res: } } -// ^com - -// switch use() { | {res: Okay() } } -// ^com - -// switch use() { | {res: Okay(Second()) } } -// ^com - -// switch use() { | {res: Okay(Second({})) } } -// ^com - -let res2: EnvCompletionOtherFile.someRecord = { - name: "string", - theThing: Four, - theVariant: First, -} - -// switch res2 { | } -// ^com - -// switch res2 { | {} } -// ^com - -// switch res2 { | {theThing: } } -// ^com - -// switch res2 { | {theVariant: } } -// ^com Complete src/EnvCompletion.res 10:17 XXX Not found! Completable: Cpattern Value[res] diff --git a/analysis/tests/src/expected/EnvCompletionOtherFile.res.txt b/analysis/tests/src/expected/EnvCompletionOtherFile.res.txt index 1218b0010..e69de29bb 100644 --- a/analysis/tests/src/expected/EnvCompletionOtherFile.res.txt +++ b/analysis/tests/src/expected/EnvCompletionOtherFile.res.txt @@ -1,13 +0,0 @@ -type someResult<'a, 'b> = Okay('a) | Failure('b) - -type r1 = {age: int} - -type theVariant = First | Second(r1) - -type someRecord<'thing> = { - name: string, - theThing: 'thing, - theVariant: theVariant, -} - -type response = {stuff: theVariant, res: someResult} diff --git a/analysis/tests/src/expected/ExhaustiveSwitch.res.txt b/analysis/tests/src/expected/ExhaustiveSwitch.res.txt index 4e17fc809..bf1cc8447 100644 --- a/analysis/tests/src/expected/ExhaustiveSwitch.res.txt +++ b/analysis/tests/src/expected/ExhaustiveSwitch.res.txt @@ -1,46 +1,3 @@ -type someVariant = One | Two | Three(option) -type somePolyVariant = [#one | #two | #three(option) | #"exotic ident" | #"switch"] - -let withSomeVariant = One -let withSomePoly: somePolyVariant = #one -let someBool = true -let someOpt = Some(true) - -// switch withSomeVarian -// ^com - -// switch withSomePol -// ^com - -// switch someBoo -// ^com - -// switch someOp -// ^com - -type rcrd = {someVariant: someVariant} - -let getV = r => r.someVariant - -let x: rcrd = { - someVariant: One, -} - -let vvv = Some(x->getV) - -// switch x->getV -// ^xfm - -// x->getV -// ^xfm ^ - -// vvv -// ^xfm - -// ^ve+ 11.1 -// switch withSomeVarian -// ^com -// ^ve- Complete src/ExhaustiveSwitch.res 8:24 XXX Not found! Completable: CexhaustiveSwitch Value[withSomeVarian] diff --git a/analysis/tests/src/expected/Fragment.res.txt b/analysis/tests/src/expected/Fragment.res.txt index fcf639615..ae23ede19 100644 --- a/analysis/tests/src/expected/Fragment.res.txt +++ b/analysis/tests/src/expected/Fragment.res.txt @@ -1,19 +1,3 @@ -module SectionHeader = { - @react.component - let make = (~children) => children -} - -let z1 = - <> - {React.string("abc")} - -// ^hov - -let z2 = - <> - {React.string("abc")} - -// ^hov Hover src/Fragment.res 6:19 getLocItem #4: heuristic for within fragments: take make as makeProps does not work the type is not great but jump to definition works diff --git a/analysis/tests/src/expected/Highlight.res.txt b/analysis/tests/src/expected/Highlight.res.txt index d8cb8b146..a4ab8e142 100644 --- a/analysis/tests/src/expected/Highlight.res.txt +++ b/analysis/tests/src/expected/Highlight.res.txt @@ -1,143 +1,3 @@ -module M = { - module C = Component -} - -let _c = - -let _mc = - -let _d =
- -let _d2 = -
- {React.string("abc")} -
{React.string("abc")}
- {React.string("abc")} - {React.string("abc")} -
- -type pair<'x, 'y> = ('x, 'y) - -type looooooooooooooooooooooooooooooooooooooong_int = int - -type looooooooooooooooooooooooooooooooooooooong_string = string - -type pairIntString = list< - pair< - looooooooooooooooooooooooooooooooooooooong_int, - looooooooooooooooooooooooooooooooooooooong_string, - >, -> - -let _ = !(3 < 4) || 3 > 4 - -module type MT = { - module DDF: { - - } -} - -module DDF: MT = { - module DDF = {} -} - -module XX = { - module YY = { - type t = int - } -} - -open XX.YY - -type tt = t - -// ^hig - -module T = { - type someRecord<'typeParameter> = { - someField: int, - someOtherField: string, - theParam: 'typeParameter, - } - - type someEnum = A | B | C -} - -let foo = x => x.T.someField - -let add = (~hello as x, ~world) => x + world - -let _ = add(~hello=3, ...) - -let _ = -
-
-
- -module SomeComponent = { - module Nested = { - @react.component - let make = (~children) => { - <> {children} - } - } -} - -let _ = - -
- - -// true/false -let _ = true || false - -// to/downto as label -let toAs = (~to as x) => x -let _toEquals = toAs(~to=10) - -let to = 1 -for _ in to + to to to + to { - () -} - -module ToAsProp = { - @react.component - let make = (~to) => { - <> {React.int(to)} - } -} -let _ = - -// quoted identifiers -let \"true" = 4 -let _ = \"true" - -let enumInModule = T.A - -type typeInModule = XX.YY.t - -module QQ = { - type somePolyEnumType = [ - | #someMember - | #AnotherMember - | #SomeMemberWithPayload(list) - | #"fourth Member" - ] -} - -let _ = x => - switch x { - | #stuff => 3 - | #...QQ.somePolyEnumType => 4 - } - -let _ = 3 == 3 || 3 === 3 - -let _ = (~_type_ as _) => () - -let _ = {"abc": 34} - -let _ = {"Key": 2} Highlight src/Highlight.res structure items:39 diagnostics:0 Lident: M 0:7 Namespace diff --git a/analysis/tests/src/expected/Hover.res.txt b/analysis/tests/src/expected/Hover.res.txt index f6b65e68e..725c5a93a 100644 --- a/analysis/tests/src/expected/Hover.res.txt +++ b/analysis/tests/src/expected/Hover.res.txt @@ -1,270 +1,3 @@ -let abc = 22 + 34 -// ^hov - -type t = (int, float) -// ^hov - -module Id = { - // ^hov - type x = int -} - -@ocaml.doc("This module is commented") -module Dep: { - @ocaml.doc("Some doc comment") - let customDouble: int => int -} = { - let customDouble = foo => foo * 2 -} - -module D = Dep -// ^hov - -let cd = D.customDouble -// ^hov - -module HoverInsideModuleWithComponent = { - let x = 2 // check that hover on x works - // ^hov - @react.component - let make = () => React.null -} - -@ocaml.doc("Doc comment for functionWithTypeAnnotation") -let functionWithTypeAnnotation: unit => int = () => 1 -// ^hov - -@react.component -let make = (~name) => React.string(name) -// ^hov - -module C2 = { - @react.component - let make2 = (~name: string) => React.string(name) - // ^hov -} - -let num = 34 -// ^hov - -module type Logger = { - // ^hov - let log: string => unit -} - -module JsLogger: Logger = { - // ^hov - let log = (msg: string) => Js.log(msg) - let _oneMore = 3 -} - -module JJ = JsLogger -// ^def - -module IdDefinedTwice = { - // ^hov - let _x = 10 - let y = 20 - let _x = 10 -} - -module A = { - let x = 13 -} - -module B = A -// ^hov - -module C = B -// ^hov - -module Comp = { - @react.component - let make = (~children: React.element) => children -} - -module Comp1 = Comp - -let _ = - -
-
- -// ^hov - -let _ = - -
-
- -// ^hov - -type r<'a> = {i: 'a, f: float} - -let _get = r => r.f +. r.i -// ^hov - -let withAs = (~xx as yyy) => yyy + 1 -// ^hov - -module AA = { - type cond<'a> = [< #str(string)] as 'a - let fnnxx = (b: cond<_>) => true ? b : b -} - -let funAlias = AA.fnnxx - -let typeOk = funAlias -// ^hov - -let typeDuplicate = AA.fnnxx -// ^hov - -@live let dd = 34 -// ^hov - -let arity0a = (. ()) => { - //^hov - let f = () => 3 - f -} - -let arity0b = (. ()) => (. ()) => 3 -// ^hov - -let arity0c = (. (), ()) => 3 -// ^hov - -let arity0d = (. ()) => { - // ^hov - let f = () => 3 - f -} - -/**doc comment 1*/ -let docComment1 = 12 -// ^hov - -/** doc comment 2 */ -let docComment2 = 12 -// ^hov - -module ModWithDocComment = { - /*** module level doc comment 1 */ - - /** doc comment for x */ - let x = 44 - - /*** module level doc comment 2 */ -} - -module TypeSubstitutionRecords = { - type foo<'a> = {content: 'a, zzz: string} - type bar = {age: int} - type foobar = foo - - let x1: foo = {content: {age: 42}, zzz: ""} - // ^hov - let x2: foobar = {content: {age: 42}, zzz: ""} - // ^hov - - // x1.content. - // ^com - - // x2.content. - // ^com - - type foo2<'b> = foo<'b> - type foobar2 = foo2 - - let y1: foo2 = {content: {age: 42}, zzz: ""} - let y2: foobar2 = {content: {age: 42}, zzz: ""} - - // y1.content. - // ^com - - // y2.content. - // ^com -} - -module CompV4 = { - type props<'n, 's> = {n?: 'n, s: 's} - let make = props => { - let _ = props.n == Some(10) - React.string(props.s) - } -} - -let mk = CompV4.make -// ^hov - -type useR = {x: int, y: list>>} - -let testUseR = (v: useR) => v -// ^hov - -let usr: useR = { - x: 123, - y: list{}, -} - -// let f = usr -// ^hov - -module NotShadowed = { - /** Stuff */ - let xx_ = 10 - - /** More Stuff */ - let xx = xx_ -} - -module Shadowed = { - /** Stuff */ - let xx = 10 - - /** More Stuff */ - let xx = xx -} - -let _ = NotShadowed.xx -// ^hov - -let _ = Shadowed.xx -// ^hov - -type recordWithDocstringField = { - /** Mighty fine field here. */ - someField: bool, -} - -let x: recordWithDocstringField = { - someField: true, -} - -// x.someField -// ^hov - -let someField = x.someField -// ^hov - -type variant = | /** Cool variant! */ CoolVariant | /** Other cool variant */ OtherCoolVariant - -let coolVariant = CoolVariant -// ^hov - -// Hover on unsaved -// let fff = "hello"; fff -// ^hov - -// switch x { | {someField} => someField } -// ^hov - -module Arr = Belt.Array -// ^hov - -type aliased = variant -// ^hov Hover src/Hover.res 0:4 {"contents": {"kind": "markdown", "value": "```rescript\nint\n```"}} diff --git a/analysis/tests/src/expected/InlayHint.res.txt b/analysis/tests/src/expected/InlayHint.res.txt index 9ef5802c3..db88d23bb 100644 --- a/analysis/tests/src/expected/InlayHint.res.txt +++ b/analysis/tests/src/expected/InlayHint.res.txt @@ -1,38 +1,3 @@ -let not_include = "Not Include" -let string = "ReScript" -let number = 1 -let float = 1.1 -let char = 'c' - -let add = (x, y) => x + y - -let my_sum = 3->add(1)->add(1)->add(1)->add(8) - -let withAs = (~xx as yyy) => yyy + 1 - -@react.component -let make = (~name) => React.string(name) - -let tuple = ("ReScript", "lol") - -let (lang, _) = tuple - -type foo = { - name: string, - age: int, -} - -let bar = () => ({name: "ReScript", age: 2}, tuple) -let ({name: _, age: _}, t) = bar() - -let alice = { - name: "Alice", - age: 42, -} - -let {name, age} = alice - -//^hin Inlay Hint src/InlayHint.res 1:34 [{ "position": {"line": 33, "character": 14}, diff --git a/analysis/tests/src/expected/Jsx2.res.txt b/analysis/tests/src/expected/Jsx2.res.txt index a8d18a3fd..d566a3bdd 100644 --- a/analysis/tests/src/expected/Jsx2.res.txt +++ b/analysis/tests/src/expected/Jsx2.res.txt @@ -1,186 +1,3 @@ -module M = { - @react.component - let make = (~first, ~fun="", ~second="") => React.string(first ++ fun ++ second) -} - -let _ = -// ^def - -// React.string(first) - -let y = 44 - -// k -// ^com - -// -// ^def - -module Ext = { - @react.component @module("@material-ui/core") - external make: (~align: string=?) => React.element = "Typography" -} - -let _ = Ext.make - -// -// ^com - -module WithChildren = { - @react.component - let make = (~name as _: string, ~children) => children -} - -let _ = - -
- -// x.DefineSomeFields.thisField + DefineSomeFields.thisValue - -module Outer = { - module Inner = { - let hello = 3 - } -} -let _ = Outer.Inner.hello - -let _ = -
- -let _ = -
- -let _ = -
- -module Nested = { - module Comp = { - @react.component - let make = (~name) => React.string(name) - } -} - -let _ = - -// let _ = -// ^com - -// let _ = -// ^com - -module Comp = { - @react.component - let make = (~age) => React.int(age) -} - -let _ = { - <> - - - // ^hov -} - -let _ = { - <> - {<> - - } - - // ^hov -} - -module type ExtT = module type of Ext - -let _ = module(Ext: ExtT) Definition src/Jsx2.res 5:9 getLocItem #4: heuristic for within fragments: take make as makeProps does not work the type is not great but jump to definition works diff --git a/analysis/tests/src/expected/Jsx2.resi.txt b/analysis/tests/src/expected/Jsx2.resi.txt index dd568ee3d..5c2c276de 100644 --- a/analysis/tests/src/expected/Jsx2.resi.txt +++ b/analysis/tests/src/expected/Jsx2.resi.txt @@ -1,15 +1,3 @@ -@react.component -let make: (~first: string) => React.element -// ^hov - -let y: int -// ^hov - -// type t = React.e -// ^com - -// let x : React.e -// ^com Hover src/Jsx2.resi 1:4 getLocItem #1: heuristic for makeProps in interface files n1:componentLike n2:unit n3:string diff --git a/analysis/tests/src/expected/JsxV4.res.txt b/analysis/tests/src/expected/JsxV4.res.txt index 1eb3211c1..339562bda 100644 --- a/analysis/tests/src/expected/JsxV4.res.txt +++ b/analysis/tests/src/expected/JsxV4.res.txt @@ -1,61 +1,3 @@ -@@jsxConfig({version: 4}) - -module M4 = { - type props<'first, 'fun, 'second> = {first: 'first, fun?: 'fun, second?: 'second} - - /** Doc Comment For M4 */ - let make = ({first, fun: ?__fun, second: ?__second, _}: props<_, _, _>) => { - let fun = switch __fun { - | Some(fun) => fun - | None => "" - } - let second = switch __second { - | Some(second) => second - | None => "" - } - - React.string(first ++ fun ++ second) - } - /** Doc Comment For M4 */ - let make = { - let \"JsxV4$M4" = (props: props<_>) => make(props) - - \"JsxV4$M4" - } -} - -let _ = React.jsx(M4.make, {first: "abc"}) -// ^def - -// React.null - let make = { - let \"JsxV4$MM" = props => make(props) - - \"JsxV4$MM" - } -} - -module Other = { - type props<'name> = {name: 'name} - - let make = ({name, _}: props<_>) => React.string(name) - let make = { - let \"JsxV4$Other" = (props: props<_>) => make(props) - - \"JsxV4$Other" - } -} - -// ^int Definition src/JsxV4.res 8:9 {"uri": "JsxV4.res", "range": {"start": {"line": 5, "character": 6}, "end": {"line": 5, "character": 10}}} diff --git a/analysis/tests/src/expected/LongIdentTest.res.txt b/analysis/tests/src/expected/LongIdentTest.res.txt index 4e26d9203..1c12fccf8 100644 --- a/analysis/tests/src/expected/LongIdentTest.res.txt +++ b/analysis/tests/src/expected/LongIdentTest.res.txt @@ -1,10 +1,3 @@ -module Map = TableclothMap - -let zz = Map.add -// ^hov -// Triggers the processing of `Of(M)._t` and Lident.Apply ends up in the AST -// even though it's not expressible in ReScript syntax. -// This simulates ReScript projects with OCaml dependencies containing ident apply. Hover src/LongIdentTest.res 2:13 {"contents": {"kind": "markdown", "value": "```rescript\nint\n```"}} diff --git a/analysis/tests/src/expected/ModuleStuff.res.txt b/analysis/tests/src/expected/ModuleStuff.res.txt index 13210ac76..e69de29bb 100644 --- a/analysis/tests/src/expected/ModuleStuff.res.txt +++ b/analysis/tests/src/expected/ModuleStuff.res.txt @@ -1,5 +0,0 @@ -/*** This is a top level module doc. */ - -module Nested = { - /*** Module doc for nested. */ -} diff --git a/analysis/tests/src/expected/Objects.res.txt b/analysis/tests/src/expected/Objects.res.txt index 3b32ca8b9..e69de29bb 100644 --- a/analysis/tests/src/expected/Objects.res.txt +++ b/analysis/tests/src/expected/Objects.res.txt @@ -1,11 +0,0 @@ -type objT = {"name": string, "age": int} - -type nestedObjT = {"y": objT} - -module Rec = { - type recordt = {xx: int, ss: string} - - let recordVal: recordt = assert(false) -} - -let object: objT = {"name": "abc", "age": 4} diff --git a/analysis/tests/src/expected/Patterns.res.txt b/analysis/tests/src/expected/Patterns.res.txt index 119e20c11..5c119ffb7 100644 --- a/analysis/tests/src/expected/Patterns.res.txt +++ b/analysis/tests/src/expected/Patterns.res.txt @@ -1,24 +1,15 @@ +Definition src/Patterns.res 20:10 +{"uri": "Patterns.res", "range": {"start": {"line": 3, "character": 7}, "end": {"line": 3, "character": 10}}} - Syntax error! - src/Patterns.res:18:11-16 +Definition src/Patterns.res 25:11 +{"uri": "Patterns.res", "range": {"start": {"line": 9, "character": 7}, "end": {"line": 9, "character": 11}}} - 16 │ let A([v1, _, _]) | _ as v1 = assert false - 17 │ - 18 │ let lazy lazyy = lazy 3 - 19 │ } - 20 │ +Definition src/Patterns.res 28:11 +{"uri": "Patterns.res", "range": {"start": {"line": 11, "character": 7}, "end": {"line": 11, "character": 8}}} - Did you forget a `=` here? +Definition src/Patterns.res 31:11 +{"uri": "Patterns.res", "range": {"start": {"line": 15, "character": 9}, "end": {"line": 15, "character": 11}}} - - Syntax error! - src/Patterns.res:18:24-25 - - 16 │ let A([v1, _, _]) | _ as v1 = assert false - 17 │ - 18 │ let lazy lazyy = lazy 3 - 19 │ } - 20 │ - - consecutive statements on a line must be separated by ';' or a newline +Definition src/Patterns.res 34:11 +{"uri": "Patterns.res", "range": {"start": {"line": 17, "character": 11}, "end": {"line": 17, "character": 16}}} diff --git a/analysis/tests/src/expected/PolyRec.res.txt b/analysis/tests/src/expected/PolyRec.res.txt index 46d8a9c7d..64c790174 100644 --- a/analysis/tests/src/expected/PolyRec.res.txt +++ b/analysis/tests/src/expected/PolyRec.res.txt @@ -1,17 +1,3 @@ -let rec sum = x => - switch x { - | #Leaf => 0 - | #Node(value, left, right) => value + left->sum + right->sum - } - -let myTree = #Node( - 1, - #Node(2, #Node(4, #Leaf, #Leaf), #Node(6, #Leaf, #Leaf)), - #Node(3, #Node(5, #Leaf, #Leaf), #Node(7, #Leaf, #Leaf)), -) - -let () = myTree->sum->Js.log -// ^hov Hover src/PolyRec.res 12:10 {"contents": {"kind": "markdown", "value": "```rescript\n([#Leaf | #Node(int, 'a, 'a)] as 'a)\n```"}} diff --git a/analysis/tests/src/expected/QueryFile.res.txt b/analysis/tests/src/expected/QueryFile.res.txt index 0ba6f3d1d..e69de29bb 100644 --- a/analysis/tests/src/expected/QueryFile.res.txt +++ b/analysis/tests/src/expected/QueryFile.res.txt @@ -1,6 +0,0 @@ -module Types = { - type byAddress = SchemaAssets.input_ByAddress - type location = SchemaAssets.input_Location - - type variables = {location: location} -} diff --git a/analysis/tests/src/expected/RecModules.res.txt b/analysis/tests/src/expected/RecModules.res.txt index 461860257..62e3e825c 100644 --- a/analysis/tests/src/expected/RecModules.res.txt +++ b/analysis/tests/src/expected/RecModules.res.txt @@ -1,25 +1,3 @@ -module rec A: { - type t - - @send external child: t => B.t = "child" -} = A - -and B: { - type t - - @send external parent: t => A.t = "parent" -} = B - -module C = { - type t - - @send external createA: t => A.t = "createA" -} - -module MC = C -// ^hov -module MA = A -// ^hov Hover src/RecModules.res 18:12 {"contents": {"kind": "markdown", "value": "```rescript\nmodule C: {\n type t\n let createA: t => A.t\n}\n```"}} diff --git a/analysis/tests/src/expected/RecordCompletion.res.txt b/analysis/tests/src/expected/RecordCompletion.res.txt index 05ef9e25b..90787363b 100644 --- a/analysis/tests/src/expected/RecordCompletion.res.txt +++ b/analysis/tests/src/expected/RecordCompletion.res.txt @@ -1,27 +1,3 @@ -type t = {n: array} - -let t = {n: []} - -type t2 = {n2: t} - -let t2 = {n2: t} - -// t.n->m -// ^com - -// t2.n2.n->m -// ^com - -module R = { - type t = {name: string} -} - -let n = {R.name: ""} -// n.R. -// ^com - -// n.R. xx -// ^com Complete src/RecordCompletion.res 8:9 posCursor:[8:9] posNoWhite:[8:8] Found expr:[8:3->8:9] Completable: Cpath Value[t].n->m diff --git a/analysis/tests/src/expected/RecoveryOnProp.res.txt b/analysis/tests/src/expected/RecoveryOnProp.res.txt index 1c16f7f77..59b9e8f8e 100644 --- a/analysis/tests/src/expected/RecoveryOnProp.res.txt +++ b/analysis/tests/src/expected/RecoveryOnProp.res.txt @@ -1,15 +1,3 @@ -let name = "" - -let _ = -
{ - () - // let _: Res - // ^com - }} - name="abc"> - {React.string(name)} -
Complete src/RecoveryOnProp.res 6:26 posCursor:[6:26] posNoWhite:[6:25] Found expr:[3:3->11:8] JSX 3:6] onClick[4:4->4:11]=...[4:13->0:-1]> _children:None diff --git a/analysis/tests/src/expected/References.res.txt b/analysis/tests/src/expected/References.res.txt index ef209d2a9..ea3108dae 100644 --- a/analysis/tests/src/expected/References.res.txt +++ b/analysis/tests/src/expected/References.res.txt @@ -1,28 +1,3 @@ -let x = 12 -// ^ref - -let a = x - -let b = a - -let c = x - -let foo = (~xx) => xx + 1 -// ^ref - -module M: { - let aa: int -} = { - let aa = 10 -} - -let bb = M.aa -let cc = bb -let dd = M.aa -// ^ref - -let _ = -// ^ref References src/References.res 0:4 [ {"uri": "Cross.res", "range": {"start": {"line": 0, "character": 26}, "end": {"line": 0, "character": 27}}}, diff --git a/analysis/tests/src/expected/ReferencesWithInterface.res.txt b/analysis/tests/src/expected/ReferencesWithInterface.res.txt index 2b8f27d3b..33f2d105d 100644 --- a/analysis/tests/src/expected/ReferencesWithInterface.res.txt +++ b/analysis/tests/src/expected/ReferencesWithInterface.res.txt @@ -1,5 +1,3 @@ -let x = 2 -// ^ref References src/ReferencesWithInterface.res 0:4 [ {"uri": "Cross.res", "range": {"start": {"line": 9, "character": 52}, "end": {"line": 9, "character": 53}}}, diff --git a/analysis/tests/src/expected/ReferencesWithInterface.resi.txt b/analysis/tests/src/expected/ReferencesWithInterface.resi.txt index fc7516ec3..3e96fbc75 100644 --- a/analysis/tests/src/expected/ReferencesWithInterface.resi.txt +++ b/analysis/tests/src/expected/ReferencesWithInterface.resi.txt @@ -1,5 +1,3 @@ -let x: int -// ^ref References src/ReferencesWithInterface.resi 0:4 [ {"uri": "Cross.res", "range": {"start": {"line": 9, "character": 52}, "end": {"line": 9, "character": 53}}}, diff --git a/analysis/tests/src/expected/Rename.res.txt b/analysis/tests/src/expected/Rename.res.txt index a1a18d3e0..5cd2adfee 100644 --- a/analysis/tests/src/expected/Rename.res.txt +++ b/analysis/tests/src/expected/Rename.res.txt @@ -1,14 +1,3 @@ -let x = 12 -// ^ren y - -let a = x - -let b = a - -let c = x - -let foo = (~xx) => xx + 1 -// ^ren yy Rename src/Rename.res 0:4 y [ { diff --git a/analysis/tests/src/expected/RenameWithInterface.res.txt b/analysis/tests/src/expected/RenameWithInterface.res.txt index 641e23004..a13988fa9 100644 --- a/analysis/tests/src/expected/RenameWithInterface.res.txt +++ b/analysis/tests/src/expected/RenameWithInterface.res.txt @@ -1,5 +1,3 @@ -let x = 2 -// ^ren y Rename src/RenameWithInterface.res 0:4 y [ { diff --git a/analysis/tests/src/expected/RenameWithInterface.resi.txt b/analysis/tests/src/expected/RenameWithInterface.resi.txt index 696b3c104..2a1dabb44 100644 --- a/analysis/tests/src/expected/RenameWithInterface.resi.txt +++ b/analysis/tests/src/expected/RenameWithInterface.resi.txt @@ -1,5 +1,3 @@ -let x: int -// ^ren y Rename src/RenameWithInterface.resi 0:4 y [ { diff --git a/analysis/tests/src/expected/Reprod.res.txt b/analysis/tests/src/expected/Reprod.res.txt index c053377ca..d0be9994c 100644 --- a/analysis/tests/src/expected/Reprod.res.txt +++ b/analysis/tests/src/expected/Reprod.res.txt @@ -1,59 +1,3 @@ -module Query = { - let use = (~variables: QueryFile.Types.variables) => { - ignore(variables) - "" - } -} - -// let x = Query.use(~variables={location: ByAddress()}) -// ^com - -type nestedRecord = {nested: bool} - -type rec someRecord = { - first: int, - second: (bool, option), - optThird: option<[#first | #second(someRecord)]>, - nest: nestedRecord, -} - -type somePolyVariant = [#one | #two(bool) | #three(someRecord, bool)] - -type someVariant = One | Two(bool) | Three(someRecord, bool) - -type paramRecord<'a, 'b> = { - first: 'a, - second: 'b, -} - -let record: paramRecord = { - first: One, - second: {city: "city"}, -} - -// switch record { | {first: }} -// ^com - -// switch record { | {second: }} -// ^com - -// TODO: Functions, aliases/definitions, records, variants, polyvariants, tuples - -let res: result = Ok(One) - -// switch res { | Ok() } -// ^com - -// switch res { | Error() } -// ^com - -let resOpt: result, unit> = Ok(None) - -// switch resOpt { | Ok() } -// ^com - -// switch resOpt { | Ok(Some()) } -// ^com Complete src/Reprod.res 7:53 posCursor:[7:53] posNoWhite:[7:52] Found expr:[7:11->7:56] Pexp_apply ...[7:11->7:20] (~variables7:22->7:31=...[7:32->7:55]) diff --git a/analysis/tests/src/expected/SchemaAssets.res.txt b/analysis/tests/src/expected/SchemaAssets.res.txt index b83ff5c0d..e69de29bb 100644 --- a/analysis/tests/src/expected/SchemaAssets.res.txt +++ b/analysis/tests/src/expected/SchemaAssets.res.txt @@ -1,6 +0,0 @@ -@live -type rec input_ByAddress = {city: string} -@tag("__$inputUnion") -and input_Location = - | @as("byAddress") ByAddress(input_ByAddress) - | @as("byId") ById(string) diff --git a/analysis/tests/src/expected/ShadowedBelt.res.txt b/analysis/tests/src/expected/ShadowedBelt.res.txt index 143c0e915..e69de29bb 100644 --- a/analysis/tests/src/expected/ShadowedBelt.res.txt +++ b/analysis/tests/src/expected/ShadowedBelt.res.txt @@ -1,3 +0,0 @@ -module List = { - let map = (l, fn) => List.map(fn, l) -} diff --git a/analysis/tests/src/expected/SignatureHelp.res.txt b/analysis/tests/src/expected/SignatureHelp.res.txt index 29f6b3a8f..580401264 100644 --- a/analysis/tests/src/expected/SignatureHelp.res.txt +++ b/analysis/tests/src/expected/SignatureHelp.res.txt @@ -1,166 +1,3 @@ -type someVariant = One | Two | Three - -/** Does stuff. */ -let someFunc = (one: int, ~two: option=?, ~three: unit => unit, ~four: someVariant, ()) => { - ignore(one) - ignore(two) - ignore(three()) - ignore(four) -} - -let otherFunc = (first: string, second: int, third: float) => { - ignore(first) - ignore(second) - ignore(third) -} - -// let _ = someFunc( -// ^she - -// let _ = someFunc(1 -// ^she - -// let _ = someFunc(123, ~two -// ^she - -// let _ = someFunc(123, ~two="123" -// ^she - -// let _ = someFunc(123, ~two="123", ~four -// ^she - -// let _ = someFunc(123, ~two="123", ~four=O -// ^she - -// let _ = otherFunc( -// ^she - -// let _ = otherFunc("123" -// ^she - -// let _ = otherFunc("123", 123, 123.0) -// ^she - -// let _ = Completion.Lib.foo(~age -// ^she - -let iAmSoSpecial = (iJustHaveOneArg: string) => { - ignore(iJustHaveOneArg) -} - -// let _ = iAmSoSpecial( -// ^she - -// let _ = "hello"->otherFunc(1 -// ^she - -let fn = (age: int, name: string, year: int) => { - ignore(age) - ignore(name) - ignore(year) -} - -// let _ = fn(22, ) -// ^she - -// let _ = fn(22, , 2023) -// ^she - -// let _ = fn(12, "hello", ) -// ^she - -// let _ = fn({ iAmSoSpecial() }) -// ^she - -// let _ = fn({ iAmSoSpecial({ someFunc() }) }) -// ^she - -/** This is my own special thing. */ -type mySpecialThing = string - -type t = - | /** One is cool. */ One({miss?: bool, hit?: bool, stuff?: string}) - | /** Two is fun! */ Two(mySpecialThing) - | /** Three is... three */ Three(mySpecialThing, array>) - -let _one = One({}) -// ^she - -let _one = One({miss: true}) -// ^she - -let _one = One({hit: true, miss: true}) -// ^she - -let two = Two("true") -// ^she - -let three = Three("", []) -// ^she - -let three2 = Three("", []) -// ^she - -let _deepestTakesPrecedence = [12]->Js.Array2.map(v => - if v > 0 { - One({}) - // ^she - } else { - Two("") - } -) - -/** Main docstring here. */ -let map = (arr, mapper) => { - Array.map(mapper, arr) -} - -let _usesCorrectTypeInfo = [12]->map(v => v) -// ^she - -/** Type x... */ -type x = { - age?: int, - name?: string, -} - -/** Type tt! */ -type tt = One - -/** Some stuff */ -let stuffers = (x: x, y: tt) => { - ignore(x) - ignore(y) - "hello" -} - -let _ = stuffers({}, One) -// ^she - -let _ = stuffers({}, One) -// ^she - -let _ = switch _one { -| One({hit: _hit}) => "" -// ^she -| One(_a) => "" -// ^she -| Two(_ms) => "" -// ^she -| Three(_a, []) => "" -// ^she -| Three(_, _b) => "" -// ^she -} - -let _bb = Ok(true) -// ^she - -let _bbb = Error("err") -// ^she - -let _cc = Some(true) -// ^she Signature help src/SignatureHelp.res 16:20 posCursor:[16:19] posNoWhite:[16:18] Found expr:[16:11->16:20] Pexp_apply ...[16:11->16:19] (...[46:0->16:20]) diff --git a/analysis/tests/src/expected/TypeAtPosCompletion.res.txt b/analysis/tests/src/expected/TypeAtPosCompletion.res.txt index 03f0876d1..377ec83f1 100644 --- a/analysis/tests/src/expected/TypeAtPosCompletion.res.txt +++ b/analysis/tests/src/expected/TypeAtPosCompletion.res.txt @@ -1,28 +1,3 @@ -type optRecord = { - name: string, - age?: int, - online?: bool, -} - -let optRecord = { - name: "Hello", - // ^com -} - -type someVariant = One(int, optRecord) - -let x = One( - 1, - { - name: "What", - // ^com - }, -) - -let arr = [ - optRecord, - // ^com -] Complete src/TypeAtPosCompletion.res 7:17 posCursor:[7:17] posNoWhite:[7:15] Found expr:[6:16->9:1] Completable: Cexpression CTypeAtPos()->recordBody diff --git a/analysis/tests/src/expected/TypeDefinition.res.txt b/analysis/tests/src/expected/TypeDefinition.res.txt index fb164890b..46a968e8f 100644 --- a/analysis/tests/src/expected/TypeDefinition.res.txt +++ b/analysis/tests/src/expected/TypeDefinition.res.txt @@ -1,28 +1,3 @@ -type variant = Foo | Bar - -type record = {item: string} -// ^typ - -let x = Foo -// ^typ - -let y = {item: "foo"} -// ^typ - -type obj = {"foo": string} - -let obj: obj = {"foo": "bar"} -// ^typ - -let f = r => r.item -// ^typ - -let g = v => - switch v { - // ^typ - | Foo => "Foo" - | Bar => "Bar" - } TypeDefinition src/TypeDefinition.res 2:9 {"uri": "TypeDefinition.res", "range": {"start": {"line": 2, "character": 5}, "end": {"line": 2, "character": 11}}} diff --git a/analysis/tests/src/expected/Xform.res.txt b/analysis/tests/src/expected/Xform.res.txt index 98737c1dc..2b38ddf41 100644 --- a/analysis/tests/src/expected/Xform.res.txt +++ b/analysis/tests/src/expected/Xform.res.txt @@ -1,148 +1,3 @@ -type kind = First | Second | Third | Fourth(int) -type r = {name: string, age: int} - -let ret = _ => assert(false) -let kind = assert(false) - -if kind == First { - // ^xfm - ret("First") -} else { - ret("Not First") -} - -#kind("First", {name: "abc", age: 3}) != kind ? ret("Not First") : ret("First") -// ^xfm - -let name = "hello" -// ^xfm - -let annotated: int = 34 -// ^xfm - -module T = { - type r = {a: int, x: string} -} - -let foo = x => - // ^xfm - switch x { - | None => 33 - | Some(q) => q.T.a + 1 - // ^xfm - } - -let withAs = (~x as name) => name + 1 -// ^xfm - -@react.component -let make = (~name) => React.string(name) -// ^xfm - -let _ = (~x) => x + 1 -// ^xfm - -// -// Add braces to the body of a function -// - -let noBraces = () => name -// ^xfm - -let nested = () => { - let _noBraces = (_x, _y, _z) => "someNewFunc" - // ^xfm -} - -let bar = () => { - module Inner = { - let foo = (_x, y, _z) => - switch y { - | #some => 3 - | #stuff => 4 - } - //^xfm - } - Inner.foo(1, ...) -} - -module ExtractableModule = { - /** Doc comment. */ - type t = int - // A comment here - let doStuff = a => a + 1 - // ^xfm -} - -let variant = First - -let _x = switch variant { -| First => "first" -| _ => "other" -// ^xfm -} - -let _x = switch variant { -| First | Second => "first" -| _ => "other" -// ^xfm -} - -let _x = switch variant { -| First if 1 > 2 => "first" -| Second => "second" -| _ => "other" -// ^xfm -} - -let polyvariant: [#first | #second | #"illegal identifier" | #third(int)] = #first - -let _y = switch polyvariant { -| #first => "first" -| _ => "other" -// ^xfm -} - -let _y = switch polyvariant { -| #first | #second => "first" -| _ => "other" -// ^xfm -} - -let variantOpt = Some(variant) - -let _x = switch variantOpt { -| Some(First) => "first" -| _ => "other" -// ^xfm -} - -let _x = switch variantOpt { -| Some(First) | Some(Second) => "first" -| _ => "other" -// ^xfm -} - -let _x = switch variantOpt { -| Some(First | Second) => "first" -| _ => "other" -// ^xfm -} - -let polyvariantOpt = Some(polyvariant) - -let _x = switch polyvariantOpt { -| Some(#first) => "first" -| None => "nothing" -| _ => "other" -// ^xfm -} - -let _x = switch polyvariantOpt { -| Some(#first | #second) => "first" -| _ => "other" -// ^xfm -} Xform src/Xform.res 6:5 posCursor:[6:3] posNoWhite:[6:1] Found expr:[6:0->11:1] Completable: Cpath Value[kind] diff --git a/analysis/vendor/res_syntax/res_cli.ml b/analysis/vendor/res_syntax/res_cli.ml index d5fca5d13..d4436e911 100644 --- a/analysis/vendor/res_syntax/res_cli.ml +++ b/analysis/vendor/res_syntax/res_cli.ml @@ -308,7 +308,7 @@ module CliArgProcessor = struct [@@raises exit] end -let () = +(*let () = if not !Sys.interactive then ( ResClflags.parse (); CliArgProcessor.process_file ~is_interface:!ResClflags.interface @@ -317,4 +317,4 @@ let () = ~jsx_version:!ResClflags.jsx_version ~jsx_module:!ResClflags.jsx_module ~jsx_mode:!ResClflags.jsx_mode ~typechecker:!ResClflags.typechecker !ResClflags.file) -[@@raises exit] +[@@raises exit]*)