Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/agents/midl-dev.agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ npm run test:parser # Run parser tests
- Open any `.idl` file to test language features

### Publishing
- Update version: `npm version patch`
- **Always bump the package version** in `package.json` when making changes that will be published
- Use semantic versioning: patch (0.0.X) for bug fixes, minor (0.X.0) for features, major (X.0.0) for breaking changes
- Publishing happens automatically via GitHub Actions on push to main

## Common Development Tasks
Expand Down Expand Up @@ -168,6 +169,7 @@ When working on this repository:
6. **Document**: Update README or comments if making significant changes
7. **Security**: Check for vulnerabilities, especially in dependencies
8. **Validate**: Test language features in a real VSCode instance when possible
9. **Version Bumping**: Always bump the package version in `package.json` for any PR that will be merged (use patch version for bug fixes, minor for features)

## Example Tasks

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"icon": "images/midl3.png",
"author": "Microsoft Corporation",
"license": "MIT",
"version": "0.0.32",
"version": "0.0.33",
"repository": {
"type": "git",
"url": "https://github.com/asklar/midl-langserv"
Expand Down
4 changes: 4 additions & 0 deletions server/src/midl.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ importKeyword = "import" { return emit('keyword'); }
( includeKW _ includeReference ) /
( ifdefKW _ preprocessorExpression ) /
( ifndefKW _ preprocessorExpression ) /
( elifKW _ preprocessorExpression ) /
( ifKW _ preprocessorExpression) /
( elseKW ) /
( endifKW ) /
( defineKW _ identifier preprocessorExpression ) /
( undefKW _ identifier )
Expand All @@ -61,7 +63,9 @@ importKeyword = "import" { return emit('keyword'); }
includeKW = "#include" { emit('preProcessor'); }
ifdefKW = "#ifdef" { emit('preProcessor'); }
ifndefKW = "#ifndef" { emit('preProcessor'); }
elifKW = "#elif" { emit('preProcessor'); }
ifKW = "#if" { emit('preProcessor'); }
elseKW = "#else" { emit('preProcessor'); }
endifKW = "#endif" { emit('preProcessor'); }
defineKW = "#define" { emit('preProcessor'); }
undefKW = "#undef" { emit('preProcessor'); }
Expand Down
24 changes: 24 additions & 0 deletions server/src/test/assets/preprocessor.idl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#ifndef FOO
#define FOO 1

namespace TestNamespace
{
runtimeclass TestClass
{
TestClass();
Int32 TestProperty{ get; };
}
}

#else

namespace AlternateNamespace
{
runtimeclass AlternateClass
{
AlternateClass();
String AlternateProperty{ get; };
}
}

#endif
38 changes: 38 additions & 0 deletions server/src/test/assets/preprocessor_elif.idl
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#ifndef VERSION
#define VERSION 3
#endif

#if VERSION == 1

namespace Version1
{
runtimeclass MyClass
{
MyClass();
Int32 Property1{ get; };
}
}

#elif VERSION == 2

namespace Version2
{
runtimeclass MyClass
{
MyClass();
String Property2{ get; };
}
}

#else

namespace DefaultVersion
{
runtimeclass MyClass
{
MyClass();
Boolean Property3{ get; };
}
}

#endif
2 changes: 1 addition & 1 deletion syntaxes/midl3.tmGrammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"preprocessor": {
"name": "keyword.other",
"match": "#(include|define|ifdef|ifndef|if|else|endif|pragma)"
"match": "#(include|define|ifdef|ifndef|if|elif|else|endif|pragma)"
},
"comment": {
"patterns": [
Expand Down