Sarrus1 / sourcepawn-studio

VSCode extension for SourcePawn scripting
https://sarrus1.github.io/sourcepawn-studio/
MIT License
143 stars 22 forks source link

Extension Fails to Parse Certain Include Files #274

Closed caxanga334 closed 1 year ago

caxanga334 commented 1 year ago

Basic informations

Further Information

This extension fails to parse the include files of the CBaseNPC extension. So autocomplete doesn't include anything from those files.

To Reproduce

  1. Add the CBaseNPC include to a plugin.
  2. Start writing any function or methodmap from the CBaseNPC extension.

Code to reproduce the behaviour

#include <sourcemod>
#include <cbasenpc>

#pragma newdecls required
#pragma semicolon 1

public void OnPluginStart()
{
    // start writing any function or methodmap from CBaseNPC
    // IE: CBaseNPC_GetNextBotOfEntity

}

Expected behaviour

The autocomplete should list all available functions, methodmaps, enums, etc from the CBaseNPC extension.

Error messages

No error message related to this extension appears.

Possible cause of the issue

While testing things I found something. The CBaseNPC extention include files are written like this:

#if !defined DEFNAME
#define DEFNAME

<CODE HERE>

#endif

While sourcemod default includes are written like this:

#if defined DEFNAME
 #endinput
#endif
#define DEFNAME

<CODE HERE>

If I modify the CBaseNPC extension to follow the style of sourcemod default includes, autocomplete start working as normal.

The files are being parsed but it fails to read them properly because only the #define DEFNAME are listed for autocomplete.

screenshot_vscode_autocomplete

Sarrus1 commented 1 year ago

Thank you for reporting this. The preprocessor needs some rework, and I am currently writing a new version of the parser over here.

I will make sure to address this problem there 👍

Sarrus1 commented 1 year ago

Assumed everything is fixed. Feel free to reopen if needed!