cooolbros / vscode-vdf

VDF/Valve KeyValues language support for VSCode
https://marketplace.visualstudio.com/items?itemName=pfwobcke.vscode-vdf
GNU General Public License v3.0
22 stars 4 forks source link

Error: Request textDocument/documentLink failed #10

Closed qkeitoe closed 1 year ago

qkeitoe commented 1 year ago

image

[Error - 4:32:04 PM] Request textDocument/documentLink failed.
  Message: Request textDocument/documentLink failed with message: Cannot read properties of undefined (reading 'teamFortress2Folder')
  Code: -32603 

I don't know what exactly triggers this error or if it causes any actual problems, but I've manager to "consistently" trigger the error by switching from file to file quickly enough:

https://github.com/cooolbros/vscode-vdf/assets/66339491/f1cae2ad-c791-4d1e-a64f-d29ac0c72104

But as far as I can tell, that's not the only scenario for this error to be triggered.

cooolbros commented 1 year ago

From what I can see this only happens when "workbench.editor.enablePreview" is true, so I couldn't reproduce it using my default vscode setup, and it explains why I didnt catch it before.

The exception is indeed caused by the fast opening and closing of text documents, because the document links checks take a long time due to checking if other files exist, and by the time the calls resolve the text document has already been closed, and the settings for that text document also deleted from the language server, causing the Cannot read properties of undefined.

qkeitoe commented 1 year ago

Oh, yeah, after changing this setting to false, the error no longer occurs.

qkeitoe commented 1 year ago

I got this error even with "workbench.editor.enablePreview" being set to false. I'm not sure which of my actions caused the error. I'll try to spot it next time.


Edit: It seems that quickly closing a bunch of files causes this error.

cooolbros commented 1 year ago

Yes "workbench.editor.enablePreview" doesn't cause the error, just makes it more likely to happen. If you rapidly close many files it will also cause the error because of the fast switching and closing.

Either way this is fixed and will be released in the next update.