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

Help user find the location in the editor for a syntax error #2576

Open
philrz opened this issue Oct 28, 2022 · 1 comment · Fixed by #3087
Open

Help user find the location in the editor for a syntax error #2576

philrz opened this issue Oct 28, 2022 · 1 comment · Fixed by #3087
Assignees

Comments

@philrz
Copy link
Contributor

philrz commented Oct 28, 2022

Repro is with Brim commit ab5b75d.

Consider the same Zed program as in the #2574 repro. If I had reason to do some kind of edit in the middle of such a wide line, the syntax error such as shown in the following screenshot is not super helpful on its own. We have have handy row numbers in the editor, but there's no way way for a user to quickly land at column 2517 and see their mistake.

image

One way I've seen other tools help in this situation is to move the user's cursor to the location in the program indicated by that row/column in the syntax error. In #2972 @jameskerr also mentioned a possible approach being to "add squiggly lines under an error in the editor", though in this case where the error is effectively out of view in the editor that might not suffice.

Now, I'm aware that we quietly append some additional Zed on the end of a user's program to help with pagination, and I know we may do even more such changes when we address issues like #2533 and #2567, so this may be easier said than done.

@philrz philrz linked a pull request Jun 12, 2024 that will close this issue
@philrz
Copy link
Contributor Author

philrz commented Jun 12, 2024

The changes in linked PR #3087 provide the "squiggly lines under an error in the editor" envisioned above by @jameskerr. If The red squiggly lines appear below whatever caused the syntax error. If I hover my mouse over that area the details are shown as a tooltip. These tips appear as I'm typing as a user before I've even tried to execute the program.

image

Another example is this query from the Zed join tutorial that I've pasted into the editor. It correctly notifies me that the pools I've referenced don't exist.

image

Here's a few areas where we may continue to improve:

  1. When the user does submit a query to be run and it contains an error, the column numbers shown are incorrect, such as in the example below where the ; is the 13th character from the left in line 1 of the editor but it's listed as 33. Thankfully the caret points at the precise location of the problem so we assume that for now that's more likely to draw the user's attention rather than them counting off characters one by one. 😄

image

  1. Regarding the text-based summary of errors that appears where the query output normally would be, @mattnibs made this suggestion:

    I suppose you could also the list errors in the results area and maybe have a link that jumps the text edit cursor to the affected area and activates the error hover box?

    Incidentally, this would be particularly helpful in addressing the problem originally cited in this issue where the syntax error is way "off to the right" in the editor and it would be difficult for a user to find it manually via horizontal scroll.

  2. @jameskerr said he'd like to provide some visual cue when syntax errors happen inside of pinned query fragments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants