Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable for non-MIDL3 IDL files #47

Open
talagrand opened this issue Sep 11, 2023 · 2 comments
Open

Disable for non-MIDL3 IDL files #47

talagrand opened this issue Sep 11, 2023 · 2 comments

Comments

@talagrand
Copy link

Fantastic extension Alex, it's a huge productivity boost.

My project has a mix of MIDL3 and older IDL files. While it's unreasonable to support all the variations of IDL, I wonder if the extension could disable itself on non-MIDL3 files. Currently, the "Problems" pane is polluted with dozens of expected errors as a result.

I don't know if it's super simple to make the difference. In my case, I observe that all non-MIDL3 files either start with:

[uuid(...)]
interface ...

or

cpp_quote("#pragma once")

Or maybe project settings could enable/disable this extension on individual files/directories.

@talagrand talagrand changed the title Disable for MIDL2 files Disable for non-MIDL3 IDL files Sep 11, 2023
@asklar
Copy link
Owner

asklar commented Sep 12, 2023

Thanks glad you found it useful @talagrand :)
MIDL3 is a superset of older IDL versions so I think either:

  • need a way to disable the extension per file
  • need to extend the grammar to accept older MIDL
  • need a way to configure the MIDL version per file

The second one is kind of icky because ideally we want to encourage MIDL 3 and discourage older syntax. I'd need to investigate if there is a way for an extension to disable itself on a particular file. It probably needs the user to keep a mapping of IDL files for a project...but the extension doesn't need to operate on a project per se, it can operate on loose IDL files... so maybe a "tag comment" like // disable-midl3-extension at the beginning or something like that...
Thoughts?

@talagrand
Copy link
Author

Thanks Alex! It might be worth taking a look at how JSON Schema is supported in VSCode. JSON Schema unfortunately has no mapping from JSON file back to the underlying schema, so VSCode supports both of your suggestions - an in-file marker as well as a global mapping: https://code.visualstudio.com/docs/languages/json#_mapping-in-the-json

In my specific case the IDLs are come from SDK-like entities so a mapping-style mechanism would be preferrable but that's probably the less common need compared to the tag-based approach.

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

No branches or pull requests

2 participants