winglang / wing

A programming language for the cloud ☁️ A unified programming model, combining infrastructure and runtime code into one language ⚡
https://winglang.io
Other
5.03k stars 196 forks source link

Show resolved paths as hints in compiler errors #4503

Open Chriscbr opened 1 year ago

Chriscbr commented 1 year ago

Feature Spec

When an error refers to a relative path (in a bring or extern statements):

error: Cannot find module "./blah.w"
  --> main.w:2:7
  |
2 | bring "./blah.w" as another;
  |       ^^^^^^^^^^ Cannot find module "./blah.w"

We would like to show the error the path that the compiler resolved it to as a hint, maybe something like:

error: Cannot find module "./blah.w"
  --> main.w:2:7
  |
2 | bring "./blah.w" as another;
  |       ^^^^^^^^^^ Cannot find module "./blah.w"
  = note: Expected to find a file at "/path/to/blah.w"

Use Cases

Better debugging experience

Implementation Notes

We could try augmenting Diagnostic with a new pub hints: Vec<String> field and then wire it through the error formatting library used by the CLI:

https://github.com/winglang/wing/blob/add9ab68be3aa49c13944a4148f5229e85ddf83f/libs/wingc/src/diagnostic.rs#L249-L254

Component

Compiler

Community Notes

github-actions[bot] commented 10 months ago

Hi,

This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. Feel free to re-open this issue when there's an update or relevant information to be added. Thanks!

github-actions[bot] commented 8 months ago

Hi,

This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. Feel free to re-open this issue when there's an update or relevant information to be added. Thanks!