rokucommunity/vscode-brightscript-language

"Not in scope" warnings are shown even though the function/etc is defined in a parent component

simon-grantham opened this issue · 4 comments

"Not in scope" warnings are underlined in code and percolated to file explorer even thought the definition is in scope in a parent component ( ie. current component defined as extending a parent, and so on up the derivation chain.)

Can you provide a sample project or zip reproducing the issue? Typically are valid issues, due to some OTHER scope not having the required imports.

Will do...

We see this one scattered enormously through our code base, but in creating an example, I realize it is due to us creating "Abstract Components" (or abstract derivations thereof). That is, the Abstract Component is invoking methods it expects to be defined in components that are extensions of the "Abstract Component". We do not create dummy (empty) definitions in the "Abstract Component" because, like all good compilers ;) , we want to have an error thrown at compile time.

Regardless, I have attached an example as promised.

simple-videoplayer-channel.zip

grep -rin --include=*.brs "issues/556"

Yeah, that's the exact issue I was expecting to see. So you currently have 2 options at this point:

  • define the function in the base component...all the errors will go away
  • add a 'bs:disable-line comment after the function, which will suppress the diagnostic

I also just finished chatting with @chrisdp, and we think we have a way to make this slightly less annoying by using runtime checks. See rokucommunity/brighterscript#1121. Would something like that be acceptable?