Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
a1ad9b4
Add random case command fixes #54
exceptionraiser Oct 7, 2024
b808086
Merge pull request #55 from marclipovsky/feature/random-case
Oct 7, 2024
ff1b7dc
ci: version bump to 0.7.6
gh-action-bump-version Oct 7, 2024
0d91ce6
Simplify activationEvents and tests that activationEvents trigger cor…
exceptionraiser Oct 12, 2024
c6e674e
Add webview under the explorer panel that display all command outputs…
exceptionraiser Oct 13, 2024
e1c99e8
Created "labs" settings toggle and put sidebar panel visibility behin…
exceptionraiser Oct 13, 2024
1b1d6ca
Merge pull request #56 from marclipovsky/feature/sidebar-preview
Oct 13, 2024
e2f078f
ci: version bump to 0.7.7
gh-action-bump-version Oct 13, 2024
6de1d1c
Update readme with labs section
exceptionraiser Oct 13, 2024
5c91b1b
ci: version bump to 0.7.8
gh-action-bump-version Oct 13, 2024
f3bed00
Rewrite tests to actually test selection of a document and then execu…
exceptionraiser Oct 18, 2024
ef61771
ci: version bump to 0.7.9
gh-action-bump-version Oct 18, 2024
f229753
Remove new lines to validate tests across platforms better (windows s…
exceptionraiser Oct 18, 2024
287ccfa
ci: version bump to 0.7.10
gh-action-bump-version Oct 18, 2024
ea586df
Run CI if tests complete
exceptionraiser Oct 18, 2024
daa9df5
ci: version bump to 0.7.11
gh-action-bump-version Oct 18, 2024
0c70525
ci: version bump to 0.7.12
gh-action-bump-version Oct 18, 2024
77f4b45
Revert "Remove new lines to validate tests across platforms better (w…
exceptionraiser Oct 18, 2024
9d4882b
Fix stripping new lines from test results
exceptionraiser Oct 18, 2024
9a4ec74
ci: version bump to 0.7.13
gh-action-bump-version Oct 18, 2024
c3b935f
ci: version bump to 0.7.14
gh-action-bump-version Oct 18, 2024
d59d24b
Run publish action if CI completes and branch is master
exceptionraiser Oct 18, 2024
0e65cdc
ci: version bump to 0.7.15
gh-action-bump-version Oct 18, 2024
4c171e4
Add swap case and tests cases
exceptionraiser Oct 19, 2024
0af3069
Add swap quotes command and update test case names.
exceptionraiser Oct 19, 2024
62a70bd
Enable swapQuotes behind labs flag
exceptionraiser Oct 19, 2024
c60ed04
ci: version bump to 0.7.16
gh-action-bump-version Oct 19, 2024
3fa3a39
ci: version bump to 0.7.17
gh-action-bump-version Oct 19, 2024
c7590ee
Update actions to latest versions
exceptionraiser Oct 19, 2024
6bc2a4e
ci: version bump to 0.7.18
gh-action-bump-version Oct 19, 2024
e4803c6
Set node version for coactions/setup-xvfb action
exceptionraiser Oct 19, 2024
710e681
ci: version bump to 0.7.19
gh-action-bump-version Oct 19, 2024
d2a97e3
Revert "Set node version for coactions/setup-xvfb action"
exceptionraiser Oct 19, 2024
9f557a4
ci: version bump to 0.7.20
gh-action-bump-version Oct 19, 2024
2265c7b
Remove swap quotes from behind labs field.
exceptionraiser Oct 19, 2024
4846be1
ci: version bump to 0.7.21
gh-action-bump-version Oct 19, 2024
6081a94
Attemping to only run publish if current branch is master
exceptionraiser Oct 19, 2024
4a9fccf
ci: version bump to 0.7.22
gh-action-bump-version Oct 19, 2024
8f8f440
Ensure actions are getting current branch
exceptionraiser Oct 19, 2024
f46bb4a
ci: version bump to 0.7.23
gh-action-bump-version Oct 19, 2024
2ce721c
Only run publish workflow if CI workflow was successful on master
exceptionraiser Oct 19, 2024
2f4034c
ci: version bump to 0.7.24
gh-action-bump-version Oct 19, 2024
99d073e
Merge pull request #57 from marclipovsky/feature/swap-case
Oct 19, 2024
6d71354
ci: version bump to 0.7.25
gh-action-bump-version Oct 19, 2024
8c1c213
build(deps-dev): bump undici from 6.19.8 to 6.21.1
dependabot[bot] Jan 21, 2025
84bc319
build(deps-dev): bump esbuild from 0.23.1 to 0.25.0
dependabot[bot] Feb 12, 2025
b40343c
Merge pull request #60 from marclipovsky/dependabot/npm_and_yarn/esbu…
Feb 13, 2025
cc220ca
build(deps): bump serialize-javascript and mocha
dependabot[bot] Feb 13, 2025
ba7bb42
ci: version bump to 0.7.26
gh-action-bump-version Feb 13, 2025
b7d604b
Propertly duplicate selection for multi-line and multi-select for com…
exceptionraiser Mar 14, 2025
bc0cc8b
ci: version bump to 0.7.27
gh-action-bump-version Mar 14, 2025
9ec3b5a
Refactor: Reorganize commands into separate files and update README
exceptionraiser Mar 14, 2025
3f13004
Refactor: Move duplicateAndIncrement and duplicateAndDecrement logic …
exceptionraiser Mar 14, 2025
bb5dea4
Merge pull request #62 from marclipovsky/feature/reorg
Mar 14, 2025
9b11a57
ci: version bump to 0.7.28
gh-action-bump-version Mar 14, 2025
1f2be4f
Add string transformation preview functionality to context menu
exceptionraiser Mar 14, 2025
5734d7c
Update README.md with preview transformation feature documentation an…
exceptionraiser Mar 14, 2025
2a7b6a2
Merge pull request #63 from marclipovsky/feature/context-menu
Mar 14, 2025
a8c725c
ci: version bump to 0.7.29
gh-action-bump-version Mar 14, 2025
19122e9
Fix #29: Add incrementFloat and decrementFloat commands for floating …
exceptionraiser Mar 15, 2025
77b6a7e
Merge pull request #64 from marclipovsky/feature/float
Mar 15, 2025
f3ead5a
Merge pull request #61 from marclipovsky/dependabot/npm_and_yarn/mult…
Mar 15, 2025
e342448
Merge pull request #58 from marclipovsky/dependabot/npm_and_yarn/undi…
Mar 15, 2025
c48ba2f
ci: version bump to 0.7.30
gh-action-bump-version Mar 15, 2025
3e1af7e
ci: version bump to 0.7.31
gh-action-bump-version Mar 15, 2025
eda3c50
ci: version bump to 0.7.32
gh-action-bump-version Mar 15, 2025
aaa8edf
build(deps-dev): bump tar-fs from 2.1.1 to 2.1.2
dependabot[bot] Mar 28, 2025
01633f3
Merge pull request #65 from marclipovsky/dependabot/npm_and_yarn/tar-…
Mar 29, 2025
5e1df6d
ci: version bump to 0.7.33
gh-action-bump-version Mar 29, 2025
c020612
build(deps-dev): bump undici from 6.21.1 to 6.21.3
dependabot[bot] May 15, 2025
a894405
Merge pull request #66 from marclipovsky/dependabot/npm_and_yarn/undi…
May 16, 2025
f78ed4a
ci: version bump to 0.7.34
gh-action-bump-version May 16, 2025
095de57
Add CLAUDE.md development guide
exceptionraiser Jun 21, 2025
0986b1f
Add GitHub releases and Cursor availability banner
exceptionraiser Jun 21, 2025
1e9d3ce
ci: version bump to 0.7.35
gh-action-bump-version Jun 21, 2025
58e5ee9
Enable auto-publishing to open-vsx.org
exceptionraiser Jun 21, 2025
da667de
ci: version bump to 0.7.36
gh-action-bump-version Jun 21, 2025
539813e
Add ovsx dev dependency for Open VSX Registry publishing
exceptionraiser Jun 21, 2025
573c236
ci: version bump to 0.7.37
gh-action-bump-version Jun 21, 2025
6c71c7c
Update README badges and Cursor availability
exceptionraiser Jun 21, 2025
0c7bd72
ci: version bump to 0.7.38
gh-action-bump-version Jun 21, 2025
345deb3
Fix increment/decrement operations to preserve leading zeros
exceptionraiser Jun 22, 2025
dc26a28
ci: version bump to 0.7.39
gh-action-bump-version Jun 22, 2025
b6c196f
build(deps-dev): bump tar-fs from 2.1.2 to 2.1.3
dependabot[bot] Jun 22, 2025
e6cae6d
Merge pull request #67 from marclipovsky/dependabot/npm_and_yarn/tar-…
Jun 22, 2025
008dc4d
ci: version bump to 0.7.40
gh-action-bump-version Jun 22, 2025
0c6b961
Add comprehensive telemetry logging for command usage and errors
exceptionraiser Jun 25, 2025
575a8bb
ci: version bump to 0.7.41
gh-action-bump-version Jun 25, 2025
c958451
Enhance sequence command with leading zeros preservation and max-leng…
exceptionraiser Jun 26, 2025
871962c
ci: version bump to 0.7.42
gh-action-bump-version Jun 26, 2025
40e9eb4
Fix multiline selection handling for number functions
exceptionraiser Jul 4, 2025
baf10a6
ci: version bump to 0.7.43
gh-action-bump-version Jul 4, 2025
07dccc4
Merge origin/master into current branch
cursoragent Jul 4, 2025
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
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Node.js CI
name: CI

on:
push:
Expand All @@ -19,16 +19,16 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/checkout@v4
with:
node-version: 18.13.0
ref: ${{ github.ref }}
- name: Setup Node.js
uses: actions/setup-node@v4
- name: Install dependencies
run: npm install
- name: Build package
run: npm run build
- name: Run headless test
uses: GabrielBB/xvfb-action@v1.0
uses: coactions/setup-xvfb@v1
with:
run: npm test
41 changes: 29 additions & 12 deletions .github/workflows/publish-extension.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
name: "Publish to VS Code Marketplace"
name: "Publish to Marketplace"

on:
push:
branches:
- master
workflow_run:
workflows: ["CI"]
types: [completed]
branches: [master]

jobs:
cd:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout to branch
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

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

- name: "Bump version"
uses: 'phips28/gh-action-bump-version@master'
uses: "phips28/gh-action-bump-version@master"
env:
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
with:
minor-wording: 'MINOR'
major-wording: 'MAJOR'
patch-wording: 'PATCH,FIX'
rc-wording: 'RELEASE'
minor-wording: "MINOR"
major-wording: "MAJOR"
patch-wording: "PATCH,FIX"
rc-wording: "RELEASE"

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

- name: Publish extension package
- name: Publish extension package to Marketplace
env:
VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }}
run: npm run vsce -- publish -p $VSCE_TOKEN

