Skip to content

Cursor moving up a line after hitting return in a large script #1154

Open
@JamesLear92

Description

@JamesLear92

System Details

  • Operating system name and version: Windows 10 Enterprise Edition, 1703, 15063.726, 64Bit
  • VS Code version: 1.19.1
  • PowerShell extension version: 1.5.1
  • Output from $PSVersionTable:
    PS U:> $PSVersionTable

Name Value


PSVersion 5.1.15063.726
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.15063.726
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Copy / paste the following commands into the PowerShell Integrated Console, and paste the output here:

PS C:\Users\Me\Desktop\Powershell\UnsavedScripts> code -v
1.19.1
0759f77bb8d86658bc935a10a64f6182c5a1eeba
x64
PS C:\Users\Me\Desktop\Powershell\UnsavedScripts> $pseditor.EditorServicesVersion
Major  Minor  Build  Revision
-----  -----  -----  --------
1      5      1      0


PS C:\Users\Me\Desktop\Powershell\UnsavedScripts> code --list-extensions --show-versions
GrapeCity.gc-excelviewer@2.0.16
ms-vscode.PowerShell@1.5.1
PS C:\Users\Me\Desktop\Powershell\UnsavedScripts> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.15063.726
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.15063.726
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

Imagine a simple function like:

Function Get-GCD
{
    while ($y -ne 0)
    {
        $x, $y = $y, ($x % $y)
    }
    [Math]::abs($x)
}

Now, if I try to add a param, one of two things happen.
Situation one:
I am adding param to this exact function in a very small script, I type "param" and hit enter, it adds a new line and I type ( and hit enter.
image
Perfect!
Situation two:
I am adding param to this exact function in a very large lengthy script, I type "param" and hit enter, it adds a new line, then moves the cursor position back so that it is on the same line as param and also does not auto complete the closing parentheses.
image

This isn't just for parameters, I'm having some real problems with the text cursor being moved up again after hitting enter in large scripts.

I have the following user settings:

{
    "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
    "powershell.enableProfileLoading": true,
    "powershell.scriptAnalysis.enable": true,
    "powershell.startAutomatically": true,
    "powershell.integratedConsole.focusConsoleOnExecute": false,
    "powershell.codeFormatting.openBraceOnSameLine": false,
    "editor.formatOnType": true,
    "editor.formatOnPaste": true,
    "editor.folding": true,
    "editor.acceptSuggestionOnEnter": "off",
    "window.menuBarVisibility": "toggle",
    "files.defaultLanguage": "powershell",
    "explorer.confirmDelete": false,
    "explorer.confirmDragAndDrop": false
}

If I had to guess, I'd point towards the whole reference count thing causing problems, but that's just speculation.

Attached Logs

Follow the instructions in the README
about capturing and sending logs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions