Validate open .xml files when bounded .xsd files are externally saved#509
Merged
angelozerr merged 1 commit intoeclipse-lemminx:masterfrom Jul 16, 2019
xorye:xsdexternal
Merged
Validate open .xml files when bounded .xsd files are externally saved#509angelozerr merged 1 commit intoeclipse-lemminx:masterfrom xorye:xsdexternal
angelozerr merged 1 commit intoeclipse-lemminx:masterfrom
xorye:xsdexternal
Conversation
fbricon
requested changes
Jul 12, 2019
fbricon
reviewed
Jul 12, 2019
Signed-off-by: David Kwon <dakwon@redhat.com>
Author
|
I've made the changes. Instead of sleeping for 1000 milliseconds, it now sleeps for 600. It can go as low as around 530ms, but when it is that low, sometimes the validation takes longer so the tests fail. Or maybe it depends on the machine running the tests? The temp folder is now being created in the target directory. |
Contributor
|
Works like a charm on Windows OS (after applying my future work https://github.com/angelozerr/lsp4xml/tree/improve-revalidate) Well done @xorye ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Signed-off-by: David Kwon dakwon@redhat.com
Fixes vscode-xml #132.
This PR was tested with this
xmldocument:With this
xsdschema:In the
xsdfile, I simply change themaxOccursvalue from2to3and back to2in a separate editor to test this fix.This PR will register all
xsdfiles as watched files, therefore when thexsdfiles are saved externally, the client would send thedidChangeWatchedFilesnotification. The server will check through every open xml document and validate if it is bound to the recently savedxsdfile.This check was needed because
documentis null if the document representingdocumentURIis not opened on the client side. In our case,documentis null when anxsdthat is not currently open in the client, has been modified and saved externally.Note that this PR works whether or not the
xsdfile is currently open in the client. I have only written the unit test for the unopened case. I am more than willing to write one for the opened case if desired.For the unit test, I created this new file. One thing I am not sure about are the two sleep calls here. I added them because it seems like validation for the xml file is being done in a separate thread, and I wanted to wait until the validation was over, so I could read the resulting diagnostics/errors.
Validation for the
xmldocument takes place when I calldidOpen()with the xml document here which returnsvoid.I did not test this on Windows yet, however a fix for Windows overlaps with #506 .