Centralized Loading of Required Modules to PowerShellContextService.cs #1537
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The primary goal of this change is to make it easier to support runspaces without FileSystem providers. While this is a somewhat obscure use case, it benefits the codebase as a whole by consolidating various often inconsistent permutations of
Into a single working copy.
Summary of changes:
For reference, we are currently Importing modules from disk as needed in the following areas of the codebase:
PowerShellEditorServices/src/PowerShellEditorServices/Services/PowerShellContext/Session/PSReadLinePromptContext.cs
Lines 76 to 78 in 00c7824
PowerShellEditorServices/src/PowerShellEditorServices/Services/PowerShellContext/PowerShellContextService.cs
Lines 240 to 243 in 00c7824
PowerShellEditorServices/src/PowerShellEditorServices/Services/PowerShellContext/PowerShellContextService.cs
Lines 432 to 434 in 00c7824
These following module loading code has been left unmodified as they are not required modules and Import-Module is being used to determine if PSES has the stated capabilities.
PowerShellEditorServices/src/PowerShellEditorServices/Services/PowerShellContext/TemplateService.cs
Lines 94 to 97 in 3274c23
PowerShellEditorServices/src/PowerShellEditorServices/Services/PowerShellContext/Session/Capabilities/DscBreakpointCapability.cs
Lines 94 to 100 in 3274c23