UI functionality questions

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 6 years and 5 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
danabrash
Posts: 11
Last visit: Wed Sep 25, 2019 2:17 pm

UI functionality questions

Post by danabrash »

To help you better we need some information from you.

*** Please fill in the fields below if you are currently using a Trial Version of the Product. If you leave fields empty or specify 'latest' rather than the actual version your answer will be delayed as we will be forced to ask you for this information. ***

Product, version and build:
32 or 64 bit version of product:
Operating system:
32 or 64 bit OS:

*** Please add details and screenshots as needed below. ***

DO NOT POST SUBSCRIPTIONS, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM

I’m evaluating a trial version download, and I’ve got a few questions. Could you help me understand the below?

When I hover over variables in the script pane during debug, I expect them to show the current VALUE of the variable, not just the datatype. Right now it just shows the name of the variable I'm hovering over. Not helpful. I want to see my running values instead. Yes, I see the variables pane, but it’s cumbersome and noisy. I like the PoSh ISE hover showing me the value better.
Is there any way to change the behavior?

Why don't custom functions show up in intellisense in either the script window or the console? I load functions from custom modules, and they don’t show up in my script even though I’ve imported the module first. The show up fine if I’m writing in the psm1 file directly. What gives?

The UI keeps capitalizing my variables. I don't like that, how do I change style preferences?

