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

Autocompletion when writing XSDs #111

Closed
felixfbecker opened this issue Sep 10, 2018 · 21 comments
Closed

Autocompletion when writing XSDs #111

felixfbecker opened this issue Sep 10, 2018 · 21 comments
Assignees
Labels
bug Something isn't working completion This issue or enhancement is related to completion support performance This issue or enhancement is related to performance concerns
Milestone

Comments

@felixfbecker
Copy link
Contributor

I am trying to get autocompletion while authoring an XSD.
For this, I declared the XSD as an instance of the XSD meta schema:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified"
           elementFormDefault="qualified"
           xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://www.w3.org/2001/XMLSchema
                               http://www.w3.org/2001/XMLSchema.xsd">

</xs:schema>

However, I am not getting any autocompletion or hovers.

Output channel log:

Sep 10, 2018 2:18:30 PM org.eclipse.lsp4xml.XMLLanguageServer initialize
INFO: Initializing LSP4XML server

(no errors)

Version: vscode-xml-0.1.0-199.vsix

@angelozerr
Copy link
Contributor

I think it's because vscode-xml doesn't bind .xsd file extension to the XML Language Server.

Have you tried to rename your file with .xml extension?

@felixfbecker
Copy link
Contributor Author

Ahh, yeah if I rename the file it works. .Format.ps1xml worked fine, so I thought it may only look for <?xml declaration at the top of files. In general I think it would be great if it did that instead of relying of the file extension, because there are many more file types that are XML but don't use a .xml extension, for example .csproj.

@angelozerr
Copy link
Contributor

It's an issue for vscode-xml (client side). The XML Language Server doesn't use xml extension.

So please create an issue at https://github.com/redhat-developer/vscode-xml/issues, by listing all files extensions like xsd, xsl, csproj, etc

I close this issue since it's an issue of vscode-xml.

@fbricon
Copy link
Contributor

fbricon commented Sep 10, 2018

@angelozerr does xsd support work correctly in LSP4E? See redhat-developer/vscode-xml#22 (comment) and later comments

@angelozerr angelozerr reopened this Sep 10, 2018
@angelozerr
Copy link
Contributor

@angelozerr does xsd support work correctly in LSP4E? See redhat-developer/vscode-xml#22 (comment) and later comments

No, same problem. I will investigate it.

@angelozerr
Copy link
Contributor

@fbricon there are several problem that I'm fixing:

  • there are 3 xs:annotations. dbda608 fixes a little this bug and now I have 2 xs:annotations. I continue to investiage the problem.
  • load of this XML Schema takes a very long time (sometimes one minute?). I don't know why, but its' a good usecase to support load of XML Schema which takes time.

@felixfbecker
Copy link
Contributor Author

Are schemas cached on disk?

@angelozerr angelozerr self-assigned this Sep 10, 2018
@angelozerr
Copy link
Contributor

Are schemas cached on disk?

Yes.

@angelozerr
Copy link
Contributor

I have fixed the xs:annotation problme. Now you should have just one xs:annotation instead of 3.

@fbricon
Copy link
Contributor

fbricon commented Sep 11, 2018

Are schemas cached on disk?

Yes.

But it doesn't seem to survive a server restart.

We have #73 opened about caching schemas locally.

@felixfbecker
Copy link
Contributor Author

I've also gotten it to work after waiting a very long time.

@fbricon fbricon added completion This issue or enhancement is related to completion support performance This issue or enhancement is related to performance concerns hover bug Something isn't working labels Sep 12, 2018
@angelozerr
Copy link
Contributor

angelozerr commented Sep 25, 2018

I've also gotten it to work after waiting a very long time.

Ok now I see more better the problem, it should be cool @fbricon if you could help me to fix the problem.

I have the same problem with this XML file:

<web-app
        xmlns="http://xmlns.jcp.org/xml/ns/javaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee 
		 http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
        version="3.1">
</web-app>

There are 2 problems:

  • with validation
  • with completion

to work those 2 features correctly, I need to open the XML file and open completion and waits for around 1 minute without changing the editor content.

After that, XML Schema is cached. Today the XML Schema is loaded twice:

The first improvement that we could do it is to load one time the XML Schema for completion and validation (we must study how xerces load the XML Schema for validation).

But the big improvement we should do it is to load the XML Schema in a Thread (with CompletableFuture?) and tell to user that this XML Schema takes time and it is loading (by adding a warn message in the XML top element) and avoid trying to load the XML Schema each time the user changes content inside XML editor.

@fbricon is there any chance that you could help me to implement this idea?

@fbricon fbricon added the to do label Sep 25, 2018
@felixfbecker
Copy link
Contributor Author

I would suggest to not return a "warning" content but instead just delay the response to the hover. As long as the response is not there, a client will display "Loading...", but if you return a warning content, some clients cache the result and the user will never see the real content (Sourcegraph does this).

@angelozerr
Copy link
Contributor

@felixfbecker I agree with you for hover, when I said "warning", I mean for diagnostics.

@fbricon
Copy link
Contributor

fbricon commented Sep 26, 2018

I won't be able to work on that but @NikolasKomonen could probably help. Would be nice to fix that performance issue in our next release. It'll prolly make @ifedorenko happier ;-)

@angelozerr
Copy link
Contributor

For performance problem (with some XML Schema), I have found it. See #159 I will try to implement it.

@fbricon fbricon added this to the v0.0.2 milestone Oct 28, 2018
@angelozerr
Copy link
Contributor

@felixfbecker please reinstall last version of vscode, #159 should fix your problem.

@angelozerr
Copy link
Contributor

@fbricon I think we can close this issue, since #159 should fix the performance problem.

@fbricon
Copy link
Contributor

fbricon commented Oct 31, 2018

@angelozerr speed is now good, however I can't seem to get any hover result when editing an xsd file. Is it supposed to work?

@angelozerr
Copy link
Contributor

however I can't seem to get any hover result when editing an xsd file. Is it supposed to work?

It should work, another bug -(

@fbricon
Copy link
Contributor

fbricon commented Nov 3, 2018

Let's close this one about completion. Hover will be handle in #192

@fbricon fbricon closed this as completed Nov 3, 2018
@fbricon fbricon changed the title Autocompletion and hovers when writing XSDs Autocompletion when writing XSDs Nov 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working completion This issue or enhancement is related to completion support performance This issue or enhancement is related to performance concerns
Projects
None yet
Development

No branches or pull requests

3 participants