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

Prevent from workspace uri undefined #606

Merged
merged 1 commit into from
Oct 18, 2021

Conversation

angelozerr
Copy link
Contributor

Prevent from workspace uri undefined

Signed-off-by: azerr [email protected]

@angelozerr
Copy link
Contributor Author

This PR prevents from this usecase:

  • define a file associations in settings:
"xml.fileAssociations": [

      {
         "pattern":"**/*.fsproj",
         "systemId": "MSBuild/Microsoft.Build.Commontypes.xsd"
      }
   ]
  • open a vscode without workspace, create a file (untitled) and change the language to xml

The vscode-xml crashes and it can not be started with the error popup:

Activating extension 'redhat.vscode-xml' failed: Cannot read property 'toString' of undefined.

and the error trace:

[2021-10-18 15:49:23.410] [exthost] [error] TypeError: Cannot read property 'toString' of undefined
	at subVars (c:\Users\azerr\git\vscode-xml\dist\extension.js:27667:99)
	at c:\Users\azerr\git\vscode-xml\dist\extension.js:27673:22
	at Array.map (<anonymous>)
	at Object.getVariableSubstitutedAssociations (c:\Users\azerr\git\vscode-xml\dist\extension.js:27671:25)
	at Object.getXMLSettings (c:\Users\azerr\git\vscode-xml\dist\extension.js:27554:65)
	at getLanguageClientOptions (c:\Users\azerr\git\vscode-xml\dist\extension.js:25358:34)
	at Object.<anonymous> (c:\Users\azerr\git\vscode-xml\dist\extension.js:25286:39)
	at Generator.next (<anonymous>)
	at c:\Users\azerr\git\vscode-xml\dist\extension.js:25255:71
	at new Promise (<anonymous>)
	at c:\Users\azerr\git\vscode-xml\dist\extension.js:25251:12
	at Object.startLanguageClient (c:\Users\azerr\git\vscode-xml\dist\extension.js:25285:12)
	at c:\Users\azerr\git\vscode-xml\dist\extension.js:25935:44
	at Generator.next (<anonymous>)
	at fulfilled (c:\Users\azerr\git\vscode-xml\dist\extension.js:25886:58)

@rgrunber rgrunber added the bug Something isn't working label Oct 18, 2021
@angelozerr angelozerr merged commit ef141c6 into redhat-developer:master Oct 18, 2021
@angelozerr
Copy link
Contributor Author

Thanks @rgrunber !

@angelozerr angelozerr added this to the 0.18.1 milestone Oct 18, 2021
@rgrunber
Copy link
Member

rgrunber commented Nov 3, 2021

@AlexXuChen was able to reproduce this (myself as well) when only a file (no workspace) is opened, and attempting to associate that xml file with a schema on the filesystem.

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
None yet
Development

Successfully merging this pull request may close these issues.

2 participants