Populating Intellisense

Use this forum to ask questions after your subscription maintenance expires or before you buy. Need information on licensing or pricing? Questions about a trial version? This is the right place for you. No scripting questions, please.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
This topic is 7 years and 11 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
jgaswint
Posts: 2
Last visit: Tue May 17, 2016 8:41 am

Populating Intellisense

Post by jgaswint »

Product, version and build: PowerShell Studio 2016 5.2.120.0
32 or 64 bit version of product: 64
Operating system: Windows 10
32 or 64 bit OS: 64

I'm probably missing something very simple, but for the life of me I can seem to figure this out.

I'm looking at this product to replace the built-in powershell_ise. I like the product quite a bit, but there's one thing that I'm not sure that I can live without. In the built-in ISE, you can run any script, and the intellisense will update in real time (at least in my experience) and I can use those functions with the parameters being displayed.

I can't figure out how to make this happen in this product. Is it even possible?

Thanks in advance.
User avatar
juneblender
Posts: 93
Last visit: Thu Mar 30, 2017 8:54 am

Re: Populating Intellisense

Post by juneblender »

Yes, I rely on it, too, and it's it implemented in PowerShell Studio.

In this image, I define a function. Then, on the next line, I call the function. PowerShell Studio knows the parameters and PrimalSense (our version of intellisense) prompts for them.

Are you trying something different?
Attachments
Screenshot 2016-05-16 13.52.33.png
Screenshot 2016-05-16 13.52.33.png (39.99 KiB) Viewed 5566 times
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Populating Intellisense

Post by davidc »

PowerShell Studio display PrimalSense for objects it is able to determine without running the script. It functions this way for the following reasons:

1 PowerShell Studio always runs the scripts in a new runspace that is terminated when the script finishes. A new runspace is used to ensure that the script has no dependencies on modified variables (or profiles) so that they can run on other machines.

2. The script is executed in a separate process. The separate process also protects the editor from crashing if something goes wrong in the script.

We know some users like to work interactively and you have to option to run the scripts directly in the embedded console, where you can interrogate objects as you run the script.

We are looking at allowing users to have a persistent runspace (which will allow us to provide runtime object PrimalSense) but this would require some architectural changes therefore we can't offer any time tables.

There is nothing that says you must work exclusively in one tool. The ISE is great interactive console and PowerShell Studio is geared towards writing scripts and tools. Use the tool that is appropriate for the task at hand and sometimes that means working between tools.

Note: You can open the ISE directly from PowerShell Studio using the ribbon (Tools->PowerShell->PowerShell ISE).

David
David
SAPIEN Technologies, Inc.
User avatar
jgaswint
Posts: 2
Last visit: Tue May 17, 2016 8:41 am

Re: Populating Intellisense

Post by jgaswint »

Okay that makes perfect sense. Different process and runspace.

WHAT I'M DOING
I'm scripting a lot of my organizations installers inside PowerShell App Deploy Toolkit as a wrapper and there's a lot of useful functions that haven't been turned into modules yet (on the to do list from what I read). They dot source their .ps1 scripts and inside the ISE it loads the functions into RAM and I'm able to use them while I have the ISE open. My organization also just turned on AllSigned executionpolicy so the fact that every time I save the script it signs it I love.

I did not know you could open the ISE directly, so thank you for that little tidbit.
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Populating Intellisense

Post by davidc »

PowerShell Studio will provide PrimalSense for functions in dot sourced ps1 files if it can locate them. It is possible it is unable to locate the files depending on how they are dot sourced.

Modules are the recommended best practice for reusable code. If the ps1 files only contain functions, you can use the New module from function command:

https://www.sapien.com/blog/2014/07/09/ ... -a-module/

Or add the existing ps1 files to a module project.

David
David
SAPIEN Technologies, Inc.
This topic is 7 years and 11 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.