rescript-vscode
rescript-vscode copied to clipboard
Errors from packages where no file is open don't appear on problems tab.
In a setup with at least one namespaced package, where I change something in the namespaced package, errors for a consuming package only appear on the problems tab when at least one file of the consuming package is open in VSCode.
I made a repository to demonstrate this behaviour: https://github.com/fhammerschmidt/rescript-vscode-problems-tab
Looks like the build command is "build": "cd app && rescript build -with-deps"
So the project app is built, and during that build one gets an error in the command-line.
I would expect the same behaviour in the editor that when project app is edited, the issues relevant to it are shown.
That project is open when some file from that project is open.
Should there be some way to know that when opening some project ( common ) one should look for issues in other projects ( app )?
In my mind the Problems tab should reflect all the problems that the compiler also shows, but maybe that is just me?
The compiler does not show the error if one does this:
cd common
npx rescript
Opening a file from common is the editor's equivalent of asking the question: is there some error when building this project.
The repo is just a limited demonstration of this behaviour, I tried to keep it as simple as possible, maybe it was a bit too simple.
At work we use watchexec, which watches all projects for changes and runs rescript build -with-deps in the project root on any change, so every error will always be visible in the terminal. But not in the VSCode PROBLEMS tab. And it happens quite often that if you change some common typename which is used in multiple packages, you don't have files open for every one of these.
I even agree that it is completely correct what happens, but maybe there are some possibilities to make the editor experience in monorepos as enjoyable as in non-monorepos.
Sorry, I updated the repo now to run from root, to better reflect what we are doing at work.
Looks like the same concerns apply to normal build. There is no single command that shows all the errors in all the packages.
The analogy is the watcher calling code common/src/App.res common/src/Utils.res after running the build.
What does command mean in this context? Because with rescript build -with-deps in the workspace root, I get errors for all packages.
Looks like -with-deps concatenates the .compiler.log from the various sub-projects.
So the thing to try would be to reproduce the same functionality in the editor extension.
Questions include, how does one tell the editor that that's what they want to do. And how to find out what all the packages are. Whether one needs help from the compiler.
Probably someone interested in monorepos could drive this.