├── .editorconfig ├── .gitattributes ├── .github ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── workflows │ ├── Windows.runsettings │ └── build.yaml ├── .gitignore ├── LICENSE ├── MIDL.lutconfig ├── MIDL.sln ├── README.md ├── art ├── context-menu.png ├── merge.png └── suggested-actions.gif ├── lib └── Microsoft.VisualStudio.Merge.dll ├── src ├── MIDL │ ├── Commands │ │ ├── CopyEntityToClipboard.cs │ │ ├── SmartIndent.cs │ │ └── UpdateHeaderFile.cs │ ├── Editor │ │ ├── EditorFeatures.cs │ │ ├── LanguageFactory.cs │ │ └── TokenTagger.cs │ ├── ExtensionMethods.cs │ ├── IdlDocument.cs │ ├── IdlTransformer.cs │ ├── MIDL.csproj │ ├── MIDLPackage.cs │ ├── Options │ │ └── General.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Resources │ │ ├── Icon.png │ │ └── microProj.vcxproj │ ├── SuggestedActions │ │ ├── FixTypeAction.cs │ │ ├── SuggestedActionsProvider.cs │ │ └── SuggestedActionsSource.cs │ ├── VSCommandTable.cs │ ├── VSCommandTable.vsct │ ├── source.extension.cs │ └── source.extension.vsixmanifest └── MIDLParser │ ├── Constants.cs │ ├── Document.cs │ ├── DocumentParser.cs │ ├── ItemType.cs │ ├── MIDLParser.csproj │ └── ParseItem.cs ├── test └── MIDLParser.Test │ ├── .editorconfig │ ├── MIDLParser.Test.csproj │ ├── Properties │ └── AssemblyInfo.cs │ └── TokenTest.cs └── vs-publish.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome:http://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Don't use tabs for indentation. 7 | [*] 8 | indent_style = space 9 | end_of_line = crlf 10 | # (Please don't specify an indent_size here; that has too many unintended consequences.) 11 | 12 | # Code files 13 | [*.{cs,csx,vb,vbx,xaml}] 14 | indent_size = 4 15 | 16 | # Xml project files 17 | [*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] 18 | indent_size = 2 19 | 20 | # Xml config files 21 | [*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}] 22 | indent_size = 2 23 | 24 | # JSON files 25 | [*.json] 26 | indent_size = 2 27 | 28 | # Dotnet code style settings: 29 | [*.{cs,vb}] 30 | # Sort using and Import directives with System.* appearing first 31 | dotnet_sort_system_directives_first = true 32 | dotnet_separate_import_directive_groups = false 33 | 34 | # Avoid "this." and "Me." if not necessary 35 | dotnet_style_qualification_for_field = false : suggestion 36 | dotnet_style_qualification_for_property = false : suggestion 37 | dotnet_style_qualification_for_method = false : suggestion 38 | dotnet_style_qualification_for_event = false : suggestion 39 | 40 | # Use language keywords instead of framework type names for type references 41 | dotnet_style_predefined_type_for_locals_parameters_members = true : suggestion 42 | dotnet_style_predefined_type_for_member_access = true : suggestion 43 | 44 | # Suggest more modern language features when available 45 | dotnet_style_object_initializer = true : suggestion 46 | dotnet_style_collection_initializer = true : suggestion 47 | dotnet_style_coalesce_expression = true : suggestion 48 | dotnet_style_null_propagation = true : suggestion 49 | dotnet_style_explicit_tuple_names = true : suggestion 50 | 51 | # Naming rules - async methods to be prefixed with Async 52 | dotnet_naming_rule.async_methods_must_end_with_async.severity = warning 53 | dotnet_naming_rule.async_methods_must_end_with_async.symbols = method_symbols 54 | dotnet_naming_rule.async_methods_must_end_with_async.style = end_in_async_style 55 | 56 | dotnet_naming_symbols.method_symbols.applicable_kinds = method 57 | dotnet_naming_symbols.method_symbols.required_modifiers = async 58 | 59 | dotnet_naming_style.end_in_async_style.capitalization = pascal_case 60 | dotnet_naming_style.end_in_async_style.required_suffix = Async 61 | 62 | # Naming rules - private fields must start with an underscore 63 | dotnet_naming_rule.field_must_start_with_underscore.severity = warning 64 | dotnet_naming_rule.field_must_start_with_underscore.symbols = private_fields 65 | dotnet_naming_rule.field_must_start_with_underscore.style = start_underscore_style 66 | 67 | dotnet_naming_symbols.private_fields.applicable_kinds = field 68 | dotnet_naming_symbols.private_fields.applicable_accessibilities = private 69 | 70 | dotnet_naming_style.start_underscore_style.capitalization = camel_case 71 | dotnet_naming_style.start_underscore_style.required_prefix = _ 72 | 73 | # CSharp code style settings: 74 | [*.cs] 75 | # Prefer "var" everywhere 76 | csharp_style_var_for_built_in_types =false:error 77 | csharp_style_var_when_type_is_apparent =false:error 78 | csharp_style_var_elsewhere =false:error 79 | 80 | # Prefer method-like constructs to have a block body 81 | csharp_style_expression_bodied_methods = false : none 82 | csharp_style_expression_bodied_constructors = false : none 83 | csharp_style_expression_bodied_operators = false : none 84 | 85 | # Prefer property-like constructs to have an expression-body 86 | csharp_style_expression_bodied_properties = true : none 87 | csharp_style_expression_bodied_indexers = true : none 88 | csharp_style_expression_bodied_accessors = true : none 89 | 90 | # Suggest more modern language features when available 91 | csharp_style_pattern_matching_over_is_with_cast_check = true : suggestion 92 | csharp_style_pattern_matching_over_as_with_null_check = true : suggestion 93 | csharp_style_inlined_variable_declaration = true : suggestion 94 | csharp_style_throw_expression = true : suggestion 95 | csharp_style_conditional_delegate_call = true : suggestion 96 | 97 | # Newline settings 98 | csharp_new_line_before_open_brace = all 99 | csharp_new_line_before_else = true 100 | csharp_new_line_before_catch = true 101 | csharp_new_line_before_finally = true 102 | csharp_new_line_before_members_in_object_initializers = true 103 | csharp_new_line_before_members_in_anonymous_types = true 104 | 105 | # IDE 106 | dotnet_diagnostic.IDE0058.severity = none 107 | dotnet_diagnostic.RS2008.severity = none # RS2008: Enable analyzer release tracking 108 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | @mkristensen on Twitter. 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Looking to contribute something? **Here's how you can help.** 4 | 5 | Please take a moment to review this document in order to make the contribution 6 | process easy and effective for everyone involved. 7 | 8 | Following these guidelines helps to communicate that you respect the time of 9 | the developers managing and developing this open source project. In return, 10 | they should reciprocate that respect in addressing your issue or assessing 11 | patches and features. 12 | 13 | 14 | ## Using the issue tracker 15 | 16 | The issue tracker is the preferred channel for [bug reports](#bug-reports), 17 | [features requests](#feature-requests) and 18 | [submitting pull requests](#pull-requests), but please respect the 19 | following restrictions: 20 | 21 | * Please **do not** use the issue tracker for personal support requests. Stack 22 | Overflow is a better place to get help. 23 | 24 | * Please **do not** derail or troll issues. Keep the discussion on topic and 25 | respect the opinions of others. 26 | 27 | * Please **do not** open issues or pull requests which *belongs to* third party 28 | components. 29 | 30 | 31 | ## Bug reports 32 | 33 | A bug is a _demonstrable problem_ that is caused by the code in the repository. 34 | Good bug reports are extremely helpful, so thanks! 35 | 36 | Guidelines for bug reports: 37 | 38 | 1. **Use the GitHub issue search** — check if the issue has already been 39 | reported. 40 | 41 | 2. **Check if the issue has been fixed** — try to reproduce it using the 42 | latest `master` or development branch in the repository. 43 | 44 | 3. **Isolate the problem** — ideally create an 45 | [SSCCE](http://www.sscce.org/) and a live example. 46 | Uploading the project on cloud storage (OneDrive, DropBox, et el.) 47 | or creating a sample GitHub repository is also helpful. 48 | 49 | 50 | A good bug report shouldn't leave others needing to chase you up for more 51 | information. Please try to be as detailed as possible in your report. What is 52 | your environment? What steps will reproduce the issue? What browser(s) and OS 53 | experience the problem? Do other browsers show the bug differently? What 54 | would you expect to be the outcome? All these details will help people to fix 55 | any potential bugs. 56 | 57 | Example: 58 | 59 | > Short and descriptive example bug report title 60 | > 61 | > A summary of the issue and the Visual Studio, browser, OS environments 62 | > in which it occurs. If suitable, include the steps required to reproduce the bug. 63 | > 64 | > 1. This is the first step 65 | > 2. This is the second step 66 | > 3. Further steps, etc. 67 | > 68 | > `` - a link to the project/file uploaded on cloud storage or other publicly accessible medium. 69 | > 70 | > Any other information you want to share that is relevant to the issue being 71 | > reported. This might include the lines of code that you have identified as 72 | > causing the bug, and potential solutions (and your opinions on their 73 | > merits). 74 | 75 | 76 | ## Feature requests 77 | 78 | Feature requests are welcome. But take a moment to find out whether your idea 79 | fits with the scope and aims of the project. It's up to *you* to make a strong 80 | case to convince the project's developers of the merits of this feature. Please 81 | provide as much detail and context as possible. 82 | 83 | 84 | ## Pull requests 85 | 86 | Good pull requests, patches, improvements and new features are a fantastic 87 | help. They should remain focused in scope and avoid containing unrelated 88 | commits. 89 | 90 | **Please ask first** before embarking on any significant pull request (e.g. 91 | implementing features, refactoring code, porting to a different language), 92 | otherwise you risk spending a lot of time working on something that the 93 | project's developers might not want to merge into the project. 94 | 95 | Please adhere to the [coding guidelines](#code-guidelines) used throughout the 96 | project (indentation, accurate comments, etc.) and any other requirements 97 | (such as test coverage). 98 | 99 | Adhering to the following process is the best way to get your work 100 | included in the project: 101 | 102 | 1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork, 103 | and configure the remotes: 104 | 105 | ```bash 106 | # Clone your fork of the repo into the current directory 107 | git clone https://github.com//.git 108 | # Navigate to the newly cloned directory 109 | cd 110 | # Assign the original repo to a remote called "upstream" 111 | git remote add upstream https://github.com/madskristensen/.git 112 | ``` 113 | 114 | 2. If you cloned a while ago, get the latest changes from upstream: 115 | 116 | ```bash 117 | git checkout master 118 | git pull upstream master 119 | ``` 120 | 121 | 3. Create a new topic branch (off the main project development branch) to 122 | contain your feature, change, or fix: 123 | 124 | ```bash 125 | git checkout -b 126 | ``` 127 | 128 | 4. Commit your changes in logical chunks. Please adhere to these [git commit 129 | message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) 130 | or your code is unlikely be merged into the main project. Use Git's 131 | [interactive rebase](https://help.github.com/articles/interactive-rebase) 132 | feature to tidy up your commits before making them public. Also, prepend name of the feature 133 | to the commit message. For instance: "SCSS: Fixes compiler results for IFileListener.\nFixes `#123`" 134 | 135 | 5. Locally merge (or rebase) the upstream development branch into your topic branch: 136 | 137 | ```bash 138 | git pull [--rebase] upstream master 139 | ``` 140 | 141 | 6. Push your topic branch up to your fork: 142 | 143 | ```bash 144 | git push origin 145 | ``` 146 | 147 | 7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/) 148 | with a clear title and description against the `master` branch. 149 | 150 | 151 | ## Code guidelines 152 | 153 | - Always use proper indentation. 154 | - In Visual Studio under `Tools > Options > Text Editor > C# > Advanced`, make sure 155 | `Place 'System' directives first when sorting usings` option is enabled (checked). 156 | - Before committing, organize usings for each updated C# source file. Either you can 157 | right-click editor and select `Organize Usings > Remove and sort` OR use extension 158 | like [BatchFormat](https://marketplace.visualstudio.com/items?itemName=vs-publisher-147549.BatchFormat). 159 | - Before committing, run Code Analysis in `Debug` configuration and follow the guidelines 160 | to fix CA issues. Code Analysis commits can be made separately. 161 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: madskristensen 4 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Additional context** 27 | Add any other context about the problem here. 28 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/workflows/Windows.runsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | %GITHUB_WORKSPACE% 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.github/workflows/build.yaml: -------------------------------------------------------------------------------- 1 | # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json 2 | name: "Build" 3 | 4 | on: 5 | push: 6 | branches: [master] 7 | pull_request: 8 | branches: [master] 9 | workflow_dispatch: 10 | branches: [master] 11 | 12 | jobs: 13 | build: 14 | outputs: 15 | version: ${{ steps.vsix_version.outputs.version-number }} 16 | name: Build 17 | runs-on: windows-2022 18 | env: 19 | Configuration: Release 20 | DeployExtension: False 21 | VsixManifestPath: src\MIDL\source.extension.vsixmanifest 22 | VsixManifestSourcePath: src\MIDL\source.extension.cs 23 | 24 | steps: 25 | - uses: actions/checkout@v2 26 | 27 | - name: Setup .NET build dependencies 28 | uses: timheuer/bootstrap-dotnet@v1 29 | with: 30 | nuget: 'false' 31 | sdk: 'false' 32 | msbuild: 'true' 33 | 34 | - name: Increment VSIX version 35 | id: vsix_version 36 | uses: timheuer/vsix-version-stamp@v1 37 | with: 38 | manifest-file: ${{ env.VsixManifestPath }} 39 | vsix-token-source-file: ${{ env.VsixManifestSourcePath }} 40 | 41 | - name: Build 42 | run: msbuild /v:m -restore /p:OutDir=\_built 43 | 44 | - name: Setup test 45 | uses: darenm/Setup-VSTest@v1 46 | 47 | - name: Test 48 | run: vstest.console.exe \_built\*Test.dll 49 | 50 | - name: Upload artifact 51 | uses: actions/upload-artifact@v2 52 | with: 53 | name: ${{ github.event.repository.name }}.vsix 54 | path: /_built/**/*.vsix 55 | 56 | publish: 57 | if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} 58 | needs: build 59 | runs-on: windows-latest 60 | 61 | steps: 62 | - uses: actions/checkout@v2 63 | 64 | - name: Download Package artifact 65 | uses: actions/download-artifact@v2 66 | with: 67 | name: ${{ github.event.repository.name }}.vsix 68 | 69 | - name: Upload to Open VSIX 70 | uses: timheuer/openvsixpublish@v1 71 | with: 72 | vsix-file: ${{ github.event.repository.name }}.vsix 73 | 74 | #- name: Tag and Release 75 | # if: ${{ github.event_name == 'workflow_dispatch' || contains(github.event.head_commit.message, '[release]') }} 76 | # id: tag_release 77 | # uses: softprops/action-gh-release@v1 78 | # with: 79 | # body: Release ${{ needs.build.outputs.version }} 80 | # tag_name: ${{ needs.build.outputs.version }} 81 | # files: | 82 | # **/*.vsix 83 | 84 | - name: Publish extension to Marketplace 85 | if: ${{ github.event_name == 'workflow_dispatch' || contains(github.event.head_commit.message, '[release]') }} 86 | uses: cezarypiatek/VsixPublisherAction@0.2 87 | with: 88 | extension-file: '${{ github.event.repository.name }}.vsix' 89 | publish-manifest-file: 'vs-publish.json' 90 | personal-access-code: ${{ secrets.VS_PUBLISHER_ACCESS_TOKEN }} 91 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | project.fragment.lock.json 46 | artifacts/ 47 | 48 | *_i.c 49 | *_p.c 50 | *_i.h 51 | *.ilk 52 | *.meta 53 | *.obj 54 | *.pch 55 | *.pdb 56 | *.pgc 57 | *.pgd 58 | *.rsp 59 | *.sbr 60 | *.tlb 61 | *.tli 62 | *.tlh 63 | *.tmp 64 | *.tmp_proj 65 | *.log 66 | *.vspscc 67 | *.vssscc 68 | .builds 69 | *.pidb 70 | *.svclog 71 | *.scc 72 | 73 | # Chutzpah Test files 74 | _Chutzpah* 75 | 76 | # Visual C++ cache files 77 | ipch/ 78 | *.aps 79 | *.ncb 80 | *.opendb 81 | *.opensdf 82 | *.sdf 83 | *.cachefile 84 | *.VC.db 85 | *.VC.VC.opendb 86 | 87 | # Visual Studio profiler 88 | *.psess 89 | *.vsp 90 | *.vspx 91 | *.sap 92 | 93 | # TFS 2012 Local Workspace 94 | $tf/ 95 | 96 | # Guidance Automation Toolkit 97 | *.gpState 98 | 99 | # ReSharper is a .NET coding add-in 100 | _ReSharper*/ 101 | *.[Rr]e[Ss]harper 102 | *.DotSettings.user 103 | 104 | # JustCode is a .NET coding add-in 105 | .JustCode 106 | 107 | # TeamCity is a build add-in 108 | _TeamCity* 109 | 110 | # DotCover is a Code Coverage Tool 111 | *.dotCover 112 | 113 | # NCrunch 114 | _NCrunch_* 115 | .*crunch*.local.xml 116 | nCrunchTemp_* 117 | 118 | # MightyMoose 119 | *.mm.* 120 | AutoTest.Net/ 121 | 122 | # Web workbench (sass) 123 | .sass-cache/ 124 | 125 | # Installshield output folder 126 | [Ee]xpress/ 127 | 128 | # DocProject is a documentation generator add-in 129 | DocProject/buildhelp/ 130 | DocProject/Help/*.HxT 131 | DocProject/Help/*.HxC 132 | DocProject/Help/*.hhc 133 | DocProject/Help/*.hhk 134 | DocProject/Help/*.hhp 135 | DocProject/Help/Html2 136 | DocProject/Help/html 137 | 138 | # Click-Once directory 139 | publish/ 140 | 141 | # Publish Web Output 142 | *.[Pp]ublish.xml 143 | *.azurePubxml 144 | # TODO: Comment the next line if you want to checkin your web deploy settings 145 | # but database connection strings (with potential passwords) will be unencrypted 146 | #*.pubxml 147 | *.publishproj 148 | 149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 150 | # checkin your Azure Web App publish settings, but sensitive information contained 151 | # in these scripts will be unencrypted 152 | PublishScripts/ 153 | 154 | # NuGet Packages 155 | *.nupkg 156 | # The packages folder can be ignored because of Package Restore 157 | **/packages/* 158 | # except build/, which is used as an MSBuild target. 159 | !**/packages/build/ 160 | # Uncomment if necessary however generally it will be regenerated when needed 161 | #!**/packages/repositories.config 162 | # NuGet v3's project.json files produces more ignoreable files 163 | *.nuget.props 164 | *.nuget.targets 165 | 166 | # Microsoft Azure Build Output 167 | csx/ 168 | *.build.csdef 169 | 170 | # Microsoft Azure Emulator 171 | ecf/ 172 | rcf/ 173 | 174 | # Windows Store app package directories and files 175 | AppPackages/ 176 | BundleArtifacts/ 177 | Package.StoreAssociation.xml 178 | _pkginfo.txt 179 | 180 | # Visual Studio cache files 181 | # files ending in .cache can be ignored 182 | *.[Cc]ache 183 | # but keep track of directories ending in .cache 184 | !*.[Cc]ache/ 185 | 186 | # Others 187 | ClientBin/ 188 | ~$* 189 | *~ 190 | *.dbmdl 191 | *.dbproj.schemaview 192 | *.jfm 193 | *.pfx 194 | *.publishsettings 195 | node_modules/ 196 | orleans.codegen.cs 197 | 198 | # Since there are multiple workflows, uncomment next line to ignore bower_components 199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 200 | #bower_components/ 201 | 202 | # RIA/Silverlight projects 203 | Generated_Code/ 204 | 205 | # Backup & report files from converting an old project file 206 | # to a newer Visual Studio version. Backup files are not needed, 207 | # because we have git ;-) 208 | _UpgradeReport_Files/ 209 | Backup*/ 210 | UpgradeLog*.XML 211 | UpgradeLog*.htm 212 | 213 | # SQL Server files 214 | *.mdf 215 | *.ldf 216 | 217 | # Business Intelligence projects 218 | *.rdl.data 219 | *.bim.layout 220 | *.bim_*.settings 221 | 222 | # Microsoft Fakes 223 | FakesAssemblies/ 224 | 225 | # GhostDoc plugin setting file 226 | *.GhostDoc.xml 227 | 228 | # Node.js Tools for Visual Studio 229 | .ntvs_analysis.dat 230 | 231 | # Visual Studio 6 build log 232 | *.plg 233 | 234 | # Visual Studio 6 workspace options file 235 | *.opt 236 | 237 | # Visual Studio LightSwitch build output 238 | **/*.HTMLClient/GeneratedArtifacts 239 | **/*.DesktopClient/GeneratedArtifacts 240 | **/*.DesktopClient/ModelManifest.xml 241 | **/*.Server/GeneratedArtifacts 242 | **/*.Server/ModelManifest.xml 243 | _Pvt_Extensions 244 | 245 | # Paket dependency manager 246 | .paket/paket.exe 247 | paket-files/ 248 | 249 | # FAKE - F# Make 250 | .fake/ 251 | 252 | # JetBrains Rider 253 | .idea/ 254 | *.sln.iml 255 | 256 | # CodeRush 257 | .cr/ 258 | 259 | # Python Tools for Visual Studio (PTVS) 260 | __pycache__/ 261 | *.pyc -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2020 Mads Kristensen 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /MIDL.lutconfig: -------------------------------------------------------------------------------- 1 | 2 | 3 | true 4 | true 5 | false 6 | 180000 7 | -------------------------------------------------------------------------------- /MIDL.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.3.32510.385 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MIDL", "src\MIDL\MIDL.csproj", "{91609F6F-9CD8-406D-A10B-B35CBA88CD79}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MIDLParser", "src\MIDLParser\MIDLParser.csproj", "{0CAB4EBB-AA58-4742-8ACF-0852AF458BD9}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MIDLParser.Test", "test\MIDLParser.Test\MIDLParser.Test.csproj", "{81A8CD1D-B110-45E9-9488-814FEFF0829D}" 11 | EndProject 12 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{693E33DD-04B6-41E2-9D26-C136ECD75CF1}" 13 | ProjectSection(SolutionItems) = preProject 14 | .github\workflows\build.yaml = .github\workflows\build.yaml 15 | .editorconfig = .editorconfig 16 | README.md = README.md 17 | EndProjectSection 18 | EndProject 19 | Global 20 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 21 | Debug|Any CPU = Debug|Any CPU 22 | Debug|x86 = Debug|x86 23 | Release|Any CPU = Release|Any CPU 24 | Release|x86 = Release|x86 25 | EndGlobalSection 26 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 27 | {91609F6F-9CD8-406D-A10B-B35CBA88CD79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 28 | {91609F6F-9CD8-406D-A10B-B35CBA88CD79}.Debug|Any CPU.Build.0 = Debug|Any CPU 29 | {91609F6F-9CD8-406D-A10B-B35CBA88CD79}.Debug|x86.ActiveCfg = Debug|x86 30 | {91609F6F-9CD8-406D-A10B-B35CBA88CD79}.Debug|x86.Build.0 = Debug|x86 31 | {91609F6F-9CD8-406D-A10B-B35CBA88CD79}.Release|Any CPU.ActiveCfg = Release|Any CPU 32 | {91609F6F-9CD8-406D-A10B-B35CBA88CD79}.Release|Any CPU.Build.0 = Release|Any CPU 33 | {91609F6F-9CD8-406D-A10B-B35CBA88CD79}.Release|x86.ActiveCfg = Release|x86 34 | {91609F6F-9CD8-406D-A10B-B35CBA88CD79}.Release|x86.Build.0 = Release|x86 35 | {0CAB4EBB-AA58-4742-8ACF-0852AF458BD9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 36 | {0CAB4EBB-AA58-4742-8ACF-0852AF458BD9}.Debug|Any CPU.Build.0 = Debug|Any CPU 37 | {0CAB4EBB-AA58-4742-8ACF-0852AF458BD9}.Debug|x86.ActiveCfg = Debug|Any CPU 38 | {0CAB4EBB-AA58-4742-8ACF-0852AF458BD9}.Debug|x86.Build.0 = Debug|Any CPU 39 | {0CAB4EBB-AA58-4742-8ACF-0852AF458BD9}.Release|Any CPU.ActiveCfg = Release|Any CPU 40 | {0CAB4EBB-AA58-4742-8ACF-0852AF458BD9}.Release|Any CPU.Build.0 = Release|Any CPU 41 | {0CAB4EBB-AA58-4742-8ACF-0852AF458BD9}.Release|x86.ActiveCfg = Release|Any CPU 42 | {0CAB4EBB-AA58-4742-8ACF-0852AF458BD9}.Release|x86.Build.0 = Release|Any CPU 43 | {81A8CD1D-B110-45E9-9488-814FEFF0829D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 44 | {81A8CD1D-B110-45E9-9488-814FEFF0829D}.Debug|Any CPU.Build.0 = Debug|Any CPU 45 | {81A8CD1D-B110-45E9-9488-814FEFF0829D}.Debug|x86.ActiveCfg = Debug|Any CPU 46 | {81A8CD1D-B110-45E9-9488-814FEFF0829D}.Debug|x86.Build.0 = Debug|Any CPU 47 | {81A8CD1D-B110-45E9-9488-814FEFF0829D}.Release|Any CPU.ActiveCfg = Release|Any CPU 48 | {81A8CD1D-B110-45E9-9488-814FEFF0829D}.Release|Any CPU.Build.0 = Release|Any CPU 49 | {81A8CD1D-B110-45E9-9488-814FEFF0829D}.Release|x86.ActiveCfg = Release|Any CPU 50 | {81A8CD1D-B110-45E9-9488-814FEFF0829D}.Release|x86.Build.0 = Release|Any CPU 51 | EndGlobalSection 52 | GlobalSection(SolutionProperties) = preSolution 53 | HideSolutionNode = FALSE 54 | EndGlobalSection 55 | GlobalSection(ExtensibilityGlobals) = postSolution 56 | SolutionGuid = {86845323-ED4A-446C-A149-BD4E2AB898F7} 57 | EndGlobalSection 58 | EndGlobal 59 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [marketplace]: https://marketplace.visualstudio.com/items?itemName=MadsKristensen.MIDL 2 | [vsixgallery]: http://vsixgallery.com/extension/MIDL.148cb49f-0d60-482a-a9ca-800f2b6c579b/ 3 | [repo]:https://github.com/madskristensen/MIDL 4 | 5 | # WinRT Tools for C++ 6 | 7 | [![Build](https://github.com/madskristensen/MIDL/actions/workflows/build.yaml/badge.svg)](https://github.com/madskristensen/MIDL/actions/workflows/build.yaml) 8 | 9 | Download this extension from the [Visual Studio Marketplace][marketplace] 10 | or get the [CI build][vsixgallery]. 11 | 12 | -------------------------------------- 13 | 14 | Provides language support for IDL 3 and header generation based on WinMD transformations. 15 | 16 | ![Suggested Actions](art/suggested-actions.gif) 17 | 18 | ## Update header (.h) file 19 | Right-click any .idl file to invoke the *Update Header File...* command. 20 | 21 | ![Context Menu](art/context-menu.png) 22 | 23 | Doing that will result in the generation of a WinMD file followed by header file generation by using **cppwinrt**. All of this takes place in a temp folder, so no artifacts will be added to your project. 24 | 25 | Once the generation is done, a merge window pops up to let you merge the updates you need into your .h file. 26 | 27 | ![Merge](art/merge.png) 28 | 29 | Click **Accept Merge** in the upper-left corner moves the changes you selected into the .h file in your project. 30 | 31 | ## How can I help? 32 | If you enjoy using the extension, please give it a ★★★★★ rating on the [Visual Studio Marketplace][marketplace]. 33 | 34 | Should you encounter bugs or if you have feature requests, head on over to the [GitHub repo][repo] to open an issue if one doesn't already exist. 35 | 36 | Pull requests are also very welcome, since I can't always get around to fixing all bugs myself. This is a personal passion project, so my time is limited. 37 | 38 | Another way to help out is to [sponsor me on GitHub](https://github.com/sponsors/madskristensen). -------------------------------------------------------------------------------- /art/context-menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/MIDL/af4e1b6956dc3cd429474c96b7890eb753cca7f1/art/context-menu.png -------------------------------------------------------------------------------- /art/merge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/MIDL/af4e1b6956dc3cd429474c96b7890eb753cca7f1/art/merge.png -------------------------------------------------------------------------------- /art/suggested-actions.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/MIDL/af4e1b6956dc3cd429474c96b7890eb753cca7f1/art/suggested-actions.gif -------------------------------------------------------------------------------- /lib/Microsoft.VisualStudio.Merge.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/MIDL/af4e1b6956dc3cd429474c96b7890eb753cca7f1/lib/Microsoft.VisualStudio.Merge.dll -------------------------------------------------------------------------------- /src/MIDL/Commands/CopyEntityToClipboard.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Text.RegularExpressions; 7 | using System.Threading.Tasks; 8 | using System.Windows; 9 | using EnvDTE; 10 | using EnvDTE80; 11 | using Microsoft.VisualStudio.Text; 12 | using Microsoft.VisualStudio.Text.Editor; 13 | using MIDLParser; 14 | using static Community.VisualStudio.Toolkit.Windows; 15 | using OutputWindowPane = Community.VisualStudio.Toolkit.OutputWindowPane; 16 | 17 | namespace MIDL 18 | { 19 | [Command(PackageIds.CopyEntityToClipboard)] 20 | internal class CopyEntityToClipboard : BaseCommand 21 | { 22 | private static readonly Regex _rxIdentifier = new(@"(\w|\d)+"); 23 | 24 | protected override Task InitializeCompletedAsync() 25 | { 26 | Command.Supported = false; 27 | return base.InitializeCompletedAsync(); 28 | } 29 | 30 | protected override async Task ExecuteAsync(OleMenuCmdEventArgs e) 31 | { 32 | try 33 | { 34 | // Get active text 35 | await VS.StatusBar.ShowMessageAsync("Getting identifier..."); 36 | DocumentView? docView = await VS.Documents.GetActiveDocumentViewAsync(); 37 | if (docView == null) 38 | { 39 | throw new InvalidOperationException("Failed to get active document view"); 40 | } 41 | IWpfTextView textView = docView.TextView; 42 | ITextSelection selection = textView.Selection; 43 | int position = selection.Start.Position.Position; 44 | ITextSnapshotLine lineSnapshot = selection.Start.Position.GetContainingLine(); 45 | string line = lineSnapshot.GetText(); 46 | // TODO: Is there anyway to get the parsed items directly? The syntax highlighter 47 | // should have already ran a parsing pass. 48 | MIDLParser.Document parser = MIDLParser.Document.FromLines(line); 49 | parser.Parse(); 50 | // Get the identifier. 51 | // TODO: This is a crude approximation. Add identifier to the parser 52 | // Right now it would produce incorrect result for event where the generic parameter is seen as an identifier 53 | string id = line; 54 | foreach (ParseItem item in parser.Items) 55 | { 56 | id = id.Replace(item.Text, ""); 57 | } 58 | id = id.Trim(); 59 | Match idMatch = _rxIdentifier.Match(id); 60 | if (!idMatch.Success) 61 | { 62 | throw new InvalidOperationException("Failed to find identifier"); 63 | } 64 | id = idMatch.Value; 65 | // Generate header 66 | await VS.StatusBar.ShowMessageAsync("Generating file..."); 67 | PhysicalFile idlFile = await VS.Solutions.GetActiveItemAsync() as PhysicalFile; 68 | // TODO: Make it language agnostic 69 | ProcessResult result = await idlFile.TransformToHeaderAsync(); 70 | if (!result.Success) 71 | { 72 | throw new InvalidOperationException("Failed to generate header file"); 73 | } 74 | string[] headerFileLines = File.ReadAllLines(result.HeaderFile); 75 | List output = new(); 76 | foreach (string headerLine in headerFileLines) 77 | { 78 | // TODO: Make it language agnostic 79 | // TODO: Seem we need a C++ parser to accurately grab the relevant lines...? 80 | if (headerLine.Contains(id) && !headerLine.Contains("struct") && !headerLine.Contains("#") && !headerLine.Contains("namespace")) 81 | { 82 | output.Add(headerLine); 83 | } 84 | } 85 | Clipboard.SetText(string.Join(Environment.NewLine, output)); 86 | await VS.StatusBar.ShowMessageAsync("Copied"); 87 | } 88 | catch (Exception ex) 89 | { 90 | await VS.StatusBar.ShowMessageAsync("Failed to copy to clipboard. See output window for details"); 91 | await ex.LogAsync(); 92 | } 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/MIDL/Commands/SmartIndent.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.Composition; 2 | using System.Text.RegularExpressions; 3 | using Microsoft.VisualStudio.Commanding; 4 | using Microsoft.VisualStudio.Text; 5 | using Microsoft.VisualStudio.Text.Editor; 6 | using Microsoft.VisualStudio.Text.Editor.Commanding.Commands; 7 | using Microsoft.VisualStudio.Text.Editor.OptionsExtensionMethods; 8 | using Microsoft.VisualStudio.Utilities; 9 | 10 | namespace MIDL.Commands 11 | { 12 | [Export(typeof(ICommandHandler))] 13 | [Name(nameof(SmartIndent))] 14 | [ContentType(LanguageFactory.LanguageName)] 15 | [TextViewRole(PredefinedTextViewRoles.PrimaryDocument)] 16 | public class SmartIndent : ICommandHandler 17 | { 18 | private static readonly Regex _rxLead = new(@"^\s+", RegexOptions.Compiled); 19 | 20 | public string DisplayName => nameof(SmartIndent); 21 | 22 | public bool ExecuteCommand(ReturnKeyCommandArgs args, CommandExecutionContext executionContext) 23 | { 24 | ITextView view = args.TextView; 25 | int position = view.Caret.Position.BufferPosition.Position; 26 | 27 | bool shouldIndent = ShouldIndent(view, position); 28 | 29 | if (shouldIndent) 30 | { 31 | return Indent(view, position); 32 | } 33 | 34 | return false; 35 | } 36 | 37 | private static bool ShouldIndent(ITextView view, int position) 38 | { 39 | if (!view.Selection.IsEmpty || position == 0 || position == view.TextBuffer.CurrentSnapshot.Length) 40 | { 41 | return false; 42 | } 43 | 44 | string prevChar = view.TextBuffer.CurrentSnapshot.GetText(position - 1, 1); 45 | 46 | if (prevChar != "{") 47 | { 48 | return false; 49 | } 50 | 51 | string nextChar = view.TextBuffer.CurrentSnapshot.GetText(position, 1); 52 | 53 | if (nextChar != "}") 54 | { 55 | return false; 56 | } 57 | 58 | return true; 59 | } 60 | 61 | private static bool Indent(ITextView view, int position) 62 | { 63 | ITextSnapshotLine line = view.TextBuffer.CurrentSnapshot.GetLineFromPosition(position); 64 | Match leadingWhitespace = _rxLead.Match(line.GetText()); 65 | int indentation = view.Options.IsConvertTabsToSpacesEnabled() ? view.Options.GetIndentSize() : view.Options.GetTabSize(); 66 | string newLineChar = view.Options.GetNewLineCharacter(); 67 | 68 | if (leadingWhitespace.Success) 69 | { 70 | using (ITextEdit edit = view.TextBuffer.CreateEdit()) 71 | { 72 | string firstEdit = newLineChar + leadingWhitespace.Value; 73 | edit.Insert(position - 1, firstEdit); 74 | 75 | string secondEdit = newLineChar + leadingWhitespace.Value + "".PadLeft(indentation); 76 | edit.Insert(position, secondEdit); 77 | 78 | string thirdEdit = newLineChar + leadingWhitespace.Value; 79 | edit.Insert(position, thirdEdit); 80 | 81 | edit.Apply(); 82 | 83 | view.Caret.MoveTo(new SnapshotPoint(view.TextBuffer.CurrentSnapshot, position + firstEdit.Length + secondEdit.Length)); 84 | } 85 | 86 | return true; 87 | } 88 | 89 | return false; 90 | } 91 | 92 | public CommandState GetCommandState(ReturnKeyCommandArgs args) 93 | { 94 | return CommandState.Available; 95 | } 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /src/MIDL/Commands/UpdateHeaderFile.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using System.IO; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.VisualStudio.Merge.VsPackage; 6 | using Microsoft.VisualStudio.Shell.Interop; 7 | using static Community.VisualStudio.Toolkit.Windows; 8 | 9 | namespace MIDL 10 | { 11 | [Command(PackageIds.MyCommand)] 12 | internal sealed class UpdateHeaderFile : BaseCommand 13 | { 14 | protected override Task InitializeCompletedAsync() 15 | { 16 | Command.Supported = false; 17 | return base.InitializeCompletedAsync(); 18 | } 19 | 20 | protected override async Task ExecuteAsync(OleMenuCmdEventArgs e) 21 | { 22 | if (VsShellUtilities.IsSolutionBuilding(Package)) 23 | { 24 | await VS.MessageBox.ShowAsync("Header files can't be updated while a build is in progress"); 25 | return; 26 | } 27 | 28 | await VS.StatusBar.ShowProgressAsync("Generating header file...", 1, 3); 29 | 30 | try 31 | { 32 | PhysicalFile idlFile = await VS.Solutions.GetActiveItemAsync() as PhysicalFile; 33 | ProcessResult result = await idlFile.TransformToHeaderAsync(); 34 | 35 | if (!result.Success) 36 | { 37 | await VS.StatusBar.ShowProgressAsync("", 2, 2); 38 | await VS.StatusBar.ShowMessageAsync("Error generating header file. Make sure the project builds"); 39 | 40 | if (!string.IsNullOrEmpty(result.Output)) 41 | { 42 | OutputWindowPane output = await VS.Windows.GetOutputWindowPaneAsync(VSOutputWindowPane.General); 43 | await output.WriteLineAsync(result.Output); 44 | await output.ActivateAsync(); 45 | } 46 | 47 | return; 48 | } 49 | 50 | string headerFile = Path.ChangeExtension(idlFile.FullPath, ".h"); 51 | 52 | // First time header is generated 53 | if (!File.Exists(headerFile)) 54 | { 55 | await CreateHeaderFileAsync(headerFile, result.HeaderFile); 56 | await VS.Documents.OpenViaProjectAsync(headerFile); 57 | await VS.StatusBar.ShowProgressAsync("Header file created from IDL", 2, 2); 58 | } 59 | 60 | // Subsequent generations 61 | else 62 | { 63 | await VS.StatusBar.ShowProgressAsync("Preparing header file merge...", 2, 3); 64 | 65 | string ideDir = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName); 66 | string teamDir = Path.Combine(ideDir, "CommonExtensions\\Microsoft\\TeamFoundation\\Team Explorer"); 67 | 68 | await MergeHeaderFilesAsync(headerFile, result.HeaderFile); 69 | } 70 | 71 | await Task.Delay(2000); 72 | await VS.StatusBar.ShowProgressAsync("Ready", 1, 1); 73 | await VS.StatusBar.ClearAsync(); 74 | } 75 | catch (Exception ex) 76 | { 77 | await VS.StatusBar.ShowMessageAsync("Error generating header file. See output window for details"); 78 | await ex.LogAsync(); 79 | } 80 | } 81 | 82 | private async Task CreateHeaderFileAsync(string fileName, string generatedFile) 83 | { 84 | File.Copy(generatedFile, fileName, false); 85 | Project project = await VS.Solutions.GetActiveProjectAsync(); 86 | await project.AddExistingFilesAsync(fileName); 87 | 88 | } 89 | 90 | private static async Task MergeHeaderFilesAsync(string projectFile, string generatedFile) 91 | { 92 | string projectFileName = Path.GetFileName(projectFile); 93 | string baseFile = Path.Combine(Path.GetTempPath(), projectFileName); 94 | if (File.Exists(baseFile)) 95 | { 96 | File.Delete(baseFile); 97 | } 98 | StripDiff(baseFile, projectFile, generatedFile); 99 | string resultFile = Path.Combine(Path.GetTempPath(), 100 | $"{Path.GetFileNameWithoutExtension(projectFile)}_result.{Path.GetExtension(projectFile)}"); 101 | File.Copy(projectFile, resultFile, true); 102 | 103 | IModernMergeService mergeService = await GetMergeServiceAsync(); 104 | 105 | mergeService.OpenAndRegisterMergeWindow(fileName: "IDL Merge", 106 | leftFilePath: projectFile, 107 | rightFilePath: generatedFile, 108 | baseFilePath: baseFile, 109 | resultFilePath: resultFile, 110 | leftFileTag: "Local", 111 | rightFileTag: "Generated", 112 | baseFileTag: "Base file", 113 | resultFileTag: "Result", 114 | leftFileTitle: projectFileName, 115 | rightFileTitle: "from IDL", 116 | baseFileTitle: "Base", 117 | resultFileTitle: projectFileName, 118 | callbackParam: null, 119 | onMergeComplete: (r) => 120 | { 121 | if (r.MergeAccepted) 122 | { 123 | File.Copy(resultFile, projectFile, true); 124 | } 125 | }); 126 | } 127 | 128 | private static async Task GetMergeServiceAsync() 129 | { 130 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); 131 | 132 | IVsShell shell = await VS.Services.GetShellAsync(); 133 | Guid mergePackageId = new("BF0F8831-2CA2-4057-B64E-FF1CED3CEFA2"); 134 | shell.LoadPackage(ref mergePackageId, out _); 135 | IModernMergeService mergeService = await VS.GetServiceAsync(); 136 | 137 | return mergeService; 138 | } 139 | 140 | private static void StripDiff(string resultFileName, string file1, string file2) 141 | { 142 | string[] lines1 = File.ReadAllLines(file1); 143 | string[] lines2 = File.ReadAllLines(file2); 144 | 145 | File.WriteAllLines(resultFileName, lines2.Intersect(lines1)); 146 | } 147 | } 148 | } -------------------------------------------------------------------------------- /src/MIDL/Editor/EditorFeatures.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ComponentModel.Composition; 3 | using Microsoft.VisualStudio.Language.Intellisense; 4 | using Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion; 5 | using Microsoft.VisualStudio.Language.StandardClassification; 6 | using Microsoft.VisualStudio.Text.BraceCompletion; 7 | using Microsoft.VisualStudio.Text.Editor; 8 | using Microsoft.VisualStudio.Text.Tagging; 9 | using Microsoft.VisualStudio.Utilities; 10 | using MIDLParser; 11 | 12 | namespace MIDL 13 | { 14 | [Export(typeof(ITaggerProvider))] 15 | [TagType(typeof(IClassificationTag))] 16 | [ContentType(LanguageFactory.LanguageName)] 17 | public class SyntaxHighligting : TokenClassificationTaggerBase 18 | { 19 | public override Dictionary ClassificationMap { get; } = new() 20 | { 21 | { ItemType.Comment, PredefinedClassificationTypeNames.Comment }, 22 | { ItemType.Keyword, PredefinedClassificationTypeNames.Keyword }, 23 | { ItemType.String, PredefinedClassificationTypeNames.String }, 24 | { ItemType.Type, PredefinedClassificationTypeNames.SymbolDefinition }, 25 | }; 26 | } 27 | 28 | [Export(typeof(ITaggerProvider))] 29 | [TagType(typeof(IStructureTag))] 30 | [ContentType(LanguageFactory.LanguageName)] 31 | public class Outlining : TokenOutliningTaggerBase 32 | { } 33 | 34 | [Export(typeof(ITaggerProvider))] 35 | [TagType(typeof(IErrorTag))] 36 | [ContentType(LanguageFactory.LanguageName)] 37 | public class ErrorSquigglies : TokenErrorTaggerBase 38 | { } 39 | 40 | [Export(typeof(IAsyncQuickInfoSourceProvider))] 41 | [ContentType(LanguageFactory.LanguageName)] 42 | internal sealed class Tooltips : TokenQuickInfoBase 43 | { } 44 | 45 | [Export(typeof(IBraceCompletionContextProvider))] 46 | [BracePair('(', ')')] 47 | [BracePair('[', ']')] 48 | [BracePair('{', '}')] 49 | [BracePair('"', '"')] 50 | [BracePair('$', '$')] 51 | [ContentType(LanguageFactory.LanguageName)] 52 | [ProvideBraceCompletion(LanguageFactory.LanguageName)] 53 | internal sealed class BraceCompletion : BraceCompletionBase 54 | { } 55 | 56 | [Export(typeof(IAsyncCompletionCommitManagerProvider))] 57 | [ContentType(LanguageFactory.LanguageName)] 58 | internal sealed class CompletionCommitManager : CompletionCommitManagerBase 59 | { 60 | public override IEnumerable CommitChars => new char[] { ' ', '\'', '"', ',', '.', ';', ':', '\\', '$' }; 61 | } 62 | 63 | [Export(typeof(IViewTaggerProvider))] 64 | [TagType(typeof(TextMarkerTag))] 65 | [ContentType(LanguageFactory.LanguageName)] 66 | internal sealed class BraceMatchingTaggerProvider : BraceMatchingBase 67 | { 68 | // This will match parenthesis, curly brackets, and square brackets by default. 69 | // Override the BraceList property to modify the list of braces to match. 70 | } 71 | 72 | [Export(typeof(IViewTaggerProvider))] 73 | [ContentType(LanguageFactory.LanguageName)] 74 | [TagType(typeof(TextMarkerTag))] 75 | public class SameWordHighlighter : SameWordHighlighterBase 76 | { } 77 | 78 | [Export(typeof(IWpfTextViewCreationListener))] 79 | [ContentType(LanguageFactory.LanguageName)] 80 | [TextViewRole(PredefinedTextViewRoles.PrimaryDocument)] 81 | public class UserRating : WpfTextViewCreationListener 82 | { 83 | private readonly RatingPrompt _rating = new("MadsKristensen.MIDL", Vsix.Name, General.Instance); 84 | private readonly DateTime _openedDate = DateTime.Now; 85 | 86 | protected override void Closed(IWpfTextView textView) 87 | { 88 | if (_openedDate.AddMinutes(1) < DateTime.Now) 89 | { 90 | // Only register use after the document was open for more than 2 minutes. 91 | _rating.RegisterSuccessfulUsage(); 92 | 93 | } 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/MIDL/Editor/LanguageFactory.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.Design; 2 | using System.Runtime.InteropServices; 3 | using Microsoft.VisualStudio.Package; 4 | using Microsoft.VisualStudio.TextManager.Interop; 5 | 6 | namespace MIDL 7 | { 8 | [ComVisible(true)] 9 | [Guid(PackageGuids.MidlEditorFactoryString)] 10 | public class LanguageFactory : LanguageBase 11 | { 12 | public const string LanguageName = "IDL"; 13 | public const string FileExtension = ".idl"; 14 | 15 | public LanguageFactory(object site) : base(site) 16 | { } 17 | 18 | public void RegisterLanguageService(Package package) 19 | { 20 | ((IServiceContainer)package).AddService(GetType(), this, true); 21 | } 22 | 23 | public override string Name => LanguageName; 24 | 25 | public override string[] FileExtensions => new[] { FileExtension }; 26 | 27 | public override void SetDefaultPreferences(LanguagePreferences preferences) 28 | { 29 | preferences.EnableCodeSense = false; 30 | preferences.EnableMatchBraces = true; 31 | preferences.EnableMatchBracesAtCaret = true; 32 | preferences.EnableShowMatchingBrace = true; 33 | preferences.EnableCommenting = true; 34 | preferences.HighlightMatchingBraceFlags = _HighlightMatchingBraceFlags.HMB_USERECTANGLEBRACES; 35 | preferences.LineNumbers = true; 36 | preferences.MaxErrorMessages = 100; 37 | preferences.AutoOutlining = true; 38 | preferences.MaxRegionTime = 2000; 39 | preferences.InsertTabs = false; 40 | preferences.IndentSize = 4; 41 | preferences.IndentStyle = IndentingStyle.Smart; 42 | preferences.ShowNavigationBar = false; 43 | 44 | preferences.WordWrap = false; 45 | preferences.WordWrapGlyphs = true; 46 | 47 | preferences.AutoListMembers = true; 48 | preferences.EnableQuickInfo = true; 49 | preferences.ParameterInformation = true; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/MIDL/Editor/TokenTagger.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ComponentModel.Composition; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.VisualStudio.Core.Imaging; 6 | using Microsoft.VisualStudio.Imaging; 7 | using Microsoft.VisualStudio.Shell.Interop; 8 | using Microsoft.VisualStudio.Text; 9 | using Microsoft.VisualStudio.Text.Adornments; 10 | using Microsoft.VisualStudio.Text.Tagging; 11 | using Microsoft.VisualStudio.Utilities; 12 | using MIDLParser; 13 | 14 | namespace MIDL 15 | { 16 | [Export(typeof(ITaggerProvider))] 17 | [TagType(typeof(TokenTag))] 18 | [ContentType(LanguageFactory.LanguageName)] 19 | [Name(LanguageFactory.LanguageName)] 20 | internal sealed class TokenTaggerProvider : ITaggerProvider 21 | { 22 | public ITagger CreateTagger(ITextBuffer buffer) where T : ITag => 23 | buffer.Properties.GetOrCreateSingletonProperty(() => new TokenTagger(buffer)) as ITagger; 24 | } 25 | 26 | internal class TokenTagger : TokenTaggerBase, IDisposable 27 | { 28 | private readonly IdlDocument _document; 29 | private static readonly ImageId _errorIcon = KnownMonikers.StatusWarning.ToImageId(); 30 | private bool _isDisposed; 31 | 32 | internal TokenTagger(ITextBuffer buffer) : base(buffer) 33 | { 34 | _document = buffer.GetDocument(); 35 | _document.Parsed += OnDocumentParsed; 36 | } 37 | 38 | private void OnDocumentParsed(object sender = null, EventArgs e = null) 39 | { 40 | _ = TokenizeAsync(); 41 | } 42 | 43 | public override Task TokenizeAsync() 44 | { 45 | // Make sure this is running on a background thread. 46 | ThreadHelper.ThrowIfOnUIThread(); 47 | 48 | List> list = new(); 49 | 50 | foreach (ParseItem item in _document.Items) 51 | { 52 | if (_document.IsParsing) 53 | { 54 | // Abort and wait for the next parse event to finish 55 | return Task.CompletedTask; 56 | } 57 | 58 | AddTagToList(list, item); 59 | } 60 | 61 | OnTagsUpdated(list); 62 | return Task.CompletedTask; 63 | } 64 | 65 | private void AddTagToList(List> list, ParseItem item) 66 | { 67 | //var supportsOutlining = item is Request request && (request.Headers.Any() || request.Body != null); 68 | bool hasTooltip = !item.IsValid; 69 | IEnumerable errors = CreateErrorListItem(item); 70 | TokenTag tag = CreateToken(item.Type, hasTooltip, false, errors); 71 | 72 | SnapshotSpan span = new(Buffer.CurrentSnapshot, item.ToSpan()); 73 | list.Add(new TagSpan(span, tag)); 74 | } 75 | 76 | private IEnumerable CreateErrorListItem(ParseItem item) 77 | { 78 | ITextSnapshotLine line = Buffer.CurrentSnapshot.GetLineFromPosition(item.Start); 79 | 80 | foreach (Error error in item.Errors) 81 | { 82 | yield return new ErrorListItem 83 | { 84 | ProjectName = _document.ProjectName ?? "", 85 | FileName = _document.FileName, 86 | Message = error.Message, 87 | ErrorCategory = ConvertToVsCat(error.Severity), 88 | Severity = ConvertToVsSeverity(error.Severity), 89 | Line = line.LineNumber, 90 | Column = item.Start - line.Start.Position, 91 | BuildTool = Vsix.Name, 92 | ErrorCode = error.ErrorCode 93 | }; 94 | } 95 | } 96 | 97 | private static string ConvertToVsCat(ErrorCategory cat) 98 | { 99 | return cat switch 100 | { 101 | ErrorCategory.Message => PredefinedErrorTypeNames.Suggestion, 102 | ErrorCategory.Warning => PredefinedErrorTypeNames.Warning, 103 | _ => PredefinedErrorTypeNames.SyntaxError, 104 | }; 105 | } 106 | 107 | private static __VSERRORCATEGORY ConvertToVsSeverity(ErrorCategory cat) 108 | { 109 | return cat switch 110 | { 111 | ErrorCategory.Message => __VSERRORCATEGORY.EC_MESSAGE, 112 | ErrorCategory.Warning => __VSERRORCATEGORY.EC_WARNING, 113 | _ => __VSERRORCATEGORY.EC_ERROR, 114 | }; 115 | } 116 | 117 | public override Task GetTooltipAsync(SnapshotPoint triggerPoint) 118 | { 119 | ParseItem item = _document.FindItemFromPosition(triggerPoint.Position); 120 | 121 | // Error messages 122 | if (item?.IsValid == false) 123 | { 124 | ContainerElement elm = new( 125 | ContainerElementStyle.Wrapped, 126 | new ImageElement(_errorIcon), 127 | string.Join(Environment.NewLine, item.Errors.Select(e => e.Message))); 128 | 129 | return Task.FromResult(elm); 130 | } 131 | 132 | return Task.FromResult(null); 133 | } 134 | 135 | public void Dispose() 136 | { 137 | if (!_isDisposed) 138 | { 139 | _document.Parsed -= OnDocumentParsed; 140 | } 141 | 142 | _isDisposed = true; 143 | } 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /src/MIDL/ExtensionMethods.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.Text; 2 | using MIDLParser; 3 | 4 | namespace MIDL 5 | { 6 | public static class ExtensionMethods 7 | { 8 | public static Span ToSpan(this ParseItem token) => new(token.Start, token.Length); 9 | 10 | public static IdlDocument GetDocument(this ITextBuffer buffer) => 11 | buffer.Properties.GetOrCreateSingletonProperty(() => new IdlDocument(buffer)); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/MIDL/IdlDocument.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Threading.Tasks; 3 | using Microsoft.VisualStudio.Text; 4 | using Microsoft.VisualStudio.Threading; 5 | using MIDLParser; 6 | 7 | namespace MIDL 8 | { 9 | public class IdlDocument : Document, IDisposable 10 | { 11 | private readonly ITextBuffer _buffer; 12 | private bool _isDisposed; 13 | 14 | public string FileName { get; } 15 | public string ProjectName { get; private set; } 16 | 17 | public IdlDocument(ITextBuffer buffer) 18 | : base(buffer.CurrentSnapshot.Lines.Select(line => line.GetTextIncludingLineBreak()).ToArray()) 19 | { 20 | _buffer = buffer; 21 | _buffer.Changed += BufferChanged; 22 | FileName = buffer.GetFileName(); 23 | 24 | General.Saved += OnSettingsSaved; 25 | 26 | ThreadHelper.JoinableTaskFactory.RunAsync(async () => 27 | { 28 | await Task.Yield(); 29 | Project project = await VS.Solutions.GetActiveProjectAsync(); 30 | ProjectName = project?.Name; 31 | }).FireAndForget(); 32 | } 33 | 34 | private void BufferChanged(object sender, TextContentChangedEventArgs e) 35 | { 36 | UpdateLines(_buffer.CurrentSnapshot.Lines.Select(line => line.GetTextIncludingLineBreak()).ToArray()); 37 | ParseAsync().FireAndForget(); 38 | } 39 | 40 | private async Task ParseAsync() 41 | { 42 | await TaskScheduler.Default; 43 | Parse(); 44 | } 45 | 46 | private void OnSettingsSaved(General obj) 47 | { 48 | ParseAsync().FireAndForget(); 49 | } 50 | 51 | public void Dispose() 52 | { 53 | if (!_isDisposed) 54 | { 55 | _buffer.Changed -= BufferChanged; 56 | General.Saved -= OnSettingsSaved; 57 | } 58 | 59 | _isDisposed = true; 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/MIDL/IdlTransformer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Diagnostics; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Reflection; 6 | using System.Text.RegularExpressions; 7 | using System.Threading.Tasks; 8 | using Microsoft.Build.Evaluation; 9 | using Microsoft.Build.Execution; 10 | using Microsoft.Build.Framework; 11 | using Microsoft.Build.Logging; 12 | using Project = Community.VisualStudio.Toolkit.Project; 13 | 14 | namespace MIDL 15 | { 16 | public static class IdlTransformer 17 | { 18 | private const string _buildFileName = "_IDL_TRANSFORMER.vcxproj"; 19 | 20 | private const string _target = "SpecialVSIXMidl"; 21 | 22 | public static async Task TransformToHeaderAsync(this PhysicalFile idlFile) 23 | { 24 | string projectDir = Path.GetDirectoryName(idlFile.ContainingProject.FullPath); 25 | string buildFile = Path.Combine(projectDir, _buildFileName); 26 | 27 | try 28 | { 29 | CopyBuildFileToProjectFolder(buildFile); 30 | return await ExecuteBuildAsync(idlFile.ContainingProject, idlFile.FullPath); 31 | } 32 | finally 33 | { 34 | if (File.Exists(buildFile)) 35 | { 36 | File.Delete(buildFile); 37 | } 38 | } 39 | } 40 | 41 | private static async Task ExecuteBuildAsync(Project project, string idlFileName) 42 | { 43 | string outputBasePath = Path.Combine(Path.GetTempPath(), $"VSIXIDL\\{project.Name}\\VSIX_Metadata_Folder"); 44 | string outputPath = Path.Combine(outputBasePath, "Generated Files\\sources"); 45 | string headerFileName = Path.ChangeExtension(Path.GetFileName(idlFileName), ".h"); 46 | string headerFile = Path.Combine(outputPath, headerFileName); 47 | 48 | try 49 | { 50 | if (Directory.Exists(outputPath)) 51 | { 52 | Directory.Delete(outputPath, true); 53 | } 54 | 55 | 56 | string projectName = Path.GetFileName(project.FullPath); 57 | string projectDir = Path.GetDirectoryName(project.FullPath); 58 | string relativeIdlFileName = PackageUtilities.MakeRelative(projectDir, idlFileName); 59 | 60 | Version version = await VS.Shell.GetVsVersionAsync(); 61 | DirectoryInfo installDir = new FileInfo(Process.GetCurrentProcess().MainModule.FileName).Directory.Parent.Parent; 62 | Environment.SetEnvironmentVariable("VSINSTALLDIR", installDir.FullName); 63 | Environment.SetEnvironmentVariable("VisualStudioVersion", $"{version.Major}.0"); 64 | 65 | BuildManager manager = BuildManager.DefaultBuildManager; 66 | Dictionary globalProperty = new() 67 | { 68 | { "ProjectPath", projectName }, 69 | { "IDLFile", relativeIdlFileName }, 70 | { "Configuration", "Debug" }, 71 | { "Platform", "x64" }, 72 | }; 73 | 74 | ProjectCollection projectCollection = new(globalProperty, null, ToolsetDefinitionLocations.Registry | ToolsetDefinitionLocations.ConfigurationFile); 75 | string buildLogPath = Path.Combine(outputBasePath, "msbuild.log"); 76 | BuildParameters buildParamters = new(projectCollection) 77 | { 78 | Loggers = new List { new FileLogger() 79 | { 80 | Parameters = $"LOGFILE={buildLogPath}", 81 | } 82 | }, 83 | }; 84 | 85 | string buildProjectPath = Path.Combine(projectDir, _buildFileName); 86 | BuildRequestData buildRequest = new(buildProjectPath, globalProperty, null, new string[] { _target }, null); 87 | 88 | BuildResult result = manager.Build(buildParamters, buildRequest); 89 | 90 | if (result.OverallResult == BuildResultCode.Failure) 91 | { 92 | result.ResultsByTarget.TryGetValue(_target, out TargetResult? targetResult); 93 | return new ProcessResult(false, headerFile, $"Build failed. Generated header file not found.\n" + 94 | $"OverallResult={result.OverallResult} Exception={result.Exception?.ToString()}\n" + 95 | $"TargetResult.Result={targetResult?.ResultCode} TargetException={targetResult?.Exception}\n" + 96 | $"If no useful exception is returned, please inspect the build log at {buildLogPath}"); 97 | } 98 | 99 | RemoveNoise(project, headerFile); 100 | 101 | return new ProcessResult(true, headerFile, null); 102 | } 103 | catch (Exception ex) 104 | { 105 | return new ProcessResult(false, headerFile, $"Failed to execute build: {ex}"); 106 | } 107 | } 108 | 109 | private static void RemoveNoise(Project project, string headerFile) 110 | { 111 | string file = File.ReadAllText(headerFile); 112 | 113 | // Use regex to keep line endings intact for the merge view to work correctly 114 | string clean = Regex.Replace(file, "^(//.+|static_assert.+)\\s*", "", RegexOptions.Multiline | RegexOptions.Compiled); 115 | 116 | File.WriteAllText(headerFile, clean); 117 | } 118 | 119 | private static void CopyBuildFileToProjectFolder(string destinationFileName) 120 | { 121 | string root = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); 122 | string buildFile = Path.Combine(root, "resources", "microProj.vcxproj"); 123 | File.Copy(buildFile, destinationFileName, true); 124 | } 125 | 126 | } 127 | 128 | public record ProcessResult(bool Success, string HeaderFile, string Output); 129 | } 130 | -------------------------------------------------------------------------------- /src/MIDL/MIDL.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 5 | latest 6 | 7 | 8 | 9 | Debug 10 | AnyCPU 11 | 2.0 12 | {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 13 | {91609F6F-9CD8-406D-A10B-B35CBA88CD79} 14 | Library 15 | Properties 16 | MIDL 17 | MIDL 18 | v4.8 19 | true 20 | true 21 | true 22 | true 23 | false 24 | true 25 | true 26 | Program 27 | $(DevEnvDir)devenv.exe 28 | /rootsuffix Exp 29 | 30 | 31 | true 32 | full 33 | false 34 | bin\Debug\ 35 | DEBUG;TRACE 36 | prompt 37 | 4 38 | 39 | 40 | pdbonly 41 | true 42 | bin\Release\ 43 | TRACE 44 | prompt 45 | 4 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | True 62 | True 63 | source.extension.vsixmanifest 64 | 65 | 66 | 67 | 68 | 69 | True 70 | True 71 | VSCommandTable.vsct 72 | 73 | 74 | 75 | 76 | Resources\LICENSE 77 | true 78 | 79 | 80 | true 81 | 82 | 83 | Designer 84 | VsixManifestGenerator 85 | source.extension.cs 86 | 87 | 88 | true 89 | 90 | 91 | 92 | 93 | Menus.ctmenu 94 | VsctGenerator 95 | VSCommandTable.cs 96 | 97 | 98 | 99 | 100 | ..\..\lib\Microsoft.VisualStudio.Merge.dll 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | {0cab4ebb-aa58-4742-8acf-0852af458bd9} 116 | MIDLParser 117 | 118 | 119 | 120 | 121 | 128 | -------------------------------------------------------------------------------- /src/MIDL/MIDLPackage.cs: -------------------------------------------------------------------------------- 1 | global using System; 2 | global using Community.VisualStudio.Toolkit; 3 | global using Microsoft.VisualStudio.Shell; 4 | global using Task = System.Threading.Tasks.Task; 5 | using System.ComponentModel.Design; 6 | using System.Runtime.InteropServices; 7 | using System.Threading; 8 | using EnvDTE; 9 | using EnvDTE80; 10 | using Microsoft; 11 | using Microsoft.VisualStudio; 12 | using Microsoft.VisualStudio.Shell.Interop; 13 | using MIDL.Commands; 14 | 15 | namespace MIDL 16 | { 17 | [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)] 18 | [InstalledProductRegistration(Vsix.Name, Vsix.Description, Vsix.Version)] 19 | [ProvideMenuResource("Menus.ctmenu", 1)] 20 | [Guid(PackageGuids.MIDLString)] 21 | 22 | [ProvideLanguageService(typeof(LanguageFactory), LanguageFactory.LanguageName, 0, ShowSmartIndent = true, DefaultToInsertSpaces = true)] 23 | [ProvideLanguageExtension(typeof(LanguageFactory), LanguageFactory.FileExtension)] 24 | [ProvideLanguageEditorOptionPage(typeof(OptionsProvider.GeneralOptions), LanguageFactory.LanguageName, null, "Advanced", null, new[] { "idl", "midl", "webidl" })] 25 | 26 | [ProvideEditorFactory(typeof(LanguageFactory), 341, CommonPhysicalViewAttributes = (int)__VSPHYSICALVIEWATTRIBUTES.PVA_SupportsPreview, TrustLevel = __VSEDITORTRUSTLEVEL.ETL_AlwaysTrusted)] 27 | [ProvideEditorExtension(typeof(LanguageFactory), LanguageFactory.FileExtension, 65535, NameResourceID = 341)] 28 | [ProvideEditorLogicalView(typeof(LanguageFactory), VSConstants.LOGVIEWID.TextView_string, IsTrusted = true)] 29 | 30 | [ProvideFileIcon(LanguageFactory.FileExtension, "KnownMonikers.InterfaceFile")] 31 | 32 | [ProvideAutoLoad(PackageGuids.IdlFileSelectedString, PackageAutoLoadFlags.BackgroundLoad)] 33 | [ProvideUIContextRule(PackageGuids.IdlFileSelectedString, 34 | name: "IDL file selected", 35 | expression: "idl & building", 36 | termNames: new[] { "idl", "building" }, 37 | termValues: new[] { "HierSingleSelectionName:.idl$", VSConstants.UICONTEXT.NotBuildingAndNotDebugging_string })] 38 | public sealed class MIDLPackage : ToolkitPackage 39 | { 40 | protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress progress) 41 | { 42 | await JoinableTaskFactory.SwitchToMainThreadAsync(); 43 | 44 | LanguageFactory language = new(this); 45 | RegisterEditorFactory(language); 46 | language.RegisterLanguageService(this); 47 | 48 | await this.RegisterCommandsAsync(); 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /src/MIDL/Options/General.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace MIDL 5 | { 6 | internal partial class OptionsProvider 7 | { 8 | [ComVisible(true)] 9 | public class GeneralOptions : BaseOptionPage { } 10 | } 11 | 12 | public class General : BaseOptionModel, IRatingConfig 13 | { 14 | [Category("My category")] 15 | [DisplayName("My Option")] 16 | [Description("An informative description.")] 17 | [DefaultValue(true)] 18 | public bool MyOption { get; set; } = true; 19 | 20 | [Browsable(false)] 21 | public int RatingRequests { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/MIDL/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using MIDL; 2 | 3 | using System.Reflection; 4 | using System.Runtime.InteropServices; 5 | 6 | [assembly: AssemblyTitle(Vsix.Name)] 7 | [assembly: AssemblyDescription(Vsix.Description)] 8 | [assembly: AssemblyConfiguration("")] 9 | [assembly: AssemblyCompany(Vsix.Author)] 10 | [assembly: AssemblyProduct(Vsix.Name)] 11 | [assembly: AssemblyCopyright(Vsix.Author)] 12 | [assembly: AssemblyTrademark("")] 13 | [assembly: AssemblyCulture("")] 14 | 15 | [assembly: ComVisible(false)] 16 | 17 | [assembly: AssemblyVersion(Vsix.Version)] 18 | [assembly: AssemblyFileVersion(Vsix.Version)] 19 | 20 | namespace System.Runtime.CompilerServices 21 | { 22 | public class IsExternalInit { } 23 | } -------------------------------------------------------------------------------- /src/MIDL/Resources/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/MIDL/af4e1b6956dc3cd429474c96b7890eb753cca7f1/src/MIDL/Resources/Icon.png -------------------------------------------------------------------------------- /src/MIDL/Resources/microProj.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | $(TEMP)\VSIXIDL\$(ProjectName)\VSIX_Metadata_Folder\ 13 | $(OutDir) 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | false 34 | $(ExcludePath) 35 | 36 | 37 | 38 | 39 | $(WindowsSDKToolArchitecture) 40 | true 41 | $(CL_MPCount) 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 77 | 78 | 79 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | $([System.IO.Path]::GetFileNameWithoutExtension('%(Identity)')).winmd 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | -------------------------------------------------------------------------------- /src/MIDL/SuggestedActions/FixTypeAction.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Microsoft.VisualStudio.Imaging; 5 | using Microsoft.VisualStudio.Imaging.Interop; 6 | using Microsoft.VisualStudio.Language.Intellisense; 7 | using Microsoft.VisualStudio.Text; 8 | 9 | namespace MIDL 10 | { 11 | public class FixTypeAction : ISuggestedAction 12 | { 13 | private readonly SnapshotSpan _span; 14 | private readonly string _oldType; 15 | private readonly string _newType; 16 | 17 | public FixTypeAction(SnapshotSpan span, string oldType, string newType) 18 | { 19 | _span = span; 20 | _oldType = oldType; 21 | _newType = newType; 22 | } 23 | public bool HasActionSets => false; 24 | public string DisplayText => $"Replace {_oldType} with {_newType}"; 25 | public ImageMoniker IconMoniker => KnownMonikers.QuickReplace; 26 | public string IconAutomationText => $"Replace {_oldType} with {_newType}"; 27 | public string InputGestureText => ""; 28 | public bool HasPreview => false; 29 | public void Dispose() 30 | { } 31 | 32 | public Task> GetActionSetsAsync(CancellationToken cancellationToken) 33 | { 34 | IEnumerable list = new SuggestedActionSet[0]; 35 | return Task.FromResult(list); 36 | } 37 | 38 | public Task GetPreviewAsync(CancellationToken cancellationToken) 39 | { 40 | return Task.FromResult(null); 41 | } 42 | 43 | public void Invoke(CancellationToken cancellationToken) 44 | { 45 | if (!cancellationToken.IsCancellationRequested) 46 | { 47 | _span.Snapshot.TextBuffer.Replace(_span, _newType); 48 | } 49 | } 50 | 51 | public bool TryGetTelemetryId(out Guid telemetryId) 52 | { 53 | telemetryId = Guid.Empty; 54 | return false; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/MIDL/SuggestedActions/SuggestedActionsProvider.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.Composition; 2 | using Microsoft.VisualStudio.Language.Intellisense; 3 | using Microsoft.VisualStudio.Text; 4 | using Microsoft.VisualStudio.Text.Classification; 5 | using Microsoft.VisualStudio.Text.Editor; 6 | using Microsoft.VisualStudio.Utilities; 7 | 8 | namespace MIDL 9 | { 10 | [Export(typeof(ISuggestedActionsSourceProvider))] 11 | [Name(nameof(SuggestedActionsProvider))] 12 | [ContentType("text")] 13 | public class SuggestedActionsProvider : ISuggestedActionsSourceProvider 14 | { 15 | [Import] 16 | private readonly IClassifierAggregatorService _service = null; 17 | 18 | public ISuggestedActionsSource CreateSuggestedActionsSource(ITextView textView, ITextBuffer textBuffer) 19 | { 20 | IClassifier aggregator = _service.GetClassifier(textBuffer); 21 | return textView.Properties.GetOrCreateSingletonProperty(() => new SuggestedActionsSource(aggregator)); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/MIDL/SuggestedActions/SuggestedActionsSource.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Threading; 4 | using System.Threading.Tasks; 5 | using Microsoft.VisualStudio.Language.Intellisense; 6 | using Microsoft.VisualStudio.Language.StandardClassification; 7 | using Microsoft.VisualStudio.Text; 8 | using Microsoft.VisualStudio.Text.Classification; 9 | using MIDLParser; 10 | 11 | namespace MIDL 12 | { 13 | public class SuggestedActionsSource : ISuggestedActionsSource 14 | { 15 | private readonly IClassifier _aggregator; 16 | 17 | public SuggestedActionsSource(IClassifier aggregator) 18 | { 19 | _aggregator = aggregator; 20 | } 21 | 22 | public event EventHandler SuggestedActionsChanged 23 | { 24 | add { } 25 | remove { } 26 | } 27 | 28 | public void Dispose() 29 | { 30 | // Nothing to dispose 31 | } 32 | 33 | public IEnumerable GetSuggestedActions(ISuggestedActionCategorySet requestedActionCategories, SnapshotSpan range, CancellationToken cancellationToken) 34 | { 35 | IList spans = _aggregator.GetClassificationSpans(range); 36 | List actionSets = new(); 37 | 38 | foreach (ClassificationSpan span in spans.Where(s => s.ClassificationType.IsOfType(PredefinedClassificationTypeNames.SymbolDefinition))) 39 | { 40 | string text = span.Span.GetText(); 41 | 42 | if (Document._convertTypes.ContainsKey(text)) 43 | { 44 | FixTypeAction ignoreAction = new(span.Span, text, Document._convertTypes[text]); 45 | SuggestedActionSet ignoreSet = new(PredefinedSuggestedActionCategoryNames.CodeFix, new[] { ignoreAction }, "Title", SuggestedActionSetPriority.High, span.Span); 46 | actionSets.Add(ignoreSet); 47 | } 48 | } 49 | 50 | return actionSets; 51 | } 52 | 53 | public Task HasSuggestedActionsAsync(ISuggestedActionCategorySet requestedActionCategories, SnapshotSpan range, CancellationToken cancellationToken) 54 | { 55 | IList spans = _aggregator.GetClassificationSpans(range); 56 | 57 | foreach (ClassificationSpan span in spans.Where(s => s.ClassificationType.IsOfType(PredefinedClassificationTypeNames.SymbolDefinition))) 58 | { 59 | string text = span.Span.GetText(); 60 | 61 | if (Document._convertTypes.ContainsKey(text)) 62 | { 63 | return Task.FromResult(true); 64 | } 65 | } 66 | 67 | return Task.FromResult(false); 68 | } 69 | 70 | public bool TryGetTelemetryId(out Guid telemetryId) 71 | { 72 | telemetryId = Guid.Empty; 73 | return false; 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/MIDL/VSCommandTable.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This file was generated by VSIX Synchronizer 4 | // 5 | // ------------------------------------------------------------------------------ 6 | namespace MIDL 7 | { 8 | using System; 9 | 10 | /// 11 | /// Helper class that exposes all GUIDs used across VS Package. 12 | /// 13 | internal sealed partial class PackageGuids 14 | { 15 | public const string IdlFileSelectedString = "3af3801b-be4e-45a6-83c2-71ae3581a399"; 16 | public static Guid IdlFileSelected = new Guid(IdlFileSelectedString); 17 | 18 | public const string MidlEditorFactoryString = "f7d6e464-2c5c-4e02-bc1b-8fe2cde367a3"; 19 | public static Guid MidlEditorFactory = new Guid(MidlEditorFactoryString); 20 | 21 | public const string MIDLString = "be7365f7-d75c-4cfe-94b5-e28bf78459b5"; 22 | public static Guid MIDL = new Guid(MIDLString); 23 | } 24 | /// 25 | /// Helper class that encapsulates all CommandIDs uses across VS Package. 26 | /// 27 | internal sealed partial class PackageIds 28 | { 29 | public const int MyMenuGroup = 0x0001; 30 | public const int FileMenu = 0x0002; 31 | public const int MyCommand = 0x0100; 32 | public const int CopyEntityToClipboard = 0x0101; 33 | } 34 | } -------------------------------------------------------------------------------- /src/MIDL/VSCommandTable.vsct: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 21 | 22 | 32 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /src/MIDL/source.extension.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This file was generated by VSIX Synchronizer 4 | // 5 | // ------------------------------------------------------------------------------ 6 | namespace MIDL 7 | { 8 | internal sealed partial class Vsix 9 | { 10 | public const string Id = "MIDL.148cb49f-0d60-482a-a9ca-800f2b6c579b"; 11 | public const string Name = "WinRT Tools for C++"; 12 | public const string Description = @"Provides language support for IDL 3 and header generation based on WinMD transformations."; 13 | public const string Language = "en-US"; 14 | public const string Version = "1.0.9991"; 15 | public const string Author = "Mads Kristensen"; 16 | public const string Tags = "idl, midl"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/MIDL/source.extension.vsixmanifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | WinRT Tools for C++ 6 | Provides language support for IDL 3 and header generation based on WinMD transformations. 7 | https://github.com/madskristensen/MIDL 8 | Resources\LICENSE 9 | Resources\Icon.png 10 | Resources\Icon.png 11 | idl, midl 12 | true 13 | 14 | 15 | 16 | amd64 17 | 18 | 19 | arm64 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/MIDLParser/Constants.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace MIDLParser 8 | { 9 | public class Constants 10 | { 11 | public const string SingleLineCommentString = "//"; 12 | public const string CommentOpen = "/*"; 13 | public const string CommentClose = "*/"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/MIDLParser/Document.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | namespace MIDLParser 5 | { 6 | public partial class Document 7 | { 8 | private string[] _lines; 9 | 10 | protected Document(string[] lines) 11 | { 12 | _lines = lines; 13 | Parse(); 14 | } 15 | 16 | public List Items { get; private set; } = new List(); 17 | 18 | public void UpdateLines(string[] lines) 19 | { 20 | _lines = lines; 21 | } 22 | 23 | public static Document FromLines(params string[] lines) 24 | { 25 | Document? doc = new(lines); 26 | return doc; 27 | } 28 | 29 | public ParseItem? FindItemFromPosition(int position) 30 | { 31 | return Items.LastOrDefault(t => t.Contains(position)); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/MIDLParser/DocumentParser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Security.Principal; 5 | using System.Text.RegularExpressions; 6 | 7 | namespace MIDLParser 8 | { 9 | public partial class Document 10 | { 11 | private static readonly Regex _rxSingleLineComment = new(@"//.+"); 12 | private static readonly Regex _rxCommentOpen = new(@"/\*"); 13 | private static readonly Regex _rxCommentClose = new(@"\*/"); 14 | private static readonly Regex _rxString = new(@"\""[^\""].+\"""); 15 | private static readonly Regex _rxAttribute = new(@"(?<=\[)\w+(?=.*\])"); 16 | private static readonly Regex _rxType = new(@"\b(asm|__asm__|auto|bool|Boolean|_Bool|char|_Complex|double|float|PWSTR|PCWSTR|_Imaginary|int|long|short|VARIANT|BSTR|string|String|Single|Double|Int16|Int32|Int64|UInt8|UInt16|UInt32|UInt64|Char|Char16|Guid|Object)\b|(?<=(event|enum|struct|attribute|runtimeclass|interface)\s*)[\w\.]+"); 17 | private static readonly Regex _rxKeyword = new(@"^(#include|#define)|\b(true|false|signed|typedef|union|unsigned|void|enum|struct|import|VARIANT|BSTR|break|case|overridable|ref|out|const|continue|default|do|else|for|goto|if|_Pragma|return|switch|while|set|get|event|attribute|requires|protected|runtimeclass|apicontract|namespace|interface|delegate|static|unsealed)\b"); 18 | private static readonly Regex _rxText = new(@"(\w|\d)+"); 19 | private static readonly Regex _rxOp = new(@"[~.;,+\-*/()\[\]{}<>=&$!%?:|^\\]"); 20 | 21 | public bool IsParsing { get; private set; } 22 | 23 | public bool IsValid { get; private set; } 24 | 25 | struct PendingCommentItem 26 | { 27 | public int Start { get; set; } 28 | 29 | public int Line { get; set; } 30 | 31 | public int Column { get; set; } 32 | } 33 | 34 | private PendingCommentItem? _pendingComment = null; 35 | 36 | public void Parse() 37 | { 38 | IsParsing = true; 39 | bool isSuccess = false; 40 | int start = 0; 41 | 42 | try 43 | { 44 | List tokens = new(); 45 | 46 | for (int line = 0; line < _lines.Length; ++line) 47 | { 48 | string lineStr = _lines[line]; 49 | for (int column = 0; column < lineStr.Length;) 50 | { 51 | // Trim white space 52 | while (column < lineStr.Length && lineStr[column] == ' ') 53 | { 54 | column++; 55 | } 56 | int oldColumn = column; 57 | ParseItem? current = ParseLine(start, line, ref column, lineStr); 58 | 59 | if (current != null) 60 | { 61 | tokens.Add(current); 62 | } 63 | else if (oldColumn == column) 64 | { 65 | break; 66 | } 67 | } 68 | 69 | start += lineStr.Length; 70 | } 71 | 72 | Items = tokens.OrderBy(i => i.Start).ToList(); 73 | 74 | ValidateDocument(); 75 | 76 | isSuccess = true; 77 | } 78 | finally 79 | { 80 | IsParsing = false; 81 | 82 | if (isSuccess) 83 | { 84 | Parsed?.Invoke(this, EventArgs.Empty); 85 | } 86 | } 87 | } 88 | 89 | private ParseItem? ParseLine(int start, int line, ref int column, string lineStr) 90 | { 91 | if (_pendingComment is PendingCommentItem commentItem) 92 | { 93 | // Comment close 94 | if (IsMatch(_rxCommentClose, lineStr, ref column, out Match matchCommendClose)) 95 | { 96 | _pendingComment = null; 97 | string text = FindText(commentItem.Line, commentItem.Column, line, column); 98 | return ToParseItem(text, commentItem.Start, ItemType.Comment); 99 | } 100 | else 101 | { 102 | column += 1; 103 | return null; 104 | } 105 | } 106 | 107 | // Single line comment 108 | if (IsMatch(_rxSingleLineComment, lineStr, ref column, out Match matchComment)) 109 | { 110 | return ToParseItem(matchComment, start, ItemType.Comment)!; 111 | } 112 | 113 | // Comment open 114 | if (IsMatch(_rxCommentOpen, lineStr, ref column, out Match matchCommentStart)) 115 | { 116 | _pendingComment = new() 117 | { 118 | Start = start + matchCommentStart.Index, 119 | Column = column - matchCommentStart.Length, 120 | Line = line, 121 | }; 122 | return null; 123 | } 124 | 125 | // Keywords 126 | if (IsMatch(_rxKeyword, lineStr, ref column, out Match matchVar)) 127 | { 128 | return ToParseItem(matchVar, start, ItemType.Keyword)!; 129 | } 130 | 131 | // Types 132 | if (IsMatch(_rxType, lineStr, ref column, out Match matchType)) 133 | { 134 | return ToParseItem(matchType, start, ItemType.Type)!; 135 | } 136 | 137 | // Attributes 138 | if (IsMatch(_rxAttribute, lineStr, ref column, out Match? matchAttr)) 139 | { 140 | return ToParseItem(matchAttr, start, ItemType.Type)!; 141 | } 142 | 143 | // Strings 144 | if (IsMatch(_rxString, lineStr, ref column, out Match matchStrings)) 145 | { 146 | return ToParseItem(matchStrings, start, ItemType.String)!; 147 | } 148 | 149 | // Op 150 | if (IsMatch(_rxOp, lineStr, ref column, out Match _)) 151 | { 152 | return null; 153 | } 154 | 155 | // Text 156 | if (IsMatch(_rxText, lineStr, ref column, out Match _)) 157 | { 158 | return null; 159 | } 160 | return null; 161 | } 162 | 163 | private string FindText(int startLine, int startColumn, int endLine, int endColumn) 164 | { 165 | bool isEndOnSameLine = endLine == startLine; 166 | string startLineStr = _lines[startLine]; 167 | string text = startLineStr.Substring(startColumn, isEndOnSameLine ? endColumn - startColumn : startLineStr.Length - startColumn); 168 | for (int line = startLine + 1; line <= endLine; ++line) 169 | { 170 | // TODO: Detect newline characters in doc 171 | text += "\n"; 172 | string lineStr = _lines[line]; 173 | text += line == endLine ? lineStr.Substring(0, endColumn) : lineStr; 174 | } 175 | return text; 176 | } 177 | 178 | public static bool IsMatch(Regex regex, string line, ref int at, out Match match) 179 | { 180 | match = regex.Match(line, at); 181 | bool result = match.Success && match.Index == at; 182 | if (result) 183 | { 184 | at += match.Length; 185 | } 186 | return result; 187 | } 188 | 189 | private ParseItem ToParseItem(string line, int start, ItemType type) 190 | { 191 | ParseItem? item = new(start, line, this, type); 192 | return item; 193 | } 194 | 195 | private ParseItem? ToParseItem(Match match, int start, ItemType type) 196 | { 197 | if (string.IsNullOrEmpty(match.Value)) 198 | { 199 | return null; 200 | } 201 | 202 | return ToParseItem(match.Value, start + match.Index, type); 203 | } 204 | 205 | private void ValidateDocument() 206 | { 207 | IsValid = true; 208 | foreach (ParseItem item in Items.Where(i => i.Type == ItemType.Type)) 209 | { 210 | if (_convertTypes.ContainsKey(item.Text)) 211 | { 212 | item.Errors.Add(Errors.PL001.WithFormat(item.Text, _convertTypes[item.Text])); 213 | IsValid = false; 214 | } 215 | } 216 | } 217 | 218 | public static readonly Dictionary _convertTypes = new() 219 | { 220 | {"int", "Int32"}, 221 | {"short", "Int16"}, 222 | {"long", "Int32"}, 223 | {"PWSTR", "String"}, 224 | {"PCWSTR", "String"}, 225 | {"double", "Double"}, 226 | {"float", "Single"}, 227 | {"string", "String" }, 228 | }; 229 | 230 | private class Errors 231 | { 232 | public static Error PL001 { get; } = new("IDL001", "Use {1} instead of {0}.", ErrorCategory.Error); 233 | public static Error PL002 { get; } = new("PL002", "\"{0}\" is not a valid absolute URI", ErrorCategory.Warning); 234 | } 235 | 236 | 237 | public event EventHandler? Parsed; 238 | } 239 | } 240 | -------------------------------------------------------------------------------- /src/MIDLParser/ItemType.cs: -------------------------------------------------------------------------------- 1 | namespace MIDLParser 2 | { 3 | public enum ItemType 4 | { 5 | Comment, 6 | EmptyLine, 7 | Text, 8 | Keyword, 9 | Type, 10 | String 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/MIDLParser/MIDLParser.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | latest 6 | enable 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/MIDLParser/ParseItem.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | namespace MIDLParser 5 | { 6 | public class ParseItem 7 | { 8 | public HashSet _errors = new(); 9 | 10 | public ParseItem(int start, string text, Document document, ItemType type) 11 | { 12 | Start = start; 13 | Text = text; 14 | TextExcludingLineBreaks = text.TrimEnd(); 15 | Document = document; 16 | Type = type; 17 | } 18 | 19 | public ItemType Type { get; } 20 | 21 | public virtual int Start { get; } 22 | 23 | public virtual string Text { get; protected set; } 24 | public virtual string TextExcludingLineBreaks { get; protected set; } 25 | 26 | public Document Document { get; } 27 | 28 | public virtual int End => Start + Text.Length; 29 | public virtual int EndExcludingLineBreaks => Start + TextExcludingLineBreaks.Length; 30 | 31 | public virtual int Length => End - Start; 32 | public virtual int LengthExcludingLineBreaks => EndExcludingLineBreaks - Start; 33 | 34 | public ICollection Errors => _errors; 35 | 36 | public bool IsValid => _errors.Count == 0; 37 | 38 | public virtual bool Contains(int position) 39 | { 40 | return Start <= position && End >= position; 41 | } 42 | 43 | public ParseItem? Previous 44 | { 45 | get 46 | { 47 | int index = Document.Items.IndexOf(this); 48 | return index > 0 ? Document.Items[index - 1] : null; 49 | } 50 | } 51 | 52 | public ParseItem? Next 53 | { 54 | get 55 | { 56 | int index = Document.Items.IndexOf(this); 57 | return Document.Items.ElementAtOrDefault(index + 1); 58 | } 59 | } 60 | 61 | public override string ToString() 62 | { 63 | return Type + " " + Text; 64 | } 65 | } 66 | 67 | public class Error 68 | { 69 | public Error(string errorCode, string message, ErrorCategory severity) 70 | { 71 | ErrorCode = errorCode; 72 | Message = message; 73 | Severity = severity; 74 | } 75 | 76 | public string ErrorCode { get; } 77 | public string Message { get; } 78 | public ErrorCategory Severity { get; } 79 | 80 | public Error WithFormat(params string[] replacements) 81 | { 82 | return new Error(ErrorCode, string.Format(Message, replacements), Severity); 83 | } 84 | } 85 | 86 | public enum ErrorCategory 87 | { 88 | Error, 89 | Warning, 90 | Message, 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /test/MIDLParser.Test/.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome:http://EditorConfig.org 2 | 3 | 4 | # CSharp code style settings: 5 | [*.cs] 6 | # Prefer "var" everywhere 7 | csharp_style_var_for_built_in_types =true:error 8 | csharp_style_var_when_type_is_apparent =true:error 9 | csharp_style_var_elsewhere =false:error -------------------------------------------------------------------------------- /test/MIDLParser.Test/MIDLParser.Test.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {81A8CD1D-B110-45E9-9488-814FEFF0829D} 8 | Library 9 | Properties 10 | MIDLParser.Test 11 | MIDLParser.Test 12 | v4.8 13 | 512 14 | {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 15 | 15.0 16 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 17 | $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages 18 | False 19 | UnitTest 20 | 21 | 22 | 23 | 24 | true 25 | full 26 | false 27 | bin\Debug\ 28 | DEBUG;TRACE 29 | prompt 30 | 4 31 | 32 | 33 | pdbonly 34 | true 35 | bin\Release\ 36 | TRACE 37 | prompt 38 | 4 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 2.2.7 51 | 52 | 53 | 2.2.7 54 | 55 | 56 | 57 | 58 | {0cab4ebb-aa58-4742-8acf-0852af458bd9} 59 | MIDLParser 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /test/MIDLParser.Test/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("MIDLParser.Test")] 6 | [assembly: AssemblyDescription("")] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: AssemblyCompany("")] 9 | [assembly: AssemblyProduct("MIDLParser.Test")] 10 | [assembly: AssemblyCopyright("Copyright © 2022")] 11 | [assembly: AssemblyTrademark("")] 12 | [assembly: AssemblyCulture("")] 13 | 14 | [assembly: ComVisible(false)] 15 | 16 | [assembly: Guid("81a8cd1d-b110-45e9-9488-814feff0829d")] 17 | 18 | // [assembly: AssemblyVersion("1.0.*")] 19 | [assembly: AssemblyVersion("1.0.0.0")] 20 | [assembly: AssemblyFileVersion("1.0.0.0")] 21 | -------------------------------------------------------------------------------- /test/MIDLParser.Test/TokenTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace MIDLParser.Test 6 | { 7 | [TestClass] 8 | public class TokenTest 9 | { 10 | private const string _rawFile = @"// Photo.idl 11 | /*Comment*/ 12 | /*Longer runtimeclass 13 | namespace 14 | Comment*/ 15 | 16 | #include ""NamespaceRedirect.h"" 17 | 18 | namespace PhotoEditor 19 | { 20 | delegate void RecognitionHandler(Boolean arg); // delegate type, for an event. 21 | 22 | [default_interface(""http://foo.com"")] 23 | [webhosthidden] 24 | runtimeclass Photo : Windows.UI.Xaml.Data.INotifyPropertyChanged // interface. 25 | { 26 | Photo(); // constructors. 27 | Photo(Windows.Storage.StorageFile imageFile); 28 | 29 | string ImageName{ get; }; // read-only property. 30 | Single SepiaIntensity; // read-write property. 31 | 32 | Windows.Foundation.IAsyncAction StartRecognitionAsync(); // (asynchronous) method. 33 | 34 | event RecognitionHandler ImageRecognized; // event. 35 | } 36 | }"; 37 | 38 | private static readonly string _canonicalFile = GetCanonicalFile(); 39 | 40 | private static string GetCanonicalFile() 41 | { 42 | return _rawFile.Replace("\r\n", "\n").Replace("\r", "\n").Replace("\n", Environment.NewLine); 43 | } 44 | 45 | [TestMethod] 46 | public void ParserTest() 47 | { 48 | var lines = _canonicalFile.Split(new[] { Environment.NewLine }, StringSplitOptions.None); 49 | var parser = Document.FromLines(lines); 50 | 51 | Assert.AreEqual(ItemType.Comment, parser.Items.First().Type); 52 | Assert.AreEqual(ItemType.Comment, parser.Items[1].Type); 53 | Assert.AreEqual(ItemType.Comment, parser.Items[2].Type); 54 | Assert.AreEqual(ItemType.Keyword, parser.Items[3].Type); 55 | Assert.AreEqual(ItemType.String, parser.Items[4].Type); 56 | Assert.AreEqual(26, parser.Items.Count); 57 | } 58 | 59 | [TestMethod] 60 | public void ValidationTest() 61 | { 62 | var lines = _canonicalFile.Split(new[] { Environment.NewLine }, StringSplitOptions.None); 63 | var parser = Document.FromLines(lines); 64 | 65 | Assert.AreEqual(1, parser.Items.ElementAt(17).Errors.Count); 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /vs-publish.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/vsix-publish", 3 | "categories": [ "programming languages"], 4 | "identity": { 5 | "internalName": "MIDL", 6 | "tags": [ "idl", "webidl", "midl" ] 7 | }, 8 | "assetFiles": [ 9 | { 10 | "pathOnDisk": "art/suggested-actions.gif", 11 | "targetPath": "art/suggested-actions.gif" 12 | }, 13 | { 14 | "pathOnDisk": "art/context-menu.png", 15 | "targetPath": "art/context-menu.png" 16 | }, 17 | { 18 | "pathOnDisk": "art/merge.png", 19 | "targetPath": "art/merge.png" 20 | } 21 | ], 22 | "overview": "README.md", 23 | "publisher": "MadsKristensen", 24 | "repo": "https://github.com/MadsKristensen/MIDL" 25 | } --------------------------------------------------------------------------------