Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
JamesLear92 opened this issue Jan 8, 2018 · 1 comment
Open

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

JamesLear92 opened this issue Jan 8, 2018 · 1 comment
Labels

Comments

@JamesLear92
Copy link

JamesLear92 commented Jan 8, 2018

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.

@JamesLear92 JamesLear92 changed the title Return lines being removed automatically in very large scripts. Cursor moving up a line after hitting return in a large script Jan 8, 2018
@TylerLeonhardt
Copy link
Member

Hey @Omniusz, thanks for this report! Can you do us a favor and upload the logs for when you see this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants