Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- Fix issue where the server would crash if the project contains an OCaml file with a syntax error.
- Add configuration option for suppressing the "Do you want to start a build?" prompt.
- Add configuration option for autostarting the Code Analyzer.
- Sync with latest parser/printer.

## 1.3.0

Expand Down
10 changes: 10 additions & 0 deletions analysis/tests/src/expected/Completion.res.txt
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,8 @@ Completable: Cpath Value[ForAuto, a]

Complete src/Completion.res 234:34
posCursor:[234:34] posNoWhite:[234:33] Found expr:[234:18->234:36]
Pexp_apply ...__ghost__[0:-1->0:-1] (...[234:18->234:34], ...[234:34->234:36])
posCursor:[234:34] posNoWhite:[234:33] Found expr:[234:18->234:34]
Pexp_apply ...__ghost__[0:-1->0:-1] (...[234:18->234:32], ...[234:32->234:34])
posCursor:[234:34] posNoWhite:[234:33] Found expr:[234:32->234:34]
Pexp_ident na:[234:32->234:34]
Expand Down Expand Up @@ -1432,6 +1434,8 @@ Completable: Cpath Value[AndThatOther, T]

Complete src/Completion.res 378:24
posCursor:[378:24] posNoWhite:[378:23] Found expr:[378:12->378:26]
Pexp_apply ...__ghost__[0:-1->0:-1] (...[378:12->378:24], ...[378:24->378:26])
posCursor:[378:24] posNoWhite:[378:23] Found expr:[378:12->378:24]
Pexp_apply ...__ghost__[0:-1->0:-1] (...[378:12->378:16], ...[378:16->378:24])
posCursor:[378:24] posNoWhite:[378:23] Found expr:[378:16->378:24]
Pexp_ident ForAuto.:[378:16->378:24]
Expand All @@ -1452,6 +1456,8 @@ Completable: Cpath Value[ForAuto, ""]

Complete src/Completion.res 381:38
posCursor:[381:38] posNoWhite:[381:37] Found expr:[381:12->381:41]
Pexp_apply ...__ghost__[0:-1->0:-1] (...[381:12->381:39], ...[381:39->381:41])
posCursor:[381:38] posNoWhite:[381:37] Found expr:[381:12->381:39]
Pexp_apply ...__ghost__[0:-1->0:-1] (...[381:12->381:19], ...[381:19->381:39])
posCursor:[381:38] posNoWhite:[381:37] Found expr:[381:19->381:39]
Pexp_send [381:38->381:38] e:[381:19->381:36]
Expand All @@ -1472,6 +1478,10 @@ Completable: Cpath Value[FAO, forAutoObject][""]

Complete src/Completion.res 384:24
posCursor:[384:24] posNoWhite:[384:23] Found expr:[384:11->384:26]
Pexp_apply ...__ghost__[0:-1->0:-1] (...[384:11->384:24], ...[384:24->384:26])
posCursor:[384:24] posNoWhite:[384:23] Found expr:[384:11->384:24]
Pexp_apply ...__ghost__[0:-1->0:-1] (...[384:11->384:14], ...[384:14->384:24])
posCursor:[384:24] posNoWhite:[384:23] Found expr:[384:14->384:24]
Pexp_field [384:14->384:23] _:[384:24->384:24]
Completable: Cpath Value[funRecord].""
[{
Expand Down
6 changes: 3 additions & 3 deletions analysis/tests/src/expected/Hover.res.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ Completable: Cdecorator(live)
{"contents": "The `@live` decorator is for reanalyze, a static analysis tool for ReScript that can do dead code analysis.\n\n`@live` tells the dead code analysis that the value should be considered live, even though it might appear to be dead. This is typically used in case of FFI where there are indirect ways to access values. It can be added to everything that could otherwise be considered unused by the dead code analysis - values, functions, arguments, records, individual record fields, and so on.\n\n[Read more and see examples in the documentation](https://rescript-lang.org/syntax-lookup#live-decorator).\n\nHint: Did you know you can run an interactive code analysis in your project by running the command `> ReScript: Start Code Analyzer`? Try it!"}

Hover src/Hover.res 115:4
{"contents": "```rescript\n(.) => unit => int\n```"}
{"contents": "```rescript\n(. ()) => unit => int\n```"}

Hover src/Hover.res 121:4
{"contents": "```rescript\n(.) => (.) => int\n```"}
{"contents": "```rescript\n(. ()) => (. ()) => int\n```"}

Hover src/Hover.res 124:4
{"contents": "```rescript\n(. unit, unit) => int\n```"}

Hover src/Hover.res 127:5
{"contents": "```rescript\n(.) => unit => int\n```"}
{"contents": "```rescript\n(. ()) => unit => int\n```"}

4 changes: 2 additions & 2 deletions analysis/tests/src/expected/RecordCompletion.res.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ Completable: Cpath Value[t2].n2.n->m
}]

