Skip to content

Add descriptive tooltips to AD property completions#5

Open
TMA-2 wants to merge 1 commit intoMartinGC94:mainfrom
TMA-2:Shared-ADProperties
Open

Add descriptive tooltips to AD property completions#5
TMA-2 wants to merge 1 commit intoMartinGC94:mainfrom
TMA-2:Shared-ADProperties

Conversation

@TMA-2
Copy link
Copy Markdown

@TMA-2 TMA-2 commented Oct 4, 2025

Added comprehensive descriptions for AD properties to improve completer usability. Tooltips now provide context about what each property does rather than just showing the property name.
Uses the existing CompletionHelper::CompleteProperty() pattern with parameter/description hashtables.

Modified `Shared\AdProperties.ps1` to a hashtable with field descriptions displayed as completion result tooltips.
Copilot AI review requested due to automatic review settings October 4, 2025 20:17
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the Active Directory property completions by adding comprehensive descriptions for all AD properties. Previously, the completions only showed property names; now they display helpful tooltips describing what each property does.

Key changes:

  • Converted property arrays to hashtables with property names as keys and descriptions as values
  • Updated the completion logic to pass descriptions to NewParamCompletionResult()
  • Added detailed, user-friendly descriptions for hundreds of AD properties across all supported cmdlets

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@MartinGC94
Copy link
Copy Markdown
Owner

Thank you. This looks great at a glance but in hindsight I should probably have tried to group the different properties a bit to avoid all these duplicate entries. Right now my idea on how to do this would be like this:

$Values = @{
    All = @{
        CanonicalName = 'Canonical name in domain/OU/object format'
    } # Common for all AD commands
    GroupName1 = @{} # For commands: 1, 2, 3
    GroupName2 = @{} # For commands: 1, 4, 5
    'Get-ADUser' = @{} # Unique for Get-ADUser
}

$PropertyGroups = switch ($CommandName)
{
    'Get-ADUser' {"All", "GroupName1", $_}
    'Get-ADComputer' {"All", "GroupName2", $_}
}

foreach ($GroupName in $PropertyGroups)
{
    $Group = $Values[$GroupName]
    foreach ($PropertyName in $Group.Keys)
    {
        # Check if match and if so create completion
    }
}

Or maybe it would be worth it to dynamically create a new hashtable with all the properties/descriptions so we can sort the keys before outputting them. Anyway, do you have any other ideas on how we could do this?

@TMA-2
Copy link
Copy Markdown
Author

TMA-2 commented Oct 4, 2025

Good idea - grouping common properties would reduce duplication. Let me think about the best way to organize the categories and get back to you. I've been task-switching across too many projects today and need to come back to this when my head doesn't hurt.

But for posterity, I did something similar for this little ActiveDirectoryEx helper module (that basically only I use at work) to make up for some of the main ActiveDirectory module's shortcomings, with Common, User, Group, etc. keys stored in a psd1 and read on import. but I think the implementation you came up with works better. I'd have to check what exactly I did.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants