Skip to content
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

CodeMirror diagnostics only show one source range #5754

Open
adamchalmers opened this issue Mar 11, 2025 · 0 comments
Open

CodeMirror diagnostics only show one source range #5754

adamchalmers opened this issue Mar 11, 2025 · 0 comments
Labels
codemirror Bugs related to code mirror.

Comments

@adamchalmers
Copy link
Collaborator

adamchalmers commented Mar 11, 2025

Rust sends back KCL errors to the frontend. Those KCL errors are converted to CodeMirror diagnostics and are visualized in the CM editor as red underlines/red error badges.

KCL errors have a vector (i.e. array) of source ranges associated with the error. However, CodeMirror diagnostics can only have one source range associated with them (see definition, it has a single from and to field).

It's sometimes useful to show all the KCL source ranges. For example, if the user tries to fillet the same edge multiple times, the Rust KCL interpreter sends back an error and the source range of every time the user tried to fillet that one edge. Users would find it easier to debug if this showed all places the edge was filletted, not just one arbitrarily-chosen one.

adamchalmers added a commit that referenced this issue Mar 11, 2025
Fixes #4307

Now if you try to fillet the same edge twice in a single fillet command,
the error message is clearer, and the source range will highlight
the specific edges in the array which are duplicated.

Same goes for chamfer.

Note: although the Rust KCL interpreter sends back an array of SourceRange
for each KCL error, the frontend only puts the first one into CodeMirror
diagnostics. We should fix that: #5754
adamchalmers added a commit that referenced this issue Mar 11, 2025
Fixes #4307

Now if you try to fillet the same edge twice in a single fillet command,
the error message is clearer, and the source range will highlight
the specific edges in the array which are duplicated.

Same goes for chamfer.

Note: although the Rust KCL interpreter sends back an array of SourceRange
for each KCL error, the frontend only puts the first one into CodeMirror
diagnostics. We should fix that: #5754
@adamchalmers adamchalmers changed the title KCL diagnostics only show one source range CodeMirror diagnostics only show one source range Mar 11, 2025
@adamchalmers adamchalmers added the codemirror Bugs related to code mirror. label Mar 11, 2025
adamchalmers added a commit that referenced this issue Mar 11, 2025
Fixes #4307

Now if you try to fillet the same edge twice in a single fillet command,
the error message is clearer, and the source range will highlight
the specific edges in the array which are duplicated.

Same goes for chamfer.

Note: although the Rust KCL interpreter sends back an array of SourceRange
for each KCL error, the frontend only puts the first one into CodeMirror
diagnostics. We should fix that: #5754
adamchalmers added a commit that referenced this issue Mar 11, 2025
Fixes #4307

Now if you try to fillet the same edge twice in a single fillet command,
the error message is clearer, and the source range will highlight
the specific edges in the array which are duplicated.

Same goes for chamfer.

Note: although the Rust KCL interpreter sends back an array of SourceRange
for each KCL error, the frontend only puts the first one into CodeMirror
diagnostics. We should fix that: #5754
adamchalmers added a commit that referenced this issue Mar 12, 2025
Fixes #4307

Now if you try to fillet the same edge twice in a single fillet command,
the error message is clearer, and the source range will highlight
the specific edges in the array which are duplicated.

Same goes for chamfer.

Note: although the Rust KCL interpreter sends back an array of SourceRange
for each KCL error, the frontend only puts the first one into CodeMirror
diagnostics. We should fix that: #5754
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codemirror Bugs related to code mirror.
Projects
None yet
Development

No branches or pull requests

1 participant