plugin icon indicating copy to clipboard operation
plugin copied to clipboard

[Feature Request]: Support autocomplete Psalm-style enum string parameters

Open emmadesilva opened this issue 1 year ago • 2 comments

Feature Description

Hey! Something I think would be really useful is if Idea could fill in enumerated string parameters defined using the Psalm syntax @var 'A'|'B'|'C'

/**
* @param  'dropdown'|'flat'|'hidden'  $displayMode
*/
public function setSubdirectoryDisplayMode(string $displayMode): static
{
    self::assertType(['dropdown', 'flat', 'hidden'], $displayMode);

    $this['subdirectory_display'] = $displayMode;

    return $this;
}

// This would provide autocomplete to fill in the word "hidden"
$builder->setSubdirectoryDisplayMode('hi|'); // Pipe denotes cursor

// This would show a warning/error
$builder->setSubdirectoryDisplayMode('invalid')

See https://psalm.dev/docs/annotating_code/typing_in_psalm/#specifying-stringint-options-aka-enums and https://github.com/vimeo/psalm/issues/16

emmadesilva avatar Jul 11 '24 14:07 emmadesilva

@adelf I'm assuming this could be implemented by hooking in to the ide.json system right?

emmadesilva avatar Jul 26 '24 13:07 emmadesilva

Hello. Yes. It's the simplest way.

On Fri, 26 Jul 2024, 16:10 Caen De Silva, @.***> wrote:

@adelf https://github.com/adelf I'm assuming this could be implemented by hooking in to the ide.json system right?

— Reply to this email directly, view it on GitHub https://github.com/laravel-idea/plugin/issues/1024#issuecomment-2252734401, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVQCWWPVK7Z322N54VMT6DZOJDFJAVCNFSM6AAAAABKXDWEMKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJSG4ZTINBQGE . You are receiving this because you were mentioned.Message ID: @.***>

adelf avatar Jul 26 '24 14:07 adelf