Skip to content

Commit 07dccc4

Browse files
committed
Merge origin/master into current branch
2 parents 00d437a + baf10a6 commit 07dccc4

25 files changed

+7011
-1383
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Node.js CI
1+
name: CI
22

33
on:
44
push:
@@ -19,16 +19,16 @@ jobs:
1919
runs-on: ${{ matrix.os }}
2020
steps:
2121
- name: Checkout
22-
uses: actions/checkout@v2
23-
- name: Setup Node.js
24-
uses: actions/setup-node@v1
22+
uses: actions/checkout@v4
2523
with:
26-
node-version: 18.13.0
24+
ref: ${{ github.ref }}
25+
- name: Setup Node.js
26+
uses: actions/setup-node@v4
2727
- name: Install dependencies
2828
run: npm install
2929
- name: Build package
3030
run: npm run build
3131
- name: Run headless test
32-
uses: GabrielBB/xvfb-action@v1.0
32+
uses: coactions/setup-xvfb@v1
3333
with:
3434
run: npm test
Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,35 @@
1-
name: "Publish to VS Code Marketplace"
1+
name: "Publish to Marketplace"
22

33
on:
4-
push:
5-
branches:
6-
- master
4+
workflow_run:
5+
workflows: ["CI"]
6+
types: [completed]
7+
branches: [master]
78

89
jobs:
910
cd:
11+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
1012
runs-on: ubuntu-latest
1113
permissions:
1214
contents: write
1315
steps:
1416
- name: Checkout to branch
1517
uses: actions/checkout@v4
18+
with:
19+
ref: ${{ github.ref }}
1620

1721
- name: Setup node.js
1822
uses: actions/setup-node@v4
19-
with:
20-
node-version: 20
2123

2224
- name: "Bump version"
23-
uses: 'phips28/gh-action-bump-version@master'
25+
uses: "phips28/gh-action-bump-version@master"
2426
env:
2527
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
2628
with:
27-
minor-wording: 'MINOR'
28-
major-wording: 'MAJOR'
29-
patch-wording: 'PATCH,FIX'
30-
rc-wording: 'RELEASE'
29+
minor-wording: "MINOR"
30+
major-wording: "MAJOR"
31+
patch-wording: "PATCH,FIX"
32+
rc-wording: "RELEASE"
3133

3234
- name: Install packages
3335
run: npm ci
@@ -45,13 +47,28 @@ jobs:
4547
- name: Build VSIX package
4648
run: npm run package -- -o vscode-string-manipulation.v${{ steps.calculateVersion.outputs.AppVersion }}.vsix
4749

48-
- name: Publish extension package
50+
- name: Publish extension package to Marketplace
4951
env:
5052
VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }}
5153
run: npm run vsce -- publish -p $VSCE_TOKEN
5254

55+
- name: Publish extension package to Open VSX Registry
56+
env:
57+
OVSX_PAT: ${{ secrets.OVSX_PAT }}
58+
run: npm run ovsx -- publish -p $OVSX_PAT
59+
5360
- uses: actions/upload-artifact@v4
5461
name: Upload artifact
5562
with:
5663
name: vscode-string-manipulation.v${{ steps.calculateVersion.outputs.AppVersion }}.vsix
5764
path: vscode-string-manipulation.v${{ steps.calculateVersion.outputs.AppVersion }}.vsix
65+
66+
- name: Create GitHub Release
67+
uses: softprops/action-gh-release@v1
68+
with:
69+
tag_name: v${{ steps.calculateVersion.outputs.AppVersion }}
70+
name: Release v${{ steps.calculateVersion.outputs.AppVersion }}
71+
files: vscode-string-manipulation.v${{ steps.calculateVersion.outputs.AppVersion }}.vsix
72+
generate_release_notes: true
73+
env:
74+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CLAUDE.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Development Commands
6+
7+
### Build and Compilation
8+
- `npm run build` - Full production build with type checking and linting
9+
- `npm run compile` - Development build with type checking and linting
10+
- `npm run watch` - Watch mode for development with parallel processes
11+
- `npm run check-types` - Type checking only
12+
- `npm run lint` - ESLint code linting
13+
14+
### Testing
15+
- `npm test` - Run all tests (includes compilation, linting, and test execution)
16+
- `npm run pretest` - Prepare for testing (compile, build, lint)
17+
- `npm run compile-tests` - Compile TypeScript tests to JavaScript
18+
- `npm run watch-tests` - Watch mode for test compilation
19+
20+
### Packaging
21+
- `npm run package` - Create VSIX package for distribution
22+
- `npm run vsce` - Direct vsce command access
23+
24+
## Architecture Overview
25+
26+
This is a VSCode extension that provides string manipulation commands for text editing. The extension follows a modular command-based architecture:
27+
28+
### Core Structure
29+
- **Main Extension**: `src/extension.ts` - Entry point that activates string manipulation commands, preview functionality, and optional sidebar
30+
- **Command Registry**: `src/commands/index.ts` - Central registry that maps command names to functions and handles command execution
31+
- **Command Modules**: Individual files in `src/commands/` for specialized functionality:
32+
- `default-functions.ts` - Basic string transformations using underscore.string
33+
- `increment-decrement.ts` - Number manipulation commands
34+
- `sequence.ts` - Number sequencing functionality
35+
- `title-case.ts` - Specialized title casing (AP Style, Chicago Style)
36+
- `preview.ts` - Live preview functionality for transformations
37+
- `sidebar.ts` - Optional webview sidebar (Labs feature)
38+
39+
### Command System
40+
The extension registers VSCode commands dynamically from the `commandNameFunctionMap` registry. Each command:
41+
1. Gets active editor selections
42+
2. Applies transformation function to selected text
43+
3. Replaces selections with transformed text
44+
4. Stores last action for repeat functionality
45+
46+
### Key Features
47+
- **Multi-selection support**: All commands work with multiple text selections
48+
- **Preview mode**: Live preview of transformations before applying
49+
- **Argument-based commands**: Some commands (like `chop`, `truncate`) prompt for numeric arguments
50+
- **Duplicate operations**: Special handling for duplicate-and-increment/decrement commands
51+
- **Labs features**: Experimental features behind a configuration flag
52+
53+
### Build System
54+
Uses esbuild for fast bundling with TypeScript compilation. The build outputs to `dist/extension.js` as a CommonJS bundle suitable for VSCode.
55+
56+
### Testing
57+
Tests are located in `src/test/` and use the VSCode testing framework with Mocha.