Complete src/RecordCompletion.res 19:7
posCursor:[19:7] posNoWhite:[19:6] Found expr:[19:3->25:0]
Pexp_field [19:3->19:4] R.:[19:5->25:0]
posCursor:[19:7] posNoWhite:[19:6] Found expr:[19:3->19:7]
Pexp_field [19:3->19:4] R.:[19:5->19:7]
Completable: Cpath Module[R].""
[{
"label": "name",
Expand Down
6 changes: 4 additions & 2 deletions analysis/vendor/res_outcome_printer/res_ast_conversion.ml
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,8 @@ let hasUncurriedAttribute attrs = List.exists (fun attr -> match attr with
| _ -> false
) attrs

let templateLiteralAttr = (Location.mknoloc "res.template", Parsetree.PStr [])

let normalize =
let open Ast_mapper in
{ default_mapper with
Expand Down Expand Up @@ -368,7 +370,7 @@ let normalize =
in
let s = Parsetree.Pconst_string ((escapeTemplateLiteral txt), newTag) in
{p with
ppat_attributes = mapper.attributes mapper p.ppat_attributes;
ppat_attributes = templateLiteralAttr::(mapper.attributes mapper p.ppat_attributes);
ppat_desc = Ppat_constant s
}
| _ ->
Expand Down Expand Up @@ -396,7 +398,7 @@ let normalize =
in
let s = Parsetree.Pconst_string ((escapeTemplateLiteral txt), newTag) in
{expr with
pexp_attributes = mapper.attributes mapper expr.pexp_attributes;
pexp_attributes= templateLiteralAttr::(mapper.attributes mapper expr.pexp_attributes);
pexp_desc = Pexp_constant s
}
| Pexp_apply (
Expand Down
7 changes: 5 additions & 2 deletions analysis/vendor/res_outcome_printer/res_ast_debugger.ml
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,13 @@ module SexpAst = struct
string txt;
optChar tag;
]
| Pconst_char c ->
| Pconst_char _ ->
Sexp.list [
Sexp.atom "Pconst_char";
]
| Pconst_string(_, Some "INTERNAL_RES_CHAR_CONTENTS") ->
Sexp.list [
Sexp.atom "Pconst_char";
Sexp.atom (Char.escaped c);
]
| Pconst_string (txt, tag) ->
Sexp.list [
Expand Down
23 changes: 7 additions & 16 deletions analysis/vendor/res_outcome_printer/res_comments_table.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1682,22 +1682,13 @@ and walkExprArgument (_argLabel, expr) t comments =
recordRows
t
comments
| Ppat_or (pattern1, pattern2) ->
let (beforePattern1, insidePattern1, afterPattern1) =
partitionByLoc comments pattern1.ppat_loc
in
attach t.leading pattern1.ppat_loc beforePattern1;
walkPattern pattern1 t insidePattern1;
let (afterPattern1, rest) =
partitionAdjacentTrailing pattern1.ppat_loc afterPattern1
in
attach t.trailing pattern1.ppat_loc afterPattern1;
let (beforePattern2, insidePattern2, afterPattern2) =
partitionByLoc rest pattern2.ppat_loc
in
attach t.leading pattern2.ppat_loc beforePattern2;
walkPattern pattern2 t insidePattern2;
attach t.trailing pattern2.ppat_loc afterPattern2
| Ppat_or _->
walkList
~getLoc: (fun pattern -> pattern.Parsetree.ppat_loc)
~walkNode: (fun pattern -> walkPattern pattern)
(Res_parsetree_viewer.collectOrPatternChain pat)
t
comments
| Ppat_constraint (pattern, typ) ->
let (beforePattern, insidePattern, afterPattern) =
partitionByLoc comments pattern.ppat_loc
Expand Down
Loading