Parameter and argument completion broken
See original GitHub issueIssue Type: Bug
When a function parameter uses a PS-defined enum as datatype, parameter and argument completion are broken on the editor pane where the function was defined (even though the syntax displays correctly). The issue is not present on other opened editor panes or the console.
Try this code:
enum Cities
{
Hannover
Redmond
NewYork
}
function Test-It
{
param
(
[Cities]
$City
)
$PSBoundParameters
}
Expected result:
When entering “Test-It -” and pressing CTRL
+SPACE
, there should be completion for parameter -City, then completion for arguments.
Actual result:
On the same editor pane where the function is defined, regardless of whether the code was run or not, there is no completion for parameter or arguments. The parameter completion list does not even contain the parameter and lists only standard entries.
When the code was run, the completion works for console and other editor panes, but never for the editor pane that defines the function.
Suspected Trigger:
The problem occurs once a parameter is using a PS-defined enum. When changing the data type from [Cities] to any non-PS-enum type like [ConsoleColor], there is no issue and all works fine. (using PS7.0.0 and editorservices 2020.3.0)
Extension version: 2020.3.0 VS Code version: Code 1.42.1 OS version: Windows_NT x64 10.0.18363
System Info
Item | Value |
---|---|
CPUs | Intel® Core™ i7-1065G7 CPU @ 1.30GHz (8 x 1498) |
GPU Status | 2d_canvas: enabled flash_3d: enabled flash_stage3d: enabled flash_stage3d_baseline: enabled gpu_compositing: enabled metal: disabled_off multiple_raster_threads: enabled_on oop_rasterization: disabled_off protected_video_decode: enabled rasterization: enabled skia_renderer: disabled_off surface_control: disabled_off surface_synchronization: enabled_on video_decode: enabled viz_display_compositor: enabled_on viz_hit_test_surface_layer: disabled_off webgl: enabled webgl2: enabled |
Load (avg) | undefined |
Memory (System) | 31.77GB (20.84GB free) |
Process Argv | |
Screen Reader | no |
VM | 0% |
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (4 by maintainers)
Top GitHub Comments
I moved the issue over to the powershell team: https://github.com/PowerShell/PowerShell/issues/12079
For VSCode this is definitely no issue. Thanks for looking into this Tyler! Your test approach using tabexpansion2 directly was very helpful.
No in fact with the attribute example, this first surfaced in the ISE. Don’t know why the trainees moved back to ISE in the latter case, it is definitely editor-agnostic.
It must be related to how PowerShell parses the code. There is a slight difference: with the enum example, this messes up parameter completion altogether. With the completer attribute, only the completion results are messed up.
Should I open a case in the PowerShell repo?