Join Lines with Comma
Author: Mujeeb · Version: 1.0.0
Join lines into one comma-separated line. The values can be anything: numbers, strings, dates, IDs.
1
2
3
4
5
becomes
1,2,3,4,5
How to use it
Join Lines with Comma (Command Palette, or right-click a selection). It joins the selected lines, or the whole editor when nothing is selected, in place.
Join Lines with Comma, Quoted puts quotes around each value, ready for a SQL IN (...) list:
apple
New York
O'Brien
becomes 'apple','New York','O''Brien'. A quote inside a value is doubled, as SQL and CSV escape it.
Join Clipboard Lines with Comma joins what's on the clipboard, in place. Copy a column from a spreadsheet or psql output, run it, paste.
Each line is one value. Spaces at the start and end of a line are removed, blank lines are skipped, and anything else in the line (spaces, commas, quotes) is kept as it is. With several selections, each one is joined on its own. One undo (⌘Z / Ctrl+Z) brings the lines back.
When you select whole lines, the line break at the end is kept, so the line after the selection stays on its own line.
To run a command with a key, open Keyboard Shortcuts and search for "Join Lines with Comma".
Settings
| Setting |
Default |
What it does |
joinLinesWithComma.separator |
, |
Put between the values. Use , for a space after each comma. |
joinLinesWithComma.quote |
' |
Put around each value by the Quoted command, such as ". |
Build and test
npm install
npm run test:unit
npm run test:integration # opens a separate VS Code window
npm run package # writes ../join-lines-with-comma-1.0.0.vsix
Release
Bump version in package.json, add the changes to CHANGELOG.md, commit, then push a matching tag. The Publish workflow runs the unit tests and publishes to the Marketplace.
git tag v1.0.1
git push origin v1.0.1
License
MIT. The full text is in the LICENSE file.