Console history scroll shows individual lines from commands. How can we see the whole recall if we execute a block across multiple lines ( “`” and CrLf)?

How can I debug a module file when I'm executing a command F8 from a script tab? i.e. put a break point in my psm1 and hit it when I’m running the command that calls it from my ps1

Function Enums aren't tab completing ( e.g. -ErrorAction * ). This seems to have been transient and has gone away after restarting the UI.

How can I change default header info in new .ps1? Is there a default template for a new ps1 that I can edit?

Context Help : COOL! Does it rely on internet connection? Doesn't seem to update reliably. Is functionality limited in trial? Is there any way to import? (I my dev box has very restricted access to the internet)

I’m very much enjoying my trial, but I’m trying to learn new features and limitations (and shortcut keys). I realize that much is available in help and online, and I’ve found some answers there, but it is not super, and I’m not sure I’m asking the right questions. Please help me adjust as quickly as possible to this UI!
User avatar
Alexander Riedel
Posts: 8478
Last visit: Tue Mar 26, 2024 8:52 am
Answers: 19
Been upvoted: 37 times

Re: UI functionality questions

Post by Alexander Riedel »

It would help to know which product you are talking about :D PrimalScript or PowerShell Studio?
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
danabrash
Posts: 11
Last visit: Wed Sep 25, 2019 2:17 pm

Re: UI functionality questions

Post by danabrash »

PowerShell Studio.

Thanks!
=d=
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: UI functionality questions

Post by davidc »

Hello and thank you for trying PowerShell Studio.

There are a few differences between PowerShell Studio and the ISE that you should be aware of.

1. PowerShell Studio always runs the script in a new runspace to clear out the session. This ensures the script doesn't have any dependences on modified states or variables. In fact, the PowerShell session is running in a separate process to keep the editors isolated from crashes that may occur in the script. If you wish to retain a persistent session, you can use the Run in Console feature.
2. The embedded console is a separate process (the original powershell.exe). This allows you to test your scripts in a vanilla console environment. Note: Since the console is a separate process, it does not share a runspace with PowerShell Studio’s internal host.
3. PowerShell Studio does not load profiles. Again, this is to help reduce dependencies on local settings included in profiles. Note: The embedded console will load the usual profiles.

The goal of the application is to create reusable scripts and tools that you can deploy on other machines.

As for your questions:

Variable values.
In order to display the values, you must first set a breakpoint and run the debugger (F5). Once the debugger breaks, the editor will take a snapshot of the values and display them in the Variables panel or when hovering. While debugging, you can interrogate variables using the Debug Console or the Watch Panel.

Module Functions
PowerShell Studio uses a cache of Module cmdlets in order to provide PrimalSense and syntax coloring. You can refresh the cache using the Ribbon->Home->Platform->Refresh Cache
Refresh Cache.png
Refresh Cache.png (33.03 KiB) Viewed 19196 times
If the module is not located in a discoverable location, you can use our Cache Edit tool to import the module into the existing cache.
Ribbon - Cache Edit.png
Ribbon - Cache Edit.png (15.02 KiB) Viewed 19196 times
The reason we cache our cmdlets is because it allows you to write scripts for modules that are not installed locally. You can create profiles of other machines and script for that specific machine’s PowerShell version and module set.

Capitalizing Variables
Which variables are you referring to? The internal PowerShell variables?

Debug Module File
Try using the Debug with Multiple Files command. You can include the psm1 file.
Debug with Multiple Files.png
Debug with Multiple Files.png (20.68 KiB) Viewed 19196 times
Templates
To create your own templates, please refer to the following articles:

https://www.sapien.com/blog/2014/05/22/ ... templates/
https://www.sapien.com/blog/2014/11/19/ ... r-scripts/

Context Help
The context help (F1) triggers off of the caret position in the editor. It relies on the articles from our website and the MSDN website. Unfortunately, we don’t have an offline version available. But we do include a pdf control reference document that you can access from the Ribbon->Designer->Help->Control Reference.
Control Reference.png
Control Reference.png (7.99 KiB) Viewed 19196 times
Note: there are no restrictions on the trial when it comes to help.
David
SAPIEN Technologies, Inc.
User avatar
danabrash
Posts: 11
Last visit: Wed Sep 25, 2019 2:17 pm

Re: UI functionality questions

Post by danabrash »

Hi David,

Thanks for your response. This is great, I really appreciate your time.

I'm still confused about the module caching feature. You said "If the module is not located in a discoverable location..." What is defined as discoverable? I've got the modules opened in the same window, and they're in a sub-folder of the project that I'm running in. Doesn't the project help tie all that together? I see all my psm1 and my psd1 file in the psproj manifest. Do I need to tell the project to make the modules in the project available somehow?

In my scenario, if I'm working on a module that I'm importing into my script, but I'm making modifications to the module as I write, how would I make sure I'm using the latest version of the module when I debug my script? In ISE I'd simply save the module, call the import-module * -force line from my script, and I'd be running against the last save. Two clicks, assuming I've got the Import* at the top of my script....

I'm trying to figure out how I meed the same goal in PowerShell Studio. It seems like if I don't cache my modules then my functions are not available to scripts where I've imported the module, and I still can't leverage intellisense or tab complete. This seems weird. I get that you don't want to perpetuate sessions, but it's almost like I can't even create a session that imports a module without going through the cache. But if I DO cache my modules, how can I make sure I'm running with the latest save? If my script calls the import-module * -force will it get the last save? Or the last cache?

I've played with it, and when I import the module to the cache I can see my function calls light up in the script. This is great. Then when I edit a function in a module, I don't see the change show up creating a new call line in my script. E.g. I add a parameter to the function, but the script window's call to the function doesn't show the new parameter. If I re-sync the cache nothing happens, if I go in to the cache edit tool I see that my module has been un-ticked. If I tick it and resync things seem to light up again, but I'm unclear if I'm getting the latest version. My goal is simply: What's the right combination of voodoo to get the latest version of a function in my module so that I can test it from my script?

I checked the hover over a variable showing values some more, and the hover seems to show reliably for single value objects, but not for hash/array/list objects. I see also that my SqlCredential object shows as {} when I hover, but I see the userID and password fields in the debug console (password showing as a secure string of course). This is what I'd expected to see. If I wasn't diligently plugging in the variable to check it in the console I might think I'd not successfully built the object when I actually had.

regarding caps, I typed the second $foo as $foo, and it changed it

Code: Select all

function functionname ($Foo)
{
	$Foo
	
}
For Debug with Multiple files, I'm going to have to play with that more. I tried it once and it showed a dialog box, but I've tried it again to check it out and it basically goes straight to debug. I closed the UI and reopened the project and got the same behavior. I'll check it out later, but if you have any ideas that'd be great. In any case, getting the functions to light up by using the module cache let's me set a break point and then step in to the function in the module from there.

Thanks again very much,
Dana
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: UI functionality questions

Post by davidc »

Discoverable Modules
By discoverable modules I mean modules that are located in a $env:PSModulePath folder where PowerShell can locate them automatically. If the module is not in a PSModulePath folder, the caching process will not locate it. You will need to manually add the module to the current cache using the Cache Edit tool.

Note: If you are using a PowerShell Studio Module project, it will automatically copy the module into My Documents\WindowsPowerShell\Modules folder when using the Build command, where PowerShell can discover it. Then it kick-offs the caching process to update the module’s cache.
As for sub-modules, if you include them in the module manifest I believe PowerShell should load them.

Import-Module
PowerShell Studio still runs PowerShell, so your current process will not change from the perspective of PowerShell.
Is this module a single psm1 file with functions? If you Import-Module -Path <path to psm1> PowerShell Studio will treat the psm1 file as a dot sourced files and provide direct PrimalSense for the functions.
Alternatively, if you are working with a project, you could add the psm1 file to the projects (Press No to when asked to copy the file). Then set the Build setting of the file (using the Properties Panel) to Content and Shared to True.
Shared Content.png
Shared Content.png (15.82 KiB) Viewed 19135 times
This will ensure that the functions are exposed to the whole project for PrimalSense purposes.

https://www.sapien.com/blog/2017/02/28/ ... -v5-4-136/

Keeping Cache up to date
Using a module project, would be the easiest method of keeping the cache up to date. Although you could potentially run into issues if you don’t increment the module version.

Refreshing Cache
If you use the refresh button, it will clear the cache and update using the discoverable modules only. You may need to use the Cache Edit tool instead. Right now, there isn’t an on-the-fly voodoo-magic feature for it to determine if a module needs to be updated. As you can imagine this could result in performance issues.

If you really need on the fly changes for PrimalSense, I recommend using the methods I mentioned above.

Variable Hover
I will pass this along to the team and to see what we could do to improve this.

Variable Casing
In this case, our PrimalSense uses the casing that was used in the parameter declaration of the function. As with tradition editors, the selection is triggered when you type a SPACE. Pressing ESC will cancel the selection.

Debug with Multiple Files
When you use Debug with Multiple Files, it will bring up a dialog with the open files. The dialog will not show if no other files are open.
Have you tried to Step Into (F11) a module cmdlet? If it is a psm1 file, it should jump to the source file. You could also set a Function Breakpoint and then step into the function:
Function Breakpoint.png
Function Breakpoint.png (123.87 KiB) Viewed 19135 times
David
SAPIEN Technologies, Inc.
User avatar
danabrash
Posts: 11
Last visit: Wed Sep 25, 2019 2:17 pm

Re: UI functionality questions

Post by danabrash »

Hi David,

Thank you, this is super helpful. I'm spent most of my day in the UI today and it's starting to make more sense. Thanks for the tips, I'll keep this thread handy for reference. AND, I convinced my boss to give me his credit card on Monday, so thanks for helping bring this product into our workplace.

Take care,
Dana
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: UI functionality questions

Post by davidc »

Good to hear and I'm happy to help! If you have any further questions please feel free to ask.
David
SAPIEN Technologies, Inc.
User avatar
danabrash
Posts: 11
Last visit: Wed Sep 25, 2019 2:17 pm

Re: UI functionality questions

Post by danabrash »

Hi David,

Sorry, I'm still struggling trying to manage modules.

I tried setting them to shared=true, but that option is unavailable for me:
NotShared.png
NotShared.png (99.31 KiB) Viewed 19004 times
Is this a difference between evaluation vs full version? I'm assuming some features are turned off in Trial version, like source control, which also seems to be completely unavailable. Is this true?

In any case, I'm still dancing around the module cache. It seems that when I import my .psd1 module, which calls my master psm1 and exports my functions, into the cache editor, it will show up with a tick in the box next to it. After I 'refresh local cache' the tick box is empty. The only way I've found to get my Primal Sense back is to spam re-ticking and importing, building and refreshing until my functions light up. And then they go dark quickly again. It's quite frustrating, and I'm sure it's PEBCAK.

I tried removing and adding a .psm1 to the project, but it never prompted me to copy or not. I tested also using a new file I created on my Desktop (outside of project) and still no prompt. I found the setting in Options > General > Default Actions for Copy... to turn this off and tried both scenarios again, still no love.

I'm going to keep working with it and hopefully the answer will become obvious. Seems like maybe I'm getting in my own way by combining both Cache Refresh and Build Cache. Or the CC# on the licensing prompt will turn it on (hopefully with source control options as well).

Thanks much,
Dana
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: UI functionality questions

Post by davidc »

Shared PSM1
My mistake. I thought we allowed the Shared property to be set in non-module projects. This issue will be resolved in the next service release.

Module Cache
Yes, if you refresh the local cache it will rebuild using the PSModulePath, which means any module outside this path will be removed. When you do this, you will have to go back into the Cache Edit tool.
Instead of refreshing the whole cache, try to using the Cache Edit tool to reimport the module directly. Please let me know if this works.

Copy Prompt
If the psm1 is in a subfolder of the project, it will not prompt. As for the Default Action, it defaults to Ask unless it was changed at some point via user interaction.
David
SAPIEN Technologies, Inc.
This topic is 6 years and 5 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.