Awesome String Split
Split a string at the cursor using the same quote it was written with. Works in JS/TS/JSX/TSX.
- Inside
'...' or "..." : closes the current string, inserts + and a newline, then reopens with the same quote.
- Inside
`...` : inserts a newline (template literals are multiline-safe).
- Preserves current line indentation.
- Default keybinding: Shift+Enter.
Why
- Faster edits. Break long strings at the cursor without manual cutting, closing, and reopening quotes.
- Always valid. Ensures the result is syntactically correct (closes, concatenates, reopens) instead of leaving a broken string.
- Keeps style. Preserves the original quote type and indentation, avoiding lint/prettier churn and noisy diffs.
- Fewer mistakes. Reduces off-by-one and escaping errors that happen when splitting by hand.
- Template-literal aware. For backticks, just inserts a newline (multiline by design), or can be configured otherwise.
Before:
const msg =
"This is a very long message that I want to split here|and keep readable.";
After: (press Shift+Enter at the cursor)
const msg =
"This is a very long message that I want to split here" +
"and keep readable.";
Usage
- Place the caret inside a string.
- Press Shift+Enter (or run the command below).
Command
- Awesome String Split: split string at cursor
Command ID: awesomeStringSplit.splitAtCursor
Supported Languages
javascript , typescript , javascriptreact , typescriptreact
Known Limitations
- Detection is line-based; extremely exotic cases (e.g., unterminated strings) may fall back to a plain newline.
Installation
- From Marketplace (once published)
License
MIT
| |