At work we're developing a PowerShell solution using VSCode, the PowerShell extension and PSScriptAnalyzer. Our files are defined as .psm1
files containging classes, and use using module
to import other .psm1
files using relative paths.
The problem is, that using module
doesn't seem to support intellisense, i.e. is not statically analyzable by the PowerShell parser: This can also be due the type not being known at parse time due to types imported by 'using' statements. PSScriptAnalyzer(TypeNotFound)
I'm wondering if there is a way to import other modules using relative paths while still supporting intellisense.
Ideally this would happen in the .psm1
files themselves to reduce setup time for new developers, but I'm ok with additional setup steps, i.e. adding them to $env:PSModulePath
.
This is how the files are structured right now:
# ./BaseClass.psm1
class BaseClass {
# ...
}
# ./SomeClass.psm1
using module .BaseClass.psm1
class SomeClass : BaseClass {
# ...
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…