- name: Publish extension package to Open VSX Registry
env:
OVSX_PAT: ${{ secrets.OVSX_PAT }}
run: npm run ovsx -- publish -p $OVSX_PAT

- uses: actions/upload-artifact@v4
name: Upload artifact
with:
name: vscode-string-manipulation.v${{ steps.calculateVersion.outputs.AppVersion }}.vsix
path: vscode-string-manipulation.v${{ steps.calculateVersion.outputs.AppVersion }}.vsix

- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ steps.calculateVersion.outputs.AppVersion }}
name: Release v${{ steps.calculateVersion.outputs.AppVersion }}
files: vscode-string-manipulation.v${{ steps.calculateVersion.outputs.AppVersion }}.vsix
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57 changes: 57 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Development Commands

### Build and Compilation
- `npm run build` - Full production build with type checking and linting
- `npm run compile` - Development build with type checking and linting
- `npm run watch` - Watch mode for development with parallel processes
- `npm run check-types` - Type checking only
- `npm run lint` - ESLint code linting

### Testing
- `npm test` - Run all tests (includes compilation, linting, and test execution)
- `npm run pretest` - Prepare for testing (compile, build, lint)
- `npm run compile-tests` - Compile TypeScript tests to JavaScript
- `npm run watch-tests` - Watch mode for test compilation

