Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
ecmaVersion: 2020,
sourceType: 'module'
},
plugins: ['@typescript-eslint'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended'
],
rules: {
// keep default rules; you can customize as needed
}
};
92 changes: 76 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,91 @@
# Advanced Paste as String Array

![CI](https://github.com/koraybilgi/vscode-paste-as-string-array/actions/workflows/ci.yaml/badge.svg)

**Paste anything — instantly format it as a string array.**
This VS Code extension converts whatever you've copied into a clean, ready-to-use **string array**, complete with your chosen delimiter and quote style.

# paste-as-string-array
![CI](https://github.com/shadyboukhary/vscode-paste-as-string-array/actions/workflows/ci.yaml/badge.svg)
Perfect for developers who frequently transfer data from spreadsheets, logs, or file systems into code.

Tired of having to convert command line arguments to an array of strings for use in `launch.json` in VSCode? You're not alone. This extension solves this issue by automatically converting arguments to fit VSCode expectations.
---

## Features
## ✨ What It Does

### Paste As String Array
Copy text from virtually any source:

Simply execute the `Paste as String Array` command in Ctrl+shift+P or use the following shortcuts
* Excel or Google Sheets
* Multi-line strings
* Single-line inputs
* Terminal output
* OS folder contents
* File lists, URLs, logs, etc.

* Windows: Ctrl+Alt+V
* Linux: Ctrl+Alt+V
* MacOS: Cmd+Shift+V

It will convert an example cmdline from this:
Then paste it as a neatly formatted string array, for example:

```
--arg1 1 --arg2 2 --arg3 3 --args4 1 2 3 test --args5 test1 test2 test3 test4
'First', 'Second', 'Third', 'And The Last Item'
```

To this
```
"--arg1","1","--arg2","2","--arg3","3","--args4","1","2","3","test","--args5","test1","test2","test3","test4"
No more manual find/replace — just paste and code.

### Supported Options

* **Quote style:** single `' '` or double `" "`
* **Separator:** whitespace, newline, or custom
* **Prompt before pasting:** use default settings or choose options each time.

---

## 🚀 Usage

### 1- Context Menu

Right-click inside the editor and select:
`Paste As` > `String Array`

### 2- Command Palette

Run:
`Paste as String Array`

### 3- Editor Title Button

A dedicated poop ( <img src="./images/poop.png" alt="Poop Icon" style="width:20px; vertical-align: sub"/> ) button appears in the editor title for quick access.


---
## ⚙️ Settings

You can customize output preferences in `settings.json`:

```jsonc
{
// Default quote style: ["double", "single"]
"paste-as-string-array.defaultQuote": "single",
// Default separator: ["whitespace", "newline", "special"]
"paste-as-string-array.defaultSeparator": "newline",
// Works only if defaultSeparator is "special"
"paste-as-string-array.defaultSpecialSeparator": ",",
// Default paste format: ["single", "multi"]
"paste-as-string-array.defaultFormat": "single",
// Show quote style options when pasting
"paste-as-string-array.promptForQuote": true,
// Show separator options when pasting
"paste-as-string-array.promptForSeparator": true,
// Show format options when pasting
"paste-as-string-array.promptForFormat": true
}
```

---
## 🧪 CI & Reliability

This extension is continuously validated with GitHub Actions to ensure consistent behavior across platforms.

![CI](https://github.com/koraybilgi/vscode-paste-as-string-array/actions/workflows/ci.yaml/badge.svg)

---

### Derived From

![Extension in action](./resources/animation.gif)
This extension is originally based on **ShadyBoukhary**’s [vscode-paste-as-string-array](https://github.com/ShadyBoukhary/vscode-paste-as-string-array) and has been enhanced with additional features and improvements.
29 changes: 29 additions & 0 deletions eslint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module.exports = [
// ignore build artifacts
{
ignores: ['out/**', 'node_modules/**']
},
// TypeScript files
{
files: ['**/*.ts'],
languageOptions: {
parser: require('@typescript-eslint/parser'),
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
ecmaVersion: 2020,
sourceType: 'module'
}
},
plugins: {
'@typescript-eslint': require('@typescript-eslint/eslint-plugin')
},
rules: {
// Keep a minimal set of sensible rules; you can expand this later.
'no-console': 'off',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': ['warn', { 'argsIgnorePattern': '^_' }],
'@typescript-eslint/naming-convention': 'off'
}
}
];
Binary file added images/icon-128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon-256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/poop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
143 changes: 113 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,61 +1,144 @@
{
"name": "paste-as-string-array",
"displayName": "Paste as String Array",
"description": "Paste text as string array",
"publisher": "shadyboukhary",
"name": "advanced-paste-as-string-array",
"displayName": "Advanced Paste as String Array",
"icon": "images/icon.png",
"description": "Paste text as string array with single or double quotes, line breaks and commas.",
"publisher": "koraybilgi",
"repository": {
"url": "https://github.com/ShadyBoukhary/vscode-paste-as-string-array"
"url": "https://github.com/koraybilgi/vscode-paste-as-string-array"
},
"author": {
"name": "Shady Boukhary",
"email": "sb199898.sb@gmail.com"
"name": "Koray Bilgi",
"email": "kbilgi@meeticore.com"
},
"version": "1.0.0",
"version": "1.0.3",
"engines": {
"vscode": "^1.71.0"
},
"categories": [
"Other"
],
"activationEvents": [
"onCommand:paste-as-string-array.pasteAsStringArray"
],
"main": "./out/extension.js",
"contributes": {
"commands": [
{
"command": "paste-as-string-array.pasteAsStringArray",
"title": "Paste as String Array"
"command": "advanced-paste-as-string-array.pasteAsStringArray",
"title": "Paste as String Array",
"category": "Paste As",
"icon": {
"light": "resources/icon-light.svg",
"dark": "resources/icon-dark.svg"
}
},
{
"command": "advanced-paste-as-string-array.pasteAsStringArray.short",
"title": "String Array",
"category": "Paste As",
"icon": {
"light": "resources/icon-light.svg",
"dark": "resources/icon-dark.svg"
}
}
],
"keybindings":[
"submenus": [
{
"command": "paste-as-string-array.pasteAsStringArray",
"key": "ctrl+alt+v",
"mac": "shift+cmd+v",
"linux": "ctrl+alt+v"
"id": "advanced-paste-as-string-array.pasteAs",
"label": "Paste As"
}
],
"menus": {
"editor/context": [
{
"submenu": "advanced-paste-as-string-array.pasteAs",
"when": "editorTextFocus"
}
],
"editor/title": [
{
"submenu": "advanced-paste-as-string-array.pasteAs",
"when": "editorTextFocus",
"group": "navigation"
}
],
"explorer/context": [
{
"submenu": "advanced-paste-as-string-array.pasteAs",
"when": "resourceLangId == plaintext || resourceLangId == markdown || explorerViewletVisible",
"group": "navigation"
}
],
"advanced-paste-as-string-array.pasteAs": [
{
"command": "advanced-paste-as-string-array.pasteAsStringArray.short",
"when": "editorTextFocus"
}
]
}
,
"configuration": {
"type": "object",
"title": "Paste as String Array",
"properties": {
"paste-as-string-array.promptForQuote": {
"type": "boolean",
"default": true,
"description": "Show a dropdown to pick single or double quotes when pasting."
},
"paste-as-string-array.defaultQuote": {
"type": "string",
"enum": ["double", "single"],
"default": "double",
"description": "Default quote style to use when not prompting."
}
,
"paste-as-string-array.promptForSeparator": {
"type": "boolean",
"default": true,
"description": "Show a dropdown to pick the separator (whitespace, new line, or special character)."
},
"paste-as-string-array.defaultSeparator": {
"type": "string",
"enum": ["whitespace", "newline", "special"],
"default": "whitespace",
"description": "Default separator to use when not prompting."
},
"paste-as-string-array.defaultSpecialSeparator": {
"type": "string",
"default": ",",
"description": "Default special separator string to use when defaultSeparator is 'special'."
}
}
]
}
},
"activationEvents": [
"onCommand:paste-as-string-array.pasteAsStringArray",
"onCommand:paste-as-string-array.pasteAsStringArray.short"
],
"scripts": {
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"pretest": "npm run compile && npm run lint",
"lint": "eslint src --ext ts",
"test": "node ./out/test/runTest.js"
"test": "node ./out/test/runTest.js",
"vsix": "npx vsce package",
"package:vsix": "npm run compile && npx vsce package"
},
"devDependencies": {

"@types/mocha": "^10.0.10",
"@types/node": "^24.10.1",
"@types/vscode": "^1.71.0",
"@types/glob": "^7.2.0",
"@types/mocha": "^9.1.1",
"@types/node": "16.x",
"@typescript-eslint/eslint-plugin": "^5.31.0",
"@typescript-eslint/parser": "^5.31.0",
"eslint": "^8.20.0",
"glob": "^8.0.3",
"mocha": "^10.0.0",
"typescript": "^4.7.4",
"@vscode/test-electron": "^2.1.5"
"@typescript-eslint/eslint-plugin": "^8.48.1",
"@typescript-eslint/parser": "^8.48.1",
"@vscode/test-electron": "^2.1.5",
"eslint": "^9.39.1",
"glob": "^13.0.0",
"mocha": "^11.7.5",
"typescript": "^5.9.3"
},
"dependencies": {
"@types/minimatch": "^6.0.0",
"minimatch": "^10.1.1"
}
}
24 changes: 24 additions & 0 deletions resources/icon-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions resources/icon-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading