rokucommunity / brighterscript

A superset of Roku's BrightScript language
MIT License
153 stars 47 forks source link

Completion error when using callfunc short hand on function #352

Closed chrisdp closed 3 years ago

chrisdp commented 3 years ago

I am getting the following completions error for the following code:

error:

[Error - 1:10:38 PM] Request textDocument/completion failed.
  Message: Request textDocument/completion failed with message: Cannot read property 'functions' of undefined
  Code: -32603 

code: image

chrisdp commented 3 years ago

Just realizing this is happening on other types of callfunc's and also got this runtime crash in the Program. The crash above happens on typing the . and the crash below happened on typing the ( resulting in (). So going from m.global.DeviceManager@.updateInstalledChannels to m.global.DeviceManager@.updateInstalledChannels() New use case: image

Crash in program:

[Error - 1:35:50 PM] error in onSignatureHelp: Cannot read property 'functions' of undefinedTypeError: Cannot read property 'functions' of undefined
    at Program.getStatementsForXmlFile (/Users/chris/.vscode/extensions/rokucommunity.brightscript-2.17.5/node_modules/brighterscript/dist/Program.js:502:69)
    at Program.getSignatureHelp (/Users/chris/.vscode/extensions/rokucommunity.brightscript-2.17.5/node_modules/brighterscript/dist/Program.js:690:38)
    at /Users/chris/.vscode/extensions/rokucommunity.brightscript-2.17.5/node_modules/brighterscript/dist/LanguageServer.js:809:134
    at Array.map (<anonymous>)
    at LanguageServer.onSignatureHelp (/Users/chris/.vscode/extensions/rokucommunity.brightscript-2.17.5/node_modules/brighterscript/dist/LanguageServer.js:809:91)
TwitchBronBron commented 3 years ago

Thanks! This was actually a little more difficult to reproduce that you'd think, because it requires at least one xml component loaded that has no interface defined!