README.md

Lines changed: 78 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,98 @@
1-
![Node.js CI](https://github.com/marclipovsky/vscode-string-manipulation/workflows/Node.js%20CI/badge.svg)
1+
![CI](https://img.shields.io/github/actions/workflow/status/marclipovsky/vscode-string-manipulation/ci.yml) ![open vsx](https://img.shields.io/open-vsx/v/marclipovsky/string-manipulation) ![VS Marketplace Installs](https://img.shields.io/visual-studio-marketplace/i/marclipovsky.string-manipulation) ![VS Marketplace Downloads](https://img.shields.io/visual-studio-marketplace/d/marclipovsky.string-manipulation) ![VS Marketplace Stars](https://img.shields.io/visual-studio-marketplace/stars/marclipovsky.string-manipulation) ![VS Marketplace Rating](https://img.shields.io/visual-studio-marketplace/r/marclipovsky.string-manipulation) ![VS Marketplace Version](https://img.shields.io/visual-studio-marketplace/v/marclipovsky.string-manipulation)
22

3-
# String Manipulation for VSCode
3+
> **📢 Now available on Cursor!**
4+
5+
# String Manipulation for VSCode & Cursor
46

57
This extension provides string manipulation commands for any selected text as well
68
as multiple selections.
79

810
Current string functions available:
911

10-
1. camelize
11-
1. capitalize
12-
1. classify
13-
1. chop - split into groups provided n # of characters
14-
1. clean
15-
1. clean diacritics
16-
1. dasherize
17-
1. decapitalize
18-
1. humanize
19-
1. reverse
20-
1. screaming snake
21-
1. sentence
22-
1. slugify
23-
1. snake
24-
1. underscore
25-
1. swap case
26-
1. titleize
27-
1. titleize (AP Style)
28-
1. titleize (Chicago Style)
12+
1. camelize - converts hyphenated strings to camelCase
13+
1. capitalize - capitalizes the first character of each selection
14+
1. classify - converts underscored text to PascalCase
15+
1. chop - splits into groups provided n # of characters
16+
1. clean - collapses multiple spaces into one
17+
1. clean diacritics - removes diacritic marks from characters
18+
1. dasherize - converts camelCase to kebab-case
19+
1. decapitalize - lowercases the first character of each selection
20+
1. humanize - converts text to human-readable form
21+
1. reverse - reverses the characters in the selection
22+
1. screaming snake - converts text to SCREAMING_SNAKE_CASE
23+
1. sentence - transforms text to sentence case
24+
1. slugify - converts text to a URL-friendly slug
25+
1. snake - converts text to snake_case
26+
1. swap case - inverts the case of each character
27+
1. titleize - capitalizes the first letter of each word
28+
1. titleize (AP Style) - capitalizes titles according to AP style
29+
1. titleize (Chicago Style) - capitalizes titles according to Chicago style
2930
1. truncate - trims string to n # of characters and appends ellipsis
3031
1. prune - truncate but keeps ellipsis within character count provided
31-
1. repeat - repeat selection n #of times
32-
1. convert between unicode and readable characters.
32+
1. repeat - repeat selection n # of times
33+
1. random case - randomly changes the case of characters
34+
1. swap quotes - swaps between single and double quotes
35+
1. utf8ToChar - converts Unicode escapes to characters
36+
1. charToUtf8 - converts characters to Unicode escapes
3337

3438
Number related functions:
3539

36-
1. increment all numbers in selection
37-
1. decrement all numbers in selection
38-
1. duplicate selection and increment all number
39-
1. duplicate selection and decrement all number
40-
1. sequence all numbers in selection from first number
40+
1. increment - increases all numbers in the selection by 1
41+
1. decrement - decreases all numbers in the selection by 1
42+
1. duplicate and increment - duplicates selection and increments all numbers
43+
1. duplicate and decrement - duplicates selection and decrements all numbers
44+
1. sequence - replaces numbers with a sequence starting from the first number
45+
1. incrementFloat - increases all floating point numbers in the selection by 1
46+
1. decrementFloat - decreases all floating point numbers in the selection by 1
47+
48+
Additional utility commands:
49+
50+
1. repeat last action - repeats the last string manipulation command that was executed
4151

4252
## Use
4353

4454
To use these commands, press ⌘+p and enter any of the commands above while text is selected in your editor.
4555

4656
![String Manipulation Screencast](images/demo.gif)
4757

58+
## Preview Transformations
59+
60+
The extension now includes a powerful preview feature that allows you to see how each transformation will affect your text before applying it.
61+
62+
### How to Use the Preview Feature
63+
64+
1. Select the text you want to transform
65+
2. Right-click to open the context menu
66+
3. Choose "Show Transformations with Preview"
67+
4. Browse through the available transformations with instant previews
68+
5. Select a transformation to apply it to your text
69+
70+
This feature makes it easier to find the right transformation without trial and error.
71+
72+
![String Manipulation Preview Feature](images/preview-demo.gif)
73+
74+
## 🧪 Introducing Labs Features
75+
76+
Introducing String Manipulation Labs
77+
78+
We're excited to announce the launch of String Manipulation Labs—a collection of (really just one at this moment) experimental features designed to enhance and expand the capabilities of the String Manipulation extension. Labs features are disabled by default to ensure a stable experience with the core functionalities.
79+
80+
### 🚀 How to Enable Labs Features
81+
82+
To try out the new Labs features, follow these simple steps:
83+
84+
1. Open VSCode Settings:
85+
• Press Ctrl + , (Windows/Linux) or Cmd + , (macOS), or navigate to File > Preferences > Settings.
86+
2. Search for Labs Settings:
87+
• In the search bar, type stringManipulation.labs.
88+
3. Enable Labs Features:
89+
• Toggle the String Manipulation Labs setting to On.
90+
91+
### 🛠️ We Value Your Feedback
92+
93+
Since Labs features are experimental, your feedback is invaluable! Let us know your thoughts, report any issues, or suggest improvements to help us refine these tools.
94+
95+
Thank you for using String Manipulation!
96+
Your support helps us build better tools for the community.
97+
4898
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

content.txt

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
moz-transform
2+
-moz-transform
3+
foo Bar
4+
foo bar
5+
ääkkönen
6+
foo Bar
7+
some_class_name
8+
MozTransform
9+
Foo Bar
10+
capitalize dash-CamelCase_underscore trim
11+
Abc
12+
Un éléphant à l'orée du bois
13+
HELLOworld
14+
This-is_snake case
15+
screaming-snake case
16+
my name is tristan
17+
this is a test
18+
The quick brown fox jumps over the lazy dog.
19+
Underscored-is-like snake-case
20+
aabbccdd
21+
aabbccdd
22+
aabbccddaabbccdd
23+
aabbccdd
24+
a1 b2 c3 4d 5e 6f 12x y23 34z45
25+
a1 b2 c3 4d 5e
26+
6f 12x y23 34z45
27+
a-4 b-3 c-2 -1d 0e
28+
6f 12x y23 34z45
29+
a1 b2 c3 4d 5e 6f 12x y23 34z45
30+
a1 b2 c3 4d
31+
5e 6f 12x y23 34z45
32+
a-3 b-2 c-1 0d
33+
1e 6f 12x y23 34z45
34+
a1 b2 c3 4d 5e 6f 12x y23 34z45
35+
36+
a1 b2 c3 4d 5e 6f 12x y23 34z45
37+
38+
a1 b2 c3 4d 5e 6f 12x y23 34z45
39+
a14 b2 c3
40+
4d 5e 6f 7x y8 9z12
41+
\u0061\u0062\u0063\u4e2d\u6587\ud83d\udc96
42+
abc中文💖
43+
Hello, World!
44+
12345!@#$%
45+
Test123!
46+
'She said, "Hello"'
47+
"My name's Minalike"
48+
"He said, 'It's a trap!'"
49+
'She exclaimed, \"Wow!\"'
50+
"'Double' and 'single' quotes"
51+
No quotes at all
52+
'It's'
53+
"My name's %20 Minalike!"
54+
Lorem -1.234 ipsum 5.678 dolor sit amet, consectetur adipiscing.
55+
Sed do 9.876 eiusmod -4.321 tempor incididunt labore.
56+
abc009 def010 ghi001
57+
test001 value99 number000
58+
prefix007 suffix008 middle009
59+
009 010 001
60+
001 99 000
61+
007 008 009
62+
0009 0010 0001
63+
0001 0099 0000
64+
0007 0008 0009
65+
test01 value100 prefix007 99
66+
02 100 4
67+
010 100 123
68+
a001 b1
69+
c1 d01 e1
70+
f1 g1
71+
multi1 line2
72+
test3 data4

0 commit comments

Comments
 (0)