Visual Studio Code / Reference material.inc.php

Game development with Board Game Arena Studio
Post Reply
User avatar
vurtan
Posts: 36
Joined: 13 June 2020, 19:54

Visual Studio Code / Reference material.inc.php

Post 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?
User avatar
Victoria_La
Posts: 608
Joined: 28 December 2015, 20:55

Re: Visual Studio Code / Reference material.inc.php

Post 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

Code: Select all

    private $token_types;
in my game.php class as member
User avatar
Blacktango
Posts: 432
Joined: 18 April 2015, 12:15

Re: Visual Studio Code / Reference material.inc.php

Post 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.
User avatar
Victoria_La
Posts: 608
Joined: 28 December 2015, 20:55

Re: Visual Studio Code / Reference material.inc.php

Post 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.
User avatar
vurtan
Posts: 36
Joined: 13 June 2020, 19:54

Re: Visual Studio Code / Reference material.inc.php

Post 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 :) .
Post Reply

Return to “Developers”