vscode-reasonml
vscode-reasonml copied to clipboard
BSB errors not shown in VSCode & Merlin errors disappear after save
Problem 1: The bs-super-errors are shown in the terminal of VSCode when I start the compiler manually:

However, in the code, there is no indication of such errors. Only Merlin errors appear.
Problem 2: As soon as I save the currently edited file, the error indication marker vanishes and then I neither see Merlin nor BSB errors (except for in the terminal).
Hopefully, I forgot to configure something... I added these two options to my VSCode preferences:
"reason.diagnostics.tools": [
"merlin",
"bsb"
],
"reason.codelens.enabled": true
And this is my bsconfig.json:
{
"name": "werkheld",
"reason": {
"react-jsx": 2
},
"bs-dependencies": ["bs-react-native", "reason-react"],
"bsc-flags": ["-bs-super-errors"],
"sources": [
{
"dir": "re",
"subdirs": true
}
],
"suffix": ".bs.js",
"refmt": 3
}
@aloifolia Could you paste the output from the terminal, please?
Of course! Note that the code slightly differs from the previous post
yarn run v1.0.2
$ bsb -make-world -clean-world
Cleaning... 29 files.
Cleaning... 370 files.
Cleaning... 12 files.
[14/14] Building src/ReactDOMServerRe.mlast.d
[2/7] Building src/ReasonReactOptimizedCreateClass.cmj
Warning number 3
/Users/Bastian/Projects/Werkheld/app/node_modules/reason-react/src/ReasonReactOptimizedCreateClass.re 886:53-62
884 │ [@bs.module "react"] external reactComponent : 'a = "Component";
885 │
886 │ [@bs.module "react"] external reactIsValidElement : Js.boolean = "isV
alidElement";
887 │
888 │ [@bs.module "react"] [@bs.new] external newReactComponent : unit => {
. "updater": 'a} =
deprecated: Js.boolean
Use type bool instead
[7/7] Building src/ReactDOMRe.cmj
Warning number 3
/Users/Bastian/Projects/Werkheld/app/node_modules/reason-react/src/ReactDOMRe.re 100:22-31
98 ┆ ~ref: Js.nullable(Dom.element) => unit=?,
99 ┆ /* react textarea/input */
100 ┆ ~defaultChecked: Js.boolean=?,
101 ┆ ~defaultValue: string=?,
102 ┆ /* global html attributes */
deprecated: Js.boolean
Use type bool instead
Warning number 3
..........................................................................................................
...... this goes on for a while so I skipped most of the warnings ......
..........................................................................................................
[103/103] Building src/animated-BsReactNative.cmj
ninja: Entering directory `lib/bs'
[6/6] Building re/components/lists/SectionContent.mlast.d
[3/3] Building re/SectionHeader.cmj
FAILED: re/SectionHeader.cmj /Users/Bastian/Projects/Werkheld/app/lib/js/re/SectionHeader.bs.js re/SectionHeader.cmi
/Users/Bastian/Projects/Werkheld/app/node_modules/bs-platform/lib/bsc.exe -bs-package-name werkheld -bs-package-output commonjs:lib/js/re -bs-assume-no-mli -bs-no-builtin-ppx-ml -bs-no-implicit-include -I /Users/Bastian/Projects/Werkheld/app/node_modules/bs-react-native/lib/ocaml -I /Users/Bastian/Projects/Werkheld/app/node_modules/reason-react/lib/ocaml -I re/components/lists -I re -w -30-40+6+7+27+32..39+44+45+101 -bs-suffix -nostdlib -I '/Users/Bastian/Projects/Werkheld/app/node_modules/bs-platform/lib/ocaml' -bs-super-errors -no-alias-deps -color always -bs-re-out -bs-super-errors -o re/SectionHeader.cmj -c re/SectionHeader.mlast
We've found a bug for you!
/Users/Bastian/Projects/Werkheld/app/re/SectionHeader.re 7:9-22
5 │ let component = ReasonReact.statelessComponent("SectionHeader");
6 │
7 │ let b = Style.GrayDark;
8 │
9 │ let styles =
The variant constructor Style.GrayDark can't be found.
- If it's defined in another module or file, bring it into scope by:
- Annotating it with said module name: let food = MyModule.Apple
- Or specifying its type: let food: MyModule.fruit = Apple
- Constructors and modules are both capitalized. Did you want the latter?
Then instead of let foo = Bar, try module Foo = Bar.
ninja: build stopped: subcommand failed.
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Thanks! I see the issue now. At the beginning, there's a line where the inlined code is breaking over the next line:
886 │ [@bs.module "react"] external reactIsValidElement : Js.boolean = "isV
alidElement";
@chenglou is there anything we could do from the super errors side to forbid this kind of line breaks? Another alternative would be to add some separators between sections, that are easier to parse. Right now we rely on a magical combination of spaces etc that is not always true (like this case shows).