-
Notifications
You must be signed in to change notification settings - Fork 92
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
Linting makes editing hard #963
Comments
This behavior comes from #897 (comment) The main idea is to highlight the error from the start tag which is broken to the offset reported by Xerces:
Ideally it should be nice to highlight the start/end tag but diagnostic support just one range. |
When I was working on the xsd file huge blocks of the document were highlighted this way while adding or rearranging tags. Even when just writing down a new document from top to down one ends up in huge blocks being marked this way. I don't find it useful and very distracting. Maybe the client can detect large regions and disable inline markup. |
You should have code action which should help you to fix broken xml.
Ok thanks for your feedback, I will see how we could improve your usecase. |
Yes, code actions are available. Haven't used them much though as it always involves using the mouse to hover the annotation and selecting the desired ones. It seems to work in general though. Most things can quickly be fixed via auto-completions which proposes correct closing tags. Not a problem. It's just the fact huge blocks of the document being marked most the time while working on a document. It's so to say a normal use case to have broken XML during authoring. |
Hello,
Maybe
@deathaxe, you can assign a keyboard shortcut to trigger code actions.
|
At first relatedInformation is not supported by all LSP client (ex: Eclipse IDE doesn't support it). We use relatedInformation when you have a XML bind with a XSD file which is not well formatted. |
We cover the range from start tag to offset reported by xerces to support correctly code action. For instance with this XML: <schema attr xerces report the offset after In old version the range was just the start tag name (schema) and code actions inserted The main problem is that code action uses the error range to retrieve the offset where When a diagnostic will be generated we could create a range with start tag name and set in the data the offset where xerces has reported the error. |
@predragnikolic thanks a lot for your suggestion, I will try to investigate your idea. @deathaxe is Sublime LSP client can support relatedInformation? |
If not yet, it may learn it. That's what I read from @predragnikolic's suggestions. I am not yet very familiar with that approach, but the main question might be whether the result is something common which all language servers make use of, or whether the solution will be something specific. Not sure how to handle the latter case. |
Here is how other language servers handle that case.
I am not sure If having 2 diagnostics, like in the image above, would provide enough information for the server to calculate where to put the closing tag. |
Need to fix current tests and add more tests Closes eclipse-lemminx#963 Signed-off-by: David Thompson <davthomp@redhat.com>
Something that may prevent this from being implemented is that we depend on the end of the error range in order to generate the These are some options that I can see to move forward with this:
Please let me know if you can think of other ways to go about this. |
I think we should follow this idea. The diagnostics will work for any LSP client but for LSP client which support relatedInformation, the higlighting error will be better. It looks like Outline with symbols. If LSP client can support symbol hierarchy, the Outline renderer will be better. |
@angelozerr so do you mean option 3? |
If old in "Keep the old diagnostic range on clients that don't support." means current behavior, I would say "yes" |
Revert MarkupEntityMismatch and ETagRequired error ranges so they only cover the start tag element name. Keep existing CodeAction behaviour intact If the client supports DiagnosticRelatedInformation, add the expected location of the close tag as related info to MarkupEntityMismatch and ETagRequired. Closes eclipse-lemminx#963
Revert MarkupEntityMismatch and ETagRequired error ranges so they only cover the start tag element name. Keep existing CodeAction behaviour intact If the client supports DiagnosticRelatedInformation, add the expected location of the close tag as related info to MarkupEntityMismatch and ETagRequired. Closes eclipse-lemminx#963
Revert MarkupEntityMismatch and ETagRequired error ranges so they only cover the start tag element name. Keep existing CodeAction behaviour intact. If the client supports DiagnosticRelatedInformation, add the expected location of the close tag as related info to MarkupEntityMismatch and ETagRequired errors. Closes eclipse-lemminx#963
Revert MarkupEntityMismatch and ETagRequired error ranges so they only cover the start tag element name. Keep existing CodeAction behaviour intact. If the client supports DiagnosticRelatedInformation, add the expected location of the close tag as related info to MarkupEntityMismatch and ETagRequired errors. Closes eclipse-lemminx#963
Revert MarkupEntityMismatch and ETagRequired error ranges so they only cover the start tag element name. Keep existing CodeAction behaviour intact. If the client supports DiagnosticRelatedInformation, add the expected location of the close tag as related info to MarkupEntityMismatch and ETagRequired errors. Closes eclipse-lemminx#963
Revert MarkupEntityMismatch and ETagRequired error ranges so they only cover the start tag element name. Keep existing CodeAction behaviour intact. If the client supports DiagnosticRelatedInformation, add the expected location of the close tag as related info to MarkupEntityMismatch and ETagRequired errors. Closes eclipse-lemminx#963
Revert MarkupEntityMismatch and ETagRequired error ranges so they only cover the start tag element name. Keep existing CodeAction behaviour intact. If the client supports DiagnosticRelatedInformation, add the expected location of the close tag as related info to MarkupEntityMismatch and ETagRequired errors. Closes eclipse-lemminx#963
Revert MarkupEntityMismatch and ETagRequired error ranges so they only cover the start tag element name. Keep existing CodeAction behaviour intact. If the client supports DiagnosticRelatedInformation, add the expected location of the close tag as related info to MarkupEntityMismatch and ETagRequired errors. Closes eclipse-lemminx#963
Revert MarkupEntityMismatch and ETagRequired error ranges so they only cover the start tag element name. Keep existing CodeAction behaviour intact. If the client supports DiagnosticRelatedInformation, add the expected location of the close tag as related info to MarkupEntityMismatch and ETagRequired errors. Closes eclipse-lemminx#963
Revert MarkupEntityMismatch and ETagRequired error ranges so they only cover the start tag element name. Keep existing CodeAction behaviour intact. If the client supports DiagnosticRelatedInformation, add the expected location of the close tag as related info to MarkupEntityMismatch and ETagRequired errors. Closes #963
The screenshot shows a simple file which only misses the end tag
</xs:schema>
. This little issue results in the whole document being marked invalid, which doesn't help much. The file becomes harder to read while editing and doesn't tell much about the origin of the error.I'd expect only the opening tag name and/or the end of the document being marked invalid. The content in between is very correct.
The text was updated successfully, but these errors were encountered: