Skip to content

Commit

Permalink
fix(escapeIfInString): correctly fix unterminated string
Browse files Browse the repository at this point in the history
  • Loading branch information
zardoy committed Oct 6, 2022
1 parent 86c6e0e commit d29b23e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/features/tsPluginIntegrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default () => {
builder.insert(posBefore, '\\')
})
})
const { text: newText, endPos } = await getNormalizedNodeAtPosition(offset + 1)
const { text: newText } = await getNormalizedNodeAtPosition(offset + 1)
// unterminated string, let's fix it
if (kindName === 'StringLiteral' && !newText.endsWith("'")) {
await new Promise<void>(resolve => {
Expand All @@ -50,7 +50,7 @@ export default () => {
})
void editor.edit(
builder => {
builder.insert(endPos, "'")
builder.insert(editor.selection.active, "'")
},
{ undoStopBefore: false, undoStopAfter: true },
)
Expand Down

0 comments on commit d29b23e

Please sign in to comment.