### Packaging
- `npm run package` - Create VSIX package for distribution
- `npm run vsce` - Direct vsce command access

## Architecture Overview

This is a VSCode extension that provides string manipulation commands for text editing. The extension follows a modular command-based architecture:

### Core Structure
- **Main Extension**: `src/extension.ts` - Entry point that activates string manipulation commands, preview functionality, and optional sidebar
- **Command Registry**: `src/commands/index.ts` - Central registry that maps command names to functions and handles command execution
- **Command Modules**: Individual files in `src/commands/` for specialized functionality:
- `default-functions.ts` - Basic string transformations using underscore.string
- `increment-decrement.ts` - Number manipulation commands
- `sequence.ts` - Number sequencing functionality
- `title-case.ts` - Specialized title casing (AP Style, Chicago Style)
- `preview.ts` - Live preview functionality for transformations
- `sidebar.ts` - Optional webview sidebar (Labs feature)

### Command System
The extension registers VSCode commands dynamically from the `commandNameFunctionMap` registry. Each command:
1. Gets active editor selections
2. Applies transformation function to selected text
3. Replaces selections with transformed text
4. Stores last action for repeat functionality

### Key Features
- **Multi-selection support**: All commands work with multiple text selections
- **Preview mode**: Live preview of transformations before applying
- **Argument-based commands**: Some commands (like `chop`, `truncate`) prompt for numeric arguments
- **Duplicate operations**: Special handling for duplicate-and-increment/decrement commands
- **Labs features**: Experimental features behind a configuration flag

