Intellisense for functions in ps1 files

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION 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.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 3 years and 4 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.
dvenardos
Posts: 5
Last visit: Fri Jan 14, 2022 1:04 am

Intellisense for functions in ps1 files

Post by dvenardos »

Product: PowerShell Studio 2019 (64 Bit)
Build: v5.6.170
OS: Windows 10 Enterprise (64 Bit)
Build: v10.0.17763.0
PowerShell v 5.1
----------------------------------------
I found the cache editor for getting intellisense for the exported functions in modules, but am wondering if there is anyway to get intellisense for functions in a ps1 file.
For example, in the PowerShell ISE I can highlight a function in a file hit F8 and then have intellisense for that function both in a script file and the ISE console. Is there an equivalent in PowerShell Studio?

Use case is working with modules with functions that are stored as individual files and dot sourced into the module and standalone script files that have functions in them.
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: Intellisense for functions in ps1 files

Post by Alexander Riedel »

Generally, if the PS1 file is dot sourced you should not have to do anything to get PrimalSense for functions in that file.
Without code it hard to tell if there is a problem though. Most commonly, people use code to determine the file name and path of a dot sourced file and then dot source via variable.
Since that variable's content is only known at runtime, the parser cannot resolve such a construct with a static parse.

Maybe you can show how you dot source the files in question?
Alexander Riedel
SAPIEN Technologies, Inc.
dvenardos
Posts: 5
Last visit: Fri Jan 14, 2022 1:04 am

Re: Intellisense for functions in ps1 files

Post by dvenardos »

Thanks, from your description I understand the problem.

In the ISE you can dot source a function in the console and that gives you intellisense in the editor window. So, for example, if I am working on a function in a file that calls another function in a file I can dot source in the console and get intellisense on that function or load the module in the console and get intellisense. In PowerShell studio I have to temporarily dot source any file I want intellisense for in the script file wherein I want to get the intellisense.

In the ISE the script editor and the console are tied together, but in PowerShell Studio that does not seem to be the case.
This topic is 3 years and 4 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.