Open rdavison opened 1 year ago
I suspect this issue is for the editor integration. I remember something like this happened in the past, but not recently. What is the compiler version? And would you look for relevant issues in the editor extension repository in case this was already resolved?
I didn't get this issue in vscode, but it would be good to use relative paths. In monorepos the paths are long.
Example:
Syntax error!
/home/pedro/Desktop/rescript-material-ui/public/rescript-material-ui/src/ButtonGroup.res:62:18-24
60 │ module Component = {
61 │ type t
62 │ external string string => t = "%identity"
63 │ external callback: (unit => React.element) => t = "%identity"
64 │ external element: React.element => t = "%identity"
Did you forget a `:` here? It signals the start of a type
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Could we get an option to print the path in an error message by its relative path instead of its absolute path? It would have a couple of benefits:
1) You could simplify this regex in the tests: https://github.com/rescript-lang/rescript-compiler/blob/d71fcc26d422affff0c9557cf4df2d68a7df30a1/jscomp/build_tests/super_errors/input.js#L26
2) It would make it possible for me to option+click the paths in VS Code. VS Code apparently uniquely identifies files by the path, and if I provide two paths to the same file, it will open the file twice. This is particularly annoying when I have a file opened from the file explorer, which opens the file by its path relative to the workspace root, and then option+click the absolute path in the super error, and it reopens the file in a separate editor. If I don't notice this, then I can easily end up with editors that are out of sync with each other.
For example, I might have an editor open to Table.res, and the compiler the prints a super error like:
In this screenshot you can see the consequence of option+clicking the absolute path from the super error.
It would be nice to be able to somehow configure the compiler to be able to print a message like: