You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Pasting multiline code conflicts with parentheses/brackets/brace-matching key handler #735
PS>{}
PS> 'hi'
hi
PS> }
At line:1 char:1
+ }
+ ~
Unexpected token '}' in expression or statement.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnexpectedToken
It seems that pasting triggers the same behaviors as when typing, which is undesired.
That is, the { that is pasted on the first line causes a matching } to be inserted, which breaks the code.
changed the title [-]Pasting multiline code is broken on Unix-like platforms[/-][+]Pasting multiline code conflicts with parentheses/brackets/brace-matching key handler[/+]on Jul 27, 2018
Activity
SeeminglyScience commentedon Jul 27, 2018
Is it possible this is a profile difference?
The first line
PS>{}makes me think you have this key handler from the sample profile registered.Same thing happens with me in all platforms with that key handler registered.
[-]Pasting multiline code is broken on Unix-like platforms[/-][+]Pasting multiline code conflicts with parentheses/brackets/brace-matching key handler[/+]mklement0 commentedon Jul 27, 2018
Patrick Meinecke (@SeeminglyScience):
Great sleuthing, thank you.
Indeed, that was the problem and with that key handler in place it indeed also happens on Windows.
I've updated the original post.
Jason Shirk (@lzybkr):
Is there a way we can have our cake and eat it too?
I would't want to have to choose between the two features (pasting multiline snippets vs. paren/bracket/brace matching).
Or can you for technical reasons not tell the difference between code being typed vs. being pasted?
SeeminglyScience commentedon Jul 27, 2018
That's right unfortunately, unless the paste is handled via a key handler. #579 is tracking that.
mklement0 commentedon Jul 27, 2018
Thanks, Patrick Meinecke (@SeeminglyScience) - I've added a comment there and I'm closing this.