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

Plugin is not recognized as a XML formatter #154

Open
peterkeller opened this issue Jun 7, 2019 · 29 comments
Open

Plugin is not recognized as a XML formatter #154

peterkeller opened this issue Jun 7, 2019 · 29 comments
Assignees
Labels
bug Something isn't working formatting
Milestone

Comments

@peterkeller
Copy link

peterkeller commented Jun 7, 2019

Even if the plugin is installed, it isn't recognized as a suitable XML formatter when trying to format a XML document, but the message "There is no formatter for 'xml'-files installed" is shown instead.

Screenshot 2019-06-07 at 09 55 52

@NikolasKomonen
Copy link
Contributor

Could you try disabling all extensions, then enabling only the XML one.

Also just to verify, do you have a JDK installed an setup? Are features like autocompletion or linting working?

Another thing to check is the preference "xml.format.enabled" and make sure that is 'true'

@raduspantu
Copy link

hello @NikolasKomonen ,

this is the same for me.
I already disabled all my extensions and this is still not working.
image

Also my JAVA_HOME directory is set
image

@xorye
Copy link

xorye commented Jun 13, 2019

Thank you for reporting this issue.

Could you please go to the command palette (Ctrl+Shift+P), run "Show Running Extensions" and verify that the extension is running?

If the extension is running, it should look like this:
image

Are features like auto completion and linting working at all?

Are you attempting to format by clicking "Format Document" in the right-click context menu, or are you using Ctrl+Shift+I ? Does the "Format Document" option exist?

@peterkeller
Copy link
Author

After disabling all extensions and enable this plugin again, everything works as expected. Now, I am enabling the other disabled extensions again. So far, there are no problems.

Thanks.

@raduspantu
Copy link

@xorye ,

After leaving it alone and focusing on other tasks, I see that now is working, also with other extensions.
What I haven't done until now, is saving the file as an XML, only formatted as an XML; should this be an issue?

Also, Ctrl+Shift+I enables a multi-line for me, but that one I think is a thing from my settings.
It's working now, adding the mention that the file must be saved as an XML before it could recognize the errors, formatting and so on.

Maybe there is something that I am doing wrong...?

@xorye
Copy link

xorye commented Jun 14, 2019

This definitely seems like an issue with the XML extension. I was able to reproduce the issue and am currently investigating it.

@fbricon
Copy link
Collaborator

fbricon commented Jun 17, 2019

Until the next release that fixes this issue, as a workaround, just save your document as an xml file.

@fbricon fbricon closed this as completed Jun 17, 2019
@fbricon fbricon added bug Something isn't working formatting labels Jun 17, 2019
@TBemrose
Copy link

TBemrose commented Jan 18, 2023

I'm having the same issue, but saving the new file doesn't fix the problem. I've enabled/disabled the other extensions until I found the culprit: ms-toolsai.jupyter-keymap

If redhat.vscode-xml is loaded first, I can't format XML. if redhat.vscode-xml is loaded after ms-toolsai.jupyter-keymap then I can format XML (with all extensions enabled). I rarely use Jupyter and haven't tested whether loading them in this order inhibits any features of that extension.

microsoft/vscode-jupyter-keymap#19

@angelozerr
Copy link
Contributor

@TBemrose do you benefit with other features like validation when you have the XML formatter problem?

@CezaryBD
Copy link

CezaryBD commented Oct 31, 2024

Why has this been closed? It is still not working for example on my machine.
@fbricon

@CezaryBD
Copy link

@xorye Could you let me know if there will be any fix done for that? It still occurs on my machine.

@angelozerr
Copy link
Contributor

@CezaryBD this issue was closed because it fixed the original problem.

The formatting problem occurs générale when vscode xml cannot be started and it can comes from several reasons.

Could tou try to install pre release https://github.com/redhat-developer/vscode-xml?tab=readme-ov-file#contributing ro check if it fixes your issue please.

@CezaryBD
Copy link

Thank you @angelozerr for fast response! Unfortunately I re-installed the extension a couple of times now, also using the pre-release version. It seems to not recognize the extension as the formatter. It says: There is no formatter for 'xml' files installed.

@angelozerr
Copy link
Contributor

If you write an invalid XML, do you see some errors?

Could you enable trace with xml.trace.server=verbose please and share the log.Thanks!

@CezaryBD
Copy link

@angelozerr could you tell me please where can I do that?

@CezaryBD
Copy link

