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

VSCode was not revalidating XML files when relevant XSD files were modified outside VSCode #131

Closed
stodge opened this issue Apr 30, 2019 · 8 comments
Labels
bug Something isn't working validation
Milestone

Comments

@stodge
Copy link

stodge commented Apr 30, 2019

Issue Type: Bug

I am using vscode to validate XML and XSDs. I have a script in a docker container that modifes the XML and XSDs. So the script writes to the volume and vscode loads the files from the volume (mounted into the container from my local filesystem). When the script updates the XML and XSD files, vscode doesn't appear to always revalidate the XML and XSD files unless I manually modify them within vscode. Perhaps vscode doesn't recognise that the files were modified outside of its own environment?

Centos 7

Extension version: 0.5.1
VS Code version: Code 1.33.1 (51b0b28134d51361cf996d2f0a1c698247aeabd8, 2019-04-11T08:20:22.771Z)
OS version: Linux x64 3.10.0-957.10.1.el7.x86_64

@fbricon
Copy link
Collaborator

fbricon commented Apr 30, 2019

exactly. VS Code can only listen to file changes of folders that are open in it

@fbricon
Copy link
Collaborator

fbricon commented Apr 30, 2019

actually, if the folders containing the files are already opened in vscode, but modified by a 3rd party, it should send a change event to the XML language server, which should trigger validation. I'll let @NikolasKomonen or @angelozerr investigate in more details

@NikolasKomonen
Copy link
Contributor

NikolasKomonen commented Apr 30, 2019

Investigating now.

With the XSD file open, and the file being edited from another editor the 'didChange' command is triggered but nothing happens. looking into it.

@fbricon
Copy link
Collaborator

fbricon commented Apr 30, 2019

@NikolasKomonen I don't remember lsp4xml configuring filewatchers, so that might be the issue

@NikolasKomonen
Copy link
Contributor

NikolasKomonen commented Apr 30, 2019

@fbricon @stodge

So what is happening is that when the XSD is changed externally from another editor, the text in VSCode changes and sends a textDocument/didChange command, but VSCode never 'saves' the document because it was saved in the other editor.

Because of this a textDocument/didSave command is never sent and the mechanism to re-validate the XML files is never triggered.

Maybe there is a way to detect this and force a save.

But as @stodge said, the quickest workaround for now is to add a space in the XSD, delete it, then save.
Or if you have multiple XSD's just use ctrl+shift+p to bring up to command palette and type Reload Window

@fbricon
Copy link
Collaborator

fbricon commented Apr 30, 2019

with workspace/didChangeWatchedFiles, you could trigger a validation of opened xml files if a non-opened xsd has been modified

@stodge
Copy link
Author

stodge commented Apr 30, 2019

Thanks all.

@angelozerr
Copy link
Contributor

This issue is the same than #132 which is fixed in 0.8.0

@angelozerr angelozerr added bug Something isn't working validation labels Jul 23, 2019
@angelozerr angelozerr changed the title vscode not reloading and revalidating XML/XSD files modified outside itself Client was not revalidating XML files when relevant XSD files were modified outside the client Jul 23, 2019
@angelozerr angelozerr changed the title Client was not revalidating XML files when relevant XSD files were modified outside the client VSCode was not revalidating XML files when relevant XSD files were modified outside VSCode Jul 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working validation
Projects
None yet
Development

No branches or pull requests

4 participants