Page 1 of 1

Importing Relative module does not add commands to intellisense

Posted: Sun May 26, 2019 4:06 pm
by michaelp
To help you better we need some information from you.

*** Please fill in the fields below. 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: PowerShell Studio 2019 (64 Bit)
Build: v5.6.163
OS: Windows Server 2016 Datacenter (64 Bit)
Build: v6.2.9200.0

*** Please add details and screenshots as needed below. ***
Directory Structure:
│ MainScript.ps1

└───Module
│ Module.psd1
│ Module.psm1

├───Private
│ IntFunction.ps1

└───Public
Function1.ps1 - Has function Function1 { param ( [string]$val1 ) write-host $val1 }
Function2.ps1
Function3.ps1

Code:
  1. Import-Module .\Module\Module.psm1
  2.  
  3. Function1 -val1 "Test"
It doesn't look like the module systems will load local modules with just referencing. Is there any way to cache the functions from a module by path?

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

Re: Importing Relative module does not add commands to intellisense

Posted: Tue May 28, 2019 7:12 am
by davidc
Is this part of a project or individual files? If it is a project you can add the sub-module files (Modules.psd1 and Module.psm1) and set their project properties as follows:

Build = Content
Shared = True

The project will then parse the function declarations from the psm1 file and provide PrimalSense for them.

If they are individual files, then you will have to use the Cache Editor tool to cache the module (Ribbon->Home->Platform->Cache Editor):
Ribbon - Cache Edit.png
Ribbon - Cache Edit.png (36.05 KiB) Viewed 1558 times
Within the Cache Editor tool, press the Import Module... button and select the module you wish to cache:
CacheEdit - Import Module.png
CacheEdit - Import Module.png (52.16 KiB) Viewed 1558 times
You will have to reload the cache within PowerShell Studio (Ribbon->Home->Platform->Reload Cache):
Reload Cache.png
Reload Cache.png (29.63 KiB) Viewed 1558 times