2024-11-22 14:07:45.651 [error] Activating extension redhat.vscode-xml failed due to an error:
2024-11-22 14:07:45.651 [error] TypeError: Cannot read properties of null (reading '1')
	at t.getProxySettings (/Users/userid/.vscode/extensions/redhat.vscode-xml-0.27.2024111708-darwin-arm64/dist/extension.js:2:354116)

@CezaryBD
Copy link

@angelozerr I think at the very end, the pre-release version is working with proxy being set up.

@angelozerr
Copy link
Contributor

You mean that with the pre release and config of proxy it is working?

@CezaryBD
Copy link

Probably yes. Although, I do not understand why a proxy config is needed for the extension to work, especially for a formatter :)

@angelozerr
Copy link
Contributor

Proxy is required to download some xsd dtd that you could reference in your xml.

@anton-roos
Copy link

This is not working for me and I can't find a fix. This issue should not be closed.
What is the root cause?
What should we do to fix it?
Should the fix be with the extension developer rather?

@CezaryBD
Copy link

Proxy is required to download some xsd dtd that you could reference in your xml.

Still, I do not understand why an extension stops working when there is no proxy and why it is not using env variables set from the system level.

@angelozerr
Copy link
Contributor

angelozerr commented Dec 11, 2024

This is not working for me and I can't find a fix. This issue should not be closed.

Ok I reopen the issue, but I think the main problem is that vscode-xml extension cannot start.

What is the root cause?

Generally when the extension cannot be started it is because your Java install is not correct (you need Java because the XML language server is written in Java), but if you have not Java runtime you need to swith to binary mode .

Try adding in your settings.json:

"xml.server.preferBinary": true

Is it working better?

What should we do to fix it?

You need Java >=1.8 which is installed or declare xml.server.preferBinary=true in your settings.json to consume binary.

Should the fix be with the extension developer rather?

For your problem we need to understand if the problem is because xml extension can or cannot be started. (ex : type invalid XML syntax and you should see some error, in this case it means that xml extension can be started and it is perhaps a bug).

To understand really what it happens, I suggest that you declare

"xml.trace.server": "verbose"

and open View -> Output -> XML Support

and you should see some LSP traces that you could share in the issue to understand more what it happens:

Image

I suggest that you read https://github.com/redhat-developer/vscode-xml/blob/main/docs/Troubleshooting.md which explains more what I'm trying to explain you.

Still, I do not understand why an extension stops working when there is no proxy and why it is not using env variables set from the system level.

I agree that it is very strange. @datho7561 have you some idea?

@angelozerr angelozerr reopened this Dec 11, 2024
@angelozerr
Copy link
Contributor

2024-11-22 14:07:45.651 [error] Activating extension redhat.vscode-xml failed due to an error:
2024-11-22 14:07:45.651 [error] TypeError: Cannot read properties of null (reading '1')
	at t.getProxySettings (/Users/userid/.vscode/extensions/redhat.vscode-xml-0.27.2024111708-darwin-arm64/dist/extension.js:2:354116)

I suspect that the problem comes from the line code

if (!regexResult[1]) {
, regexResult could be null, @datho7561 right?

@angelozerr
Copy link
Contributor

@CezaryBD I created the PR #1046 with your problem with proxy.

@datho7561 please review it.

@fbricon
Copy link
Collaborator

fbricon commented Dec 11, 2024

@CezaryBD please paste your proxy settings (you can obfuscate the values), so we can ensure the format you use will be properly parsed and used.

@CezaryBD
Copy link

@CezaryBD please paste your proxy settings (you can obfuscate the values), so we can ensure the format you use will be properly parsed and used.

Basically my .zshrc

export http_proxy="127.0.0.1:3000"
export https_proxy=$http_proxy
export no_proxy=localhost,127.0.0.1
export HTTP_PROXY=$http_proxy
export NO_PROXY=$no_proxy
export HTTPS_PROXY=$https_proxy

@fbricon
Copy link
Collaborator

fbricon commented Dec 11, 2024

@angelozerr you need to fix the regexp so it can parse the value without a scheme (i.e. making http(s?):// optional).

@CezaryBD in the meantime, you can prepend your http_proxy value with http://

@angelozerr
Copy link
Contributor

@CezaryBD could you install pre-release

Image

and tell us if it it fixes your issue with proxy please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working formatting
Projects
None yet
Development

No branches or pull requests

9 participants