Page 1 of 1
Visual Studio Code / Reference material.inc.php
Posted: 22 March 2023, 21:36
by vurtan
After doing some programming using Notepad++ and the FTP Plugin I wanted to use a more professional approach.
Since I have already experience with VS Code from the work I decided to use that. I went to the documentation and followed the instructions from
https://en.doc.boardgamearena.com/Setti ... ing_VSCode.
Now I'm stuck with an error message in the ???.game.php file of an "undefined property" which is created/defined in the material.inc.php.
I know that on the BGA server everything is working, but I wondered if there is anything I can do in VS code. Does anyone know?
Re: Visual Studio Code / Reference material.inc.php
Posted: 25 March 2023, 19:22
by Victoria_La
You can disable Intelephense > Diagnostics: Undefined Properties in the Intelephense extension config using settings editor;
Or put this line in the settings.json
"intelephense.diagnostics.undefinedProperties": false
If you don't have too many class members you can define them, for example if I have $this->token_types = [...] in the material file I can define
in my game.php class as member
Re: Visual Studio Code / Reference material.inc.php
Posted: 25 March 2023, 23:08
by Blacktango
I just started the development tutorial and got the same annoying warning messages in my IDE.
I created a php file containing the signatures of all classes /methods / functions and was able to add it in the include path of my IDE.
Then the IDE considerate I have access to it, and the messages are gone.
You can find
my file here. It’s based on another created by Teddy Gandon.
I’m new to BGA development, so the file is certainly not complete.
Re: Visual Studio Code / Reference material.inc.php
Posted: 26 March 2023, 19:25
by Victoria_La
That was already done, the wiki page
https://en.doc.boardgamearena.com/Setti ... ing_VSCode
lists the project on gibhub and how to link it. This specific question was about warning on variable from material file - which you just have
to define in your class
Blacktango wrote: ↑25 March 2023, 23:08
I just started the development tutorial and got the same annoying warning messages in my IDE.
I created a php file containing the signatures of all classes /methods / functions and was able to add it in the include path of my IDE.
Then the IDE considerate I have access to it, and the messages are gone.
You can find
my file here. It’s based on another created by Teddy Gandon.
I’m new to BGA development, so the file is certainly not complete.
Re: Visual Studio Code / Reference material.inc.php
Posted: 27 March 2023, 15:10
by vurtan
I would prefer to keep the diagnostic setting from intelephense active for the undefinedProperties.
That said, I will do some parsing of the material.inc.php to extract that information and generate the defintions out of it. A little bit of parsing is always fun for myself

.