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

Adjust range for XML syntax errors #71

Closed
angelozerr opened this issue Aug 20, 2018 · 9 comments
Closed

Adjust range for XML syntax errors #71

angelozerr opened this issue Aug 20, 2018 · 9 comments
Assignees
Labels
enhancement New feature or request in progress
Milestone

Comments

@angelozerr
Copy link
Contributor

angelozerr commented Aug 20, 2018

@NikolasKomonen if you wish to work on adjust range for XML syntax errors, please do that in https://github.com/angelozerr/lsp4xml/blob/master/org.eclipse.lsp4xml/src/main/java/org/eclipse/lsp4xml/contentmodel/participants/diagnostics/XMLSyntaxErrorCode.java

You can find XML Syntax/Schema error code list at https://wiki.xmldation.com/Support/Validator/. You must filter thoses codes and keep just XML Syntax error code. Me I'm working on XML Schema error code in #72

Please update tests at https://github.com/angelozerr/lsp4xml/blob/master/org.eclipse.lsp4xml/src/test/java/org/eclipse/lsp4xml/contentmodel/XMLSyntaxDiagnosticsTest.java

To check the adjust to do, I suggest you to consume the lsp4xml language server inside vscode and see if it highlights attributes value, name, elements, etc according the XML syntax error code.

Good luck!

@NikolasKomonen
Copy link
Contributor

@angelozerr The XMLLocator does not have any chance to get a correct position for certain cases since the error can be determined after the locator has passed the token it needs the location information for.

Did you have an idea on how to handle this?

A possible solution is to use the XMLDocument and guess the node from the values we have.

@angelozerr
Copy link
Contributor Author

@angelozerr
Copy link
Contributor Author

A possible solution is to use the XMLDocument and guess the node from the values we have.

I have started to experiment your idea. If it's working, I will commit my work. Please wait before continue this issue.

@NikolasKomonen
Copy link
Contributor

@angelozerr Alright, I have the previous implementation done but there are some minor problems with it. Hopefully your experimenting works.

@angelozerr
Copy link
Contributor Author

@NikolasKomonen you can now continue to work on this issue. I have cleaned XML diagnostics test (you will see that it's more readable).

Now I'm based on XMLDocument to adjust errors. Tell me if you like it and I think it improves the adjust.

@angelozerr
Copy link
Contributor Author

@angelozerr
Copy link
Contributor Author

angelozerr commented Aug 30, 2018

@NikolasKomonen once you have implemented an adjust error code, it should be cool that you have the same sample that you are using in JUNit in a given file like https://github.com/angelozerr/lsp4xml/tree/master/org.eclipse.lsp4xml/src/test/resources/validation/syntax

It will help us in the future to see the result in the editor (to avoid searching again a sample)

@NikolasKomonen
Copy link
Contributor

@angelozerr Do you have a recommendation on how you would want to enable multiple error ranges to be sent?

For certain cases like ETagRequired and ETagUnterminated we need to have multiple ranges. I think that it would be better to have toLSPRange return an array of Ranges instead.

@angelozerr
Copy link
Contributor Author

For certain cases like ETagRequired and ETagUnterminated we need to have multiple ranges. I think that it would be better to have toLSPRange return an array of Ranges instead.

Yes we should do that and create a Diagnostic instances per range, because LSP Diagnostic has just one range.

@fbricon fbricon added the enhancement New feature or request label Sep 7, 2018
NikolasKomonen added a commit to NikolasKomonen/lsp4xml that referenced this issue Sep 7, 2018
Synxtax error ranges, resources updated

Signed-off-by: Nikolas Komonen <nikolaskomonen@gmail.com>
angelozerr added a commit that referenced this issue Sep 8, 2018
NikolasKomonen added a commit to NikolasKomonen/lsp4xml that referenced this issue Sep 10, 2018
Synxtax error ranges, resources updated

Signed-off-by: Nikolas Komonen <nikolaskomonen@gmail.com>
NikolasKomonen added a commit to NikolasKomonen/lsp4xml that referenced this issue Sep 10, 2018
Synxtax error ranges, resources updated

Signed-off-by: Nikolas Komonen <nikolaskomonen@gmail.com>
@fbricon fbricon added this to the v0.0.1 milestone Sep 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request in progress
Projects
None yet
Development

No branches or pull requests

3 participants