Armitxes / VSCode_SQF

Visual Studio Code ~ SQF Language plugin
https://armitxes.net/Projects/VSCodeSQF/
Other
48 stars 29 forks source link

Error "Request textDocument/hover failed." spam when hovering over anything #36

Closed ConnorAU closed 5 years ago

ConnorAU commented 5 years ago

Hover over literally anything, even whitespace, and this error pops up in the console.

[Error - 10:32:15 am] Request textDocument/hover failed.
  Message: Request textDocument/hover failed with message: Cannot set property '34' of undefined
  Code: -32603 

This log is shown on VSCode start

TypeError: Cannot set property '34' of undefined
    at SqfFile.parseFile (c:\Users\Connor\.vscode\extensions\armitxes.sqf-2.0.2\env\server\provider\SqfFile.js:69:79)
    at SqfFile.update (c:\Users\Connor\.vscode\extensions\armitxes.sqf-2.0.2\env\server\provider\SqfFile.js:30:22)
    at new SqfFile (c:\Users\Connor\.vscode\extensions\armitxes.sqf-2.0.2\env\server\provider\SqfFile.js:22:14)
    at SqfProject.getSqfFile (c:\Users\Connor\.vscode\extensions\armitxes.sqf-2.0.2\env\server\provider\SqfProject.js:37:33)
    at exports.documents.onDidChangeContent (c:\Users\Connor\.vscode\extensions\armitxes.sqf-2.0.2\env\server\init\variables.js:24:69)
    at CallbackList.invoke (c:\Users\Connor\.vscode\extensions\armitxes.sqf-2.0.2\node_modules\vscode-jsonrpc\lib\events.js:62:39)
    at Emitter.fire (c:\Users\Connor\.vscode\extensions\armitxes.sqf-2.0.2\node_modules\vscode-jsonrpc\lib\events.js:120:36)
    at connection.onDidOpenTextDocument (c:\Users\Connor\.vscode\extensions\armitxes.sqf-2.0.2\node_modules\vscode-languageserver\lib\main.js:181:38)
    at handleNotification (c:\Users\Connor\.vscode\extensions\armitxes.sqf-2.0.2\node_modules\vscode-jsonrpc\lib\main.js:489:43)
    at processMessageQueue (c:\Users\Connor\.vscode\extensions\armitxes.sqf-2.0.2\node_modules\vscode-jsonrpc\lib\main.js:260:17)
Armitxes commented 5 years ago

Interesting... tested it on all my devices & projects before releasing it but didn't have that issue.

Will look into it further once I'm at home

Sparfell commented 5 years ago

Same issue here.

Armitxes commented 5 years ago

Ok, I tried several things but I've found no way to reproduce this.

I believe it has to do with the !(SqfFileWord in this.fileLines[i].words) condition which is needed to be true once for the "occurrences" dict to be set. For some reason, it seems to fail under specific circumstances.

Will roll out a fix tomorrow together with Connors changes. Yet I hope to find a way to actually reproduce this issue.

Armitxes commented 5 years ago

Please tell me if this is fixed for you now. You should get an update notification in VS Code any minute

ConnorAU commented 5 years ago

Looks like its fixed for me 👍