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

XML support crashes when workspace folders are empty #940

Closed
Chadehoc opened this issue Nov 7, 2023 · 6 comments · Fixed by #941
Closed

XML support crashes when workspace folders are empty #940

Chadehoc opened this issue Nov 7, 2023 · 6 comments · Fixed by #941
Assignees
Labels
bug Something isn't working
Milestone

Comments

@Chadehoc
Copy link

Chadehoc commented Nov 7, 2023

I had used this extension with success some times ago (say, last month), including schema validation and formatting.

When I came back to it, editing the same XML files I did before, suddenly the only item offered by the command palette had become "XML: Open XML Documentation", and nothing works (validation, formatting, auto-closing tag when typing "/"...).

I have tried to reinstall the extension, remove every personnalized settings, install the RC version, disable all other extensions... in vain. (Note: vscode-xml was my latest installed extension.)

@angelozerr
Copy link
Contributor

angelozerr commented Nov 7, 2023

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

@Chadehoc
Copy link
Author

Chadehoc commented Nov 7, 2023

Thanks, here is the log, and the listed "getWorkspaceUri" was a hint to the solution: I had tried to use workspaces (*.code-workspace file). Removing the workspace file and opening the XML files from scratch works fine again. So the issue has a workaround for my immediate need.

Maybe the title should become "is broken by workspace files"?

2023-11-07 14:36:06.349 [error] Activating extension redhat.vscode-xml failed due to an error:
2023-11-07 14:36:06.349 [error] TypeError: Cannot read properties of undefined (reading 'uri')
	at t.getWorkspaceUri (c:\Users\Eric\.vscode\extensions\redhat.vscode-xml-0.26.1-win32-x64\dist\extension.js:2:327150)
	at t.getVariableSubstitutedAssociations (c:\Users\Eric\.vscode\extensions\redhat.vscode-xml-0.26.1-win32-x64\dist\extension.js:2:324444)
	at t.getXMLSettings (c:\Users\Eric\.vscode\extensions\redhat.vscode-xml-0.26.1-win32-x64\dist\extension.js:2:323330)
	at c:\Users\Eric\.vscode\extensions\redhat.vscode-xml-0.26.1-win32-x64\dist\extension.js:2:279673
	at c:\Users\Eric\.vscode\extensions\redhat.vscode-xml-0.26.1-win32-x64\dist\extension.js:2:280300
	at Generator.next (<anonymous>)
	at c:\Users\Eric\.vscode\extensions\redhat.vscode-xml-0.26.1-win32-x64\dist\extension.js:2:278930
	at new Promise (<anonymous>)
	at i (c:\Users\Eric\.vscode\extensions\redhat.vscode-xml-0.26.1-win32-x64\dist\extension.js:2:278675)
	at t.startLanguageClient (c:\Users\Eric\.vscode\extensions\redhat.vscode-xml-0.26.1-win32-x64\dist\extension.js:2:279456)
	at c:\Users\Eric\.vscode\extensions\redhat.vscode-xml-0.26.1-win32-x64\dist\extension.js:2:294745
	at Generator.next (<anonymous>)
	at s (c:\Users\Eric\.vscode\extensions\redhat.vscode-xml-0.26.1-win32-x64\dist\extension.js:2:293491)

@angelozerr
Copy link
Contributor

angelozerr commented Nov 7, 2023

Thanks so much @Chadehoc for your feedback and trace. is it possible to share your vscode project which causes the problem please.

@Chadehoc
Copy link
Author

Chadehoc commented Nov 7, 2023

Trying to reproduce a stripped-down example, it seems as simple as creating an empty example.code-workspace file!

{
	"folders": [],
	"settings": {}
}

I can't check for sure that my original code-workspace file was indeed empty (it was deleted and rewritten since), but it is possible, because it had been a simple try out of curiosity. Anyway, it reproduces the activation error whatever the XML file.

@angelozerr angelozerr self-assigned this Nov 7, 2023
@angelozerr angelozerr added the bug Something isn't working label Nov 7, 2023
@angelozerr angelozerr changed the title Only one item in the command palette XML support crashes whenworkspace folders are empty Nov 7, 2023
@angelozerr angelozerr changed the title XML support crashes whenworkspace folders are empty XML support crashes when workspace folders are empty Nov 7, 2023
angelozerr added a commit to angelozerr/vscode-xml that referenced this issue Nov 7, 2023
@angelozerr
Copy link
Contributor

@Chadehoc I did a fix in #941

@datho7561 datho7561 added this to the 0.27.0 milestone Nov 7, 2023
datho7561 pushed a commit that referenced this issue Nov 7, 2023
@angelozerr
Copy link
Contributor

@Chadehoc my PR has been merged, tomorrow you should enjoy with vscode-xml prerelease https://github.com/redhat-developer/vscode-xml#contributing (checks the date before installing).

Please give us feedback if it fixes your issue.

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

Successfully merging a pull request may close this issue.

3 participants