Skip to content

Improve cim ETS member inference completion#24235

Merged
SeeminglyScience merged 3 commits into
PowerShell:masterfrom
MartinGC94:ImproveETSMemberCompletion
Dec 12, 2024
Merged

Improve cim ETS member inference completion#24235
SeeminglyScience merged 3 commits into
PowerShell:masterfrom
MartinGC94:ImproveETSMemberCompletion

Conversation

@MartinGC94

Copy link
Copy Markdown
Contributor

PR Summary

Improves the member type inference for cim based commands by adding a fallback to the short namespaceless name if a full name was specified.

PR Context

Many of the CDXML modules uses the .types.ps1xml type files to add additional members. In most cases they use a short name that doesn't specify the WMI namespace like: Microsoft.Management.Infrastructure.CimInstance#MSFT_NetFirewallRule but they still declare the full type with the namespace in the outputtype attribute: Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetFirewallRule

This is completely valid as the ciminstance type adapter adds both the full and short name to the list of typenames: https://github.com/PowerShell/PowerShell/blob/master/src/System.Management.Automation/cimSupport/other/ciminstancetypeadapter.cs#L234
So the type inference code also needs to handle this.

PR Checklist

@MartinGC94
MartinGC94 requested a review from daxian-dbw as a code owner August 30, 2024 16:27
Comment thread src/System.Management.Automation/engine/parser/TypeInferenceVisitor.cs Outdated
@microsoft-github-policy-service microsoft-github-policy-service Bot added the Review - Needed The PR is being reviewed label Sep 15, 2024

@SeeminglyScience SeeminglyScience left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks Martin!

@SeeminglyScience
SeeminglyScience merged commit e489cec into PowerShell:master Dec 12, 2024
@microsoft-github-policy-service

microsoft-github-policy-service Bot commented Dec 12, 2024

Copy link
Copy Markdown
Contributor

📣 Hey @MartinGC94, how did we do? We would love to hear your feedback with the link below! 🗣️

🔗 https://aka.ms/PSRepoFeedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review - Needed The PR is being reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants