Skip to content

Commit 57e9e11

Browse files
theaquamarinedaxian-dbw
authored andcommitted
Allow SmartInsertQuote to insert pair of quotes when cursor is at a closing brace (#1288)
1 parent 958ce3a commit 57e9e11

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

PSReadLine/SamplePSReadLineProfile.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ Set-PSReadLineKeyHandler -Key '"',"'" `
187187
}
188188
}
189189

190-
if ($null -eq $token) {
190+
if ($null -eq $token -or
191+
$token.Kind -eq [TokenKind]::RParen -or $token.Kind -eq [TokenKind]::RCurly -or $token.Kind -eq [TokenKind]::RBracket) {
191192
if ($line[0..$cursor].Where{$_ -eq $quote}.Count % 2 -eq 1) {
192193
# Odd number of quotes before the cursor, insert a single quote
193194
[Microsoft.PowerShell.PSConsoleReadLine]::Insert($quote)

0 commit comments

Comments
 (0)