markw65 / prettier-extension-monkeyc

A VSCode extension for Garmin MonkeyC
MIT License
11 stars 1 forks source link

Unclear error message about missing compiled barrel #18

Open m4tiz5zktonj opened 2 months ago

m4tiz5zktonj commented 2 months ago

Sometimes it can be not easy to guess which project in the workspace misses compiled barrel file, as plugin reports error for not existing file:

[{
    "resource": "/monkey.jungle",
    "owner": "analysis",
    "severity": 8,
    "message": "Failed to resolve some barrels: SomeBarrel",
    "source": "[pmc-analysis]",
    "startLineNumber": 1,
    "startColumn": 1,
    "endLineNumber": 1,
    "endColumn": 1
}]

There are no monkey.jungle file in the workspace root, as all projects are in their subdirectories. It would be nice, if error was pointing to specific project's barrels.jungle, where the missing barrel is referenced.

It can be reproduced in your Barrels repo by removing CompiledBarrel/bin/CompiledBarrel-0.0.0.barrel file.

m4tiz5zktonj commented 2 months ago

I understand this issue is kind of "very low priority", but when barrel is compiled, and file begins to exist, this error about missing barrel does not disapper until VS Code is reloaded or project's barrels.jungle file contents is changed.

PMC could, probably, create watchers for every referenced ".barrel" like this: https://github.com/markw65/prettier-extension-monkeyc/blob/8850e8c00b14619454de48448d67b96e7b93b62a/src/project-manager.ts#L133-L135 to restart project analysis automatically when barrel is built.

markw65 commented 2 months ago

I think it's even easier. They should be included in the buildDependencies, and will automatically be watched by addExtraFileWatchers.

https://github.com/markw65/prettier-extension-monkeyc/blob/8850e8c00b14619454de48448d67b96e7b93b62a/src/project-manager.ts#L234