Skip to content

RequestRefactor hotkey throws an InternalError when calling $CommandSuite.RequestRefactor($PSCmdlet)  #1959

Closed
@ninmonkey

Description

@ninmonkey

Theorized Causes?

It seems to always be about a cancellation, and the UI was flickering back and forth.
Could the new quick fix feature be fighting for control with the PSES?

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest version
  • Search the existing issues.

Steps to reproduce

Refactor is crashing.

As far as I can tell I can't get more exception information (using powershell)

Location of the exception:

Documents\PowerShell\Modules\EditorServicesCommandSuite\1.0.0\EditorServicesCommandSuite.psm1

$null = $CommandSuite.RequestRefactor($PSCmdlet).
    ConfigureAwait($true).
    GetAwaiter().
    GetResult()

single exception

using a key with nothing bound to it other than this

   {        
        "key": "ctrl+k",
        "when": "editorLangId == 'powershell'",
        "command": "PowerShell.InvokeRegisteredEditorCommand",
        "args": {
            "commandName": "Invoke-DocumentRefactor"
        },
    },
    {
        "key": "ctrl+shift+s",
        "command": "PowerShell.InvokeRegisteredEditorCommand",
        "args": {
            "commandName": "ConvertTo-SplatExpression"
        },
        "when": "editorLangId == 'powershell'"
    },

to reproduce

import-module EditorServicesCommandSuite -Force
Import-CommandSuite
  • hit ctrl+shift+s to splat something ... it works
  • hit ctrl+k to refactor something ... exception

Expected behavior

Show the refactor menu

Actual behavior

The SplatExpression hotkey works
The Refactor one throws.

Error details

Environment data

Name                           Value
----                           -----
PSVersion                      7.3.0
PSEdition                      Core
GitCommitId                    7.3.0
OS                             Microsoft Windows 10.0.19045
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     1.0.0      beta4      EditorServicesCommandSuite          {Get-CommandSuiteSetting, New-CommandSuiteSettingF…
Script     0.2.0                 PowerShellEditorServices.Commands   {Clear-Host, ConvertFrom-ScriptExtent, ConvertTo-S…
Binary     0.2.0                 PowerShellEditorServices.VSCode     {Close-VSCodeHtmlContentView, New-VSCodeHtmlConten

Version

[email protected]

Visuals

image

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions