-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Diagnostic Error Codes #282
Add Diagnostic Error Codes #282
Conversation
# Conflicts: # vhdl_lang/src/analysis/analyze.rs # vhdl_lang/src/analysis/association.rs # vhdl_lang/src/analysis/declarative.rs # vhdl_lang/src/analysis/design_unit.rs # vhdl_lang/src/analysis/expression.rs # vhdl_lang/src/analysis/names.rs # vhdl_lang/src/named_entity.rs
I think it is a good step to create error codes if we want to support user configurable error ignores. |
Yea, from and to string are definitely planned. I'm not sure whether to use a custom string - to enum (and inverse) map or auto-deriving is better. The first approach has the advantage that the code representation of the enum is independent of what is seen by the user. One could, for example, easily change the name of the enum while at the same time being backwards compatible. But then on the other hand for packages like strum, such features are already present, I believe (by adding aliases for names). So I'm also heavily leaning towards auto generating names. |
Auto generating names is probably the most maintainable. With strum you can have aliases for exceptions. |
I have included |
Probably there is little benefit now from having the numeric value being displayed. Currently, for example in VSCode, the error is displayed as |
Good systems for error codes do not use numbers. They add no value. A short name is both unique, self describing and can be looked up in a reference doc. |
Motivation
There are a lot of issues about the general concept of allowing more message control (i.e., #255, #192, and some in the rust_hdl_vscode repository). This is an attempt at tackling the challenge of allowing message control of sorts. Once all is set and done, I envision a process where you can
vhdl_ls.toml
, i.e.,(Note that the syntax for both examples is just for illustrative purposes and subject to change should these features be implemented).
This PR
This PR introduces error codes. Except for being forwarded to the language server and potentially being displayed, this is unused. However, I plan to add additional functionality that uses these error codes. This is to avoid error prone regex matching or similar when detecting an error that should be ignored or downgraded:
I will leave this PR open for some time to collect some feedback, especially concerning how current errors without error codes are assigned to the different error codes. Later changes to the actual codes that are not purely additive (i.e., merging of two error codes, splitting an error code into multiple, ...) are not desirable as this will cause backwards incompatible changes. If no such feedback is given, I will assume that these error codes are a good start.