### Build System
Uses esbuild for fast bundling with TypeScript compilation. The build outputs to `dist/extension.js` as a CommonJS bundle suitable for VSCode.

### Testing
Tests are located in `src/test/` and use the VSCode testing framework with Mocha.
106 changes: 78 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,98 @@
![Node.js CI](https://github.com/marclipovsky/vscode-string-manipulation/workflows/Node.js%20CI/badge.svg)
![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)

# String Manipulation for VSCode
> **📢 Now available on Cursor!**

# String Manipulation for VSCode & Cursor

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

Current string functions available:

1. camelize
1. capitalize
1. classify
1. chop - split into groups provided n # of characters
1. clean
1. clean diacritics
1. dasherize
1. decapitalize
1. humanize
1. reverse
1. screaming snake
1. sentence
1. slugify
1. snake
1. underscore
1. swap case
1. titleize
1. titleize (AP Style)
1. titleize (Chicago Style)
1. camelize - converts hyphenated strings to camelCase
1. capitalize - capitalizes the first character of each selection
1. classify - converts underscored text to PascalCase
1. chop - splits into groups provided n # of characters
1. clean - collapses multiple spaces into one
1. clean diacritics - removes diacritic marks from characters
1. dasherize - converts camelCase to kebab-case
1. decapitalize - lowercases the first character of each selection
1. humanize - converts text to human-readable form
1. reverse - reverses the characters in the selection
1. screaming snake - converts text to SCREAMING_SNAKE_CASE
1. sentence - transforms text to sentence case
1. slugify - converts text to a URL-friendly slug
1. snake - converts text to snake_case
1. swap case - inverts the case of each character
1. titleize - capitalizes the first letter of each word
1. titleize (AP Style) - capitalizes titles according to AP style
1. titleize (Chicago Style) - capitalizes titles according to Chicago style
1. truncate - trims string to n # of characters and appends ellipsis
1. prune - truncate but keeps ellipsis within character count provided
1. repeat - repeat selection n #of times
1. convert between unicode and readable characters.
1. repeat - repeat selection n # of times
1. random case - randomly changes the case of characters
1. swap quotes - swaps between single and double quotes
1. utf8ToChar - converts Unicode escapes to characters
1. charToUtf8 - converts characters to Unicode escapes

Number related functions:

1. increment all numbers in selection
1. decrement all numbers in selection
1. duplicate selection and increment all number
1. duplicate selection and decrement all number
1. sequence all numbers in selection from first number
1. increment - increases all numbers in the selection by 1
1. decrement - decreases all numbers in the selection by 1
1. duplicate and increment - duplicates selection and increments all numbers
1. duplicate and decrement - duplicates selection and decrements all numbers
1. sequence - replaces numbers with a sequence starting from the first number
1. incrementFloat - increases all floating point numbers in the selection by 1
1. decrementFloat - decreases all floating point numbers in the selection by 1

Additional utility commands:

1. repeat last action - repeats the last string manipulation command that was executed

## Use

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

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

## Preview Transformations

The extension now includes a powerful preview feature that allows you to see how each transformation will affect your text before applying it.

### How to Use the Preview Feature

1. Select the text you want to transform
2. Right-click to open the context menu
3. Choose "Show Transformations with Preview"
4. Browse through the available transformations with instant previews
5. Select a transformation to apply it to your text

This feature makes it easier to find the right transformation without trial and error.

![String Manipulation Preview Feature](images/preview-demo.gif)

## 🧪 Introducing Labs Features

Introducing String Manipulation Labs

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.

### 🚀 How to Enable Labs Features

To try out the new Labs features, follow these simple steps:

1. Open VSCode Settings:
• Press Ctrl + , (Windows/Linux) or Cmd + , (macOS), or navigate to File > Preferences > Settings.
2. Search for Labs Settings:
• In the search bar, type stringManipulation.labs.
3. Enable Labs Features:
• Toggle the String Manipulation Labs setting to On.

### 🛠️ We Value Your Feedback

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.

Thank you for using String Manipulation!
Your support helps us build better tools for the community.

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
72 changes: 72 additions & 0 deletions content.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
moz-transform
-moz-transform
foo Bar
foo bar
ääkkönen
foo Bar
some_class_name
MozTransform
Foo Bar
capitalize dash-CamelCase_underscore trim
Abc
Un éléphant à l'orée du bois
HELLOworld
This-is_snake case
screaming-snake case
my name is tristan
this is a test
The quick brown fox jumps over the lazy dog.
Underscored-is-like snake-case
aabbccdd
aabbccdd
aabbccddaabbccdd
aabbccdd
a1 b2 c3 4d 5e 6f 12x y23 34z45
a1 b2 c3 4d 5e
6f 12x y23 34z45
a-4 b-3 c-2 -1d 0e
6f 12x y23 34z45
a1 b2 c3 4d 5e 6f 12x y23 34z45
a1 b2 c3 4d
5e 6f 12x y23 34z45
a-3 b-2 c-1 0d
1e 6f 12x y23 34z45
a1 b2 c3 4d 5e 6f 12x y23 34z45

a1 b2 c3 4d 5e 6f 12x y23 34z45

a1 b2 c3 4d 5e 6f 12x y23 34z45
a14 b2 c3
4d 5e 6f 7x y8 9z12
\u0061\u0062\u0063\u4e2d\u6587\ud83d\udc96
abc中文💖
Hello, World!
12345!@#$%
Test123!
'She said, "Hello"'
"My name's Minalike"
"He said, 'It's a trap!'"
'She exclaimed, \"Wow!\"'
"'Double' and 'single' quotes"
No quotes at all
'It's'
"My name's %20 Minalike!"
Lorem -1.234 ipsum 5.678 dolor sit amet, consectetur adipiscing.
Sed do 9.876 eiusmod -4.321 tempor incididunt labore.
abc009 def010 ghi001
test001 value99 number000
prefix007 suffix008 middle009
009 010 001
001 99 000
007 008 009
0009 0010 0001
0001 0099 0000
0007 0008 0009
test01 value100 prefix007 99
02 100 4
010 100 123
a001 b1
c1 d01 e1
f1 g1
multi1 line2
test3 data4
Loading