in PS ISE, when scriptmethod is added to an object. how to get completion for that method ?

hello , is it possible to have completion in PSISE for method of custom objects that were added as ScriptMethod ?

Erwin PombettAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I'm not sure if I've understood correctly what you're asking, but if you have an object for which you have added a scriptmethod
$a = new-object psobject
$a | Add-Member -MemberType ScriptMethod -Name "sm" -Value {$item.tostring()}

Open in new window

Then when you next use that object, Intellisense (and tab completion) will know about that scriptmethod.  Typing
you should now see the Intellisense suggestions.  Typing
you should start to cycle through with tab completion.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Erwin PombettAuthor Commented:
hello footech.

sorry for my lack of explanation.

my problem:

1. i create a custom object.
2. i add members of type scriptmethod. exactly as you advice on the last post.
3. if i pass such custom object in param to a function with formal type as [System.Object] in the function i can not have completion for the scriptmethod.

I'd like to have completion with scriptmethod

thank for further help
Can you provide example code for the function and how you pass the parameter so I can reproduce the issue?
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Erwin PombettAuthor Commented:
i'm not allowed to upload psm1 files.
i tried in a zip but it also check that and avoid me to upload.

how can i do ?

i'm changing all psm1 to txt and putting them into a zip file
Erwin PombettAuthor Commented:
2 things:

in Tshr.EIDServersManager
   i've declared a custom object EID-LogManager. but i never have the completion for the scriptmethod "dologfileexist" or logline.
   how to do it ?

in Tshr.EIDServersManager
   in the switch, i declare custom object "New-EIDServer" that i added to the array of objects.  
   once in that array , how to call a  scriptmethod of the object ?

thank you in advance.
So with the function EID-LogManager created.  If I run
$theLogFile = EID-LogManager "EID: stoping and starting services"
Then I can tab-complete after the dot and I will get to the scriptmethods you defined in the function (both DoLogFileExist and LogLine).

If you're asking me to validate the functionality of the script, I won't be able to do that.  But if you're just asking about tab completion, from what I'm seeing every time I use tab completion it includes the scriptmethods.

I'm not sure if there's any more help I can give here.
Did I really help at all?
If not, it's fine to just delete the question.  No need to give me points just for trying.  :)
Erwin PombettAuthor Commented:
when pass the lines as command in the console not through psise, completion runs as you explained.
i think if someone, one day, look for such a question it's not wrong.

thank you for your help

ps: i dont know how to delete a question either :)  it doesn't apply to this question.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.