Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 21, 2025

The parser supported #ifndef, #ifdef, #if, and #endif but failed on #else and #elif, causing parse errors on standard C preprocessor patterns:

#ifndef FOO
namespace Primary {
    runtimeclass MyClass { }
}
#else
namespace Fallback {
    runtimeclass MyClass { }
}
#endif

Changes

PEG.js grammar (server/src/midl.pegjs):

  • Added elseKW and elifKW keyword definitions following existing preprocessor directive pattern
  • Updated preprocessorStatement rule to include both directives

TextMate grammar (syntaxes/midl3.tmGrammar.json):

  • Added #elif to preprocessor regex pattern (#else was already present)

Package version (package.json):

  • Bumped version from 0.0.32 to 0.0.33

Agent configuration (.github/agents/midl-dev.agent.md):

  • Added instructions to always bump package version in future PRs
  • Added semantic versioning guidelines
  • Updated Agent Responsibilities section with version bumping requirement

Test coverage:

  • Added preprocessor.idl validating #ifndef/#else/#endif
  • Added preprocessor_elif.idl validating #if/#elif/#else/#endif chains

<issue_title>ifndef not supported</issue_title>
><issue_description>idl &gt; #ifndef FOO &gt; // ... &gt; #else &gt; // ... &gt; #endif &gt;
>
> doesn't seem to be understood.</issue_description>
>
> ## Comments on the Issue (you are @copilot in this section)
>
>
>
>

> Custom agent used: MIDL Language Server Developer
> Expert in MIDL 3.0 language server development, VSCode extensions, and WinRT API definitions

Original prompt

This section details on the original issue you should resolve

<issue_title>ifndef not supported</issue_title>
<issue_description>```idl
#ifndef FOO
// ...
#else
// ...
#endif


doesn't seem to be understood.</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>

Custom agent used: MIDL Language Server Developer
Expert in MIDL 3.0 language server development, VSCode extensions, and WinRT API definitions


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Fix support for ifndef preprocessor directive Add support for #else and #elif preprocessor directives Nov 21, 2025
Copilot AI requested a review from asklar November 21, 2025 18:56
Copilot finished work on behalf of asklar November 21, 2025 18:56
@asklar
Copy link
Owner

asklar commented Nov 21, 2025

@copilot can you bump the package version? make sure you update the agent description file to do so in future PRs automatically too

Copy link
Contributor Author

Copilot AI commented Nov 21, 2025

@copilot can you bump the package version? make sure you update the agent description file to do so in future PRs automatically too

Done! Bumped version to 0.0.33 and updated the agent description file with version bumping instructions for future PRs. Changes in commit 5b28c78.

Copilot finished work on behalf of asklar November 21, 2025 19:14
@asklar asklar marked this pull request as ready for review November 21, 2025 19:37
@asklar asklar merged commit 9fd234e into main Nov 21, 2025
2 checks passed
@asklar asklar deleted the copilot/fix-unsupported-ifndef branch November 21, 2025 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ifndef not supported

2 participants