-
Notifications
You must be signed in to change notification settings - Fork 93
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
Completion from local xsd seems cached too agressively #194
Comments
Indeed @fbricon I know this problem. It's because cache is done for completion in a very very basic mean at https://github.com/angelozerr/lsp4xml/blob/master/org.eclipse.lsp4xml/src/main/java/org/eclipse/lsp4xml/extensions/contentmodel/model/ContentModelManager.java#L138 To fix this issue, we should check if file last modified has changed (the first step), but XML Schema can be too an URL (we could considerer to cache without checking last modified). Check last modified of the XML Schema to disable cache, will work for your resources.xsd, but if the XML Schema include a B.xsd XML Shema, we must check too that B.xsd last modified has changed. An another very simple solution is not to cache XML Schema. |
Depends if not caching local schemas has a big impact on perf |
It's like validation (which doesn't use cache now). If XML Schema is on file system, it's fast. |
so +1 to not caching local schema files. Remote URLs should be cached though |
A more robust solution could be implemented later, that'd support remote schemas |
@fbricon I have removed cache for completion. Your usecase should work now. We need to write tests for that. |
Yes I confirm it works. Please add the tests so we can close it |
Signed-off-by: angelozerr <[email protected]>
Done. |
Given an xml document:
and its resources.xsd:
If you remove
variant="foo"
from the xml doc, a validation error pops up, as expected. Completion within the resources node shows you can addvariant
.Now if you modify resources.xsd, rename
variant
intosomething
, save the file, then make a change in the xml document, you'll see 2 errors, as expected:Remove the
variant
attribute from<resources
and autocomplete to get the new attribute:variant
is still shown, notsomething
. Closing/reopening all documents don't change anything, the old attribute name is definitely cached in memory. Only way to get past it is to restart the server.The text was updated successfully, but these errors were encountered: