Serpen / VBS-VSCode

VSCode VBScript language extension
https://marketplace.visualstudio.com/items?itemName=Serpen.vbsvscode
MIT License
24 stars 11 forks source link

Offer only class specific functions? #35

Closed Benik3 closed 3 years ago

Benik3 commented 3 years ago

Now intellisense offers functions/Subs/Property from all classes even that the selected class doesn't support it:
obrazek

Serpen commented 3 years ago

Yes, this is currently the way it works. Duplicate of #18. Since VBS has now typesystem, VBS can only guarantee at runtime to know which type a variable is. So it es pure guessing, so I decided to offer everything instead of nothing.

If I get the pseudo typesystem running, this can change.

More Worse: In your Screenshot you try to access instance members as instance members. VBS has no shared or static keyword. That code would never work.

Benik3 commented 3 years ago

More Worse: In your Screenshot you try to access instance members as instance members. VBS has no shared or static keyword. That code would never work.

That's true. The reason is, that we use scripts in SW, which has already created these objects, but the inbuilt editor is very simple. So I wanted to try to write the scripts in e.g. VSCode with IntelliSense and then import them back. The scripts will never work outside of the SW anyway. I see that you have this for Err and Wscript but it's hard coded in the completion.ts.

I forgot that in VBscript you can change even the object type as you want :/ So only for evident object it would be applicable (like when you have Set dict = CreateObject("Scripting.Dictionary")), otherwise I assume it wiould be pretty hard to track it the Intellisense.