🌈 Prism Search
Manage multiple independent search terms, each highlighted in its own color, across the current file or the whole workspace.
✨ Key Features
- Multiple independent search boxes — each with its own term, color, and options (case/whole word/regex)
- Simultaneous multi-color highlighting — across the active editor and every visible split pane at once
- Match navigation — step through each box's matches with ▲▼ or
Enter / Shift+Enter
- Workspace-wide search & replace — with optional ripgrep support for speed and automatic
.gitignore handling
- Replace, per box — including workspace-wide Replace All with a confirmation dialog and one-click Undo
- Find in Selection — restrict a box's matches to your current selection, even while workspace-searching (see below)
- Search history & quick actions — reuse recent terms, or grab the word under your cursor via keybinding or icon
🔍 Using It
Highlighting
- Type into a search box to highlight matches, in that box's color, in the active editor. Split panes are all highlighted too (the inactive pane is shown dimmer)
+ Add Search Box adds a box with the next color in the palette
Aa / ab / .* toggle Match Case / Whole Word / Regex
- The eye icon hides the highlight without stopping the search;
✕ removes the box
Navigating
- ▲▼, or
Enter / Shift+Enter in the input, jump to the next/previous match, starting from the cursor and wrapping around
- The match count (
1/12) always reflects where "next" will actually land
Workspace search
- Click the folder icon 📁 to search the whole workspace instead of just the active file. Results appear as a clickable file/line list below the box
- The "Include" field filters which files are searched, by name/path (plain text or globs, comma-separated)
- Results are sorted by proximity to your current file
- Combining with Find in Selection: turn on the selection icon while workspace-searching to restrict the current file's highlighting, match count/navigation, and Replace All to your selection. The file/line list below stays unrestricted (it still shows every match in every file) — only the badge, ▲▼, and what actually gets rewritten in your active file are scoped to the selection
Replace
- Click the replace icon to reveal Replace / Replace All / Undo
- Current file: Undo reverts whichever replace you just did (Replace or Replace All) — but only while you haven't touched that file again since. The Undo button is greyed out except right after a replace; make any other edit (even an unrelated one) and it disables itself rather than risk undoing the wrong thing. If you need to undo after that, use
Ctrl+Z instead
- Whole workspace: only Replace All is available, with a confirmation dialog showing the affected count. Since each file is a separate edit,
Ctrl+Z only undoes the file you're in — use the Undo button to revert the whole batch at once (same one-shot rule: it's only available until you do something else)
- Regex mode supports
$1, $2, $&, $$ in the replacement text
Other shortcuts
Ctrl+Alt+F adds the selection (or word under cursor) as a new search term, reusing the bottom box if it's still empty, then focuses that box's input (configurable, see "Other Settings" below)
- The target icon on any box does the same, but always fills that specific box
- The history icon shows recently used terms for this workspace
- The color dot opens a color picker; a reset button appears once you've changed it from its default
- The selection icon turns on Find in Selection, restricting that box to your current selection (works together with workspace search, see above). The 🔄 icon that appears re-captures the boundary from your current selection; the boundary itself is saved and restored across restarts, and keeps tracking correctly through further edits to the file
- A toolbar below the title bar toggles Visibility / Workspace Search / Match Case / Whole Word / Regex for all boxes at once
- Search box state is saved per workspace and restored on restart
⚡ Ripgrep Integration
Workspace search uses a built-in scanner by default. Turn on prismSearch.workspaceSearch.useRipgrep to use rg (ripgrep) instead, if it's installed and on your PATH — faster, and respects .gitignore automatically:
{
"prismSearch.workspaceSearch.useRipgrep": true
}
This extension doesn't bundle ripgrep. If rg can't be found, or a specific pattern isn't supported (e.g. lookahead/lookbehind), it silently falls back to the built-in scanner — turning the setting on never breaks anything.
📁 Workspace Search Exclude Settings
// .vscode/settings.json (per-workspace) or User Settings
{
"prismSearch.workspaceSearch.excludeGlobs": [
"**/node_modules/**",
"**/.git/**",
"**/dist/**",
"**/generated/**"
],
"prismSearch.workspaceSearch.respectFilesExclude": true
}
excludeGlobs replaces the default exclude list entirely (extend it yourself if you still need the defaults)
respectFilesExclude (on by default) also excludes anything matched by VS Code's own files.exclude / search.exclude
⚙️ Other Settings
{
// Highlight inactive split panes too (default: true)
"prismSearch.highlightInactiveEditors": false,
// Defaults for newly created search boxes
"prismSearch.newSearch.caseSensitive": false,
"prismSearch.newSearch.wholeWord": false,
"prismSearch.newSearch.regex": false,
"prismSearch.newSearch.scope": "file", // or "workspace"
// Move focus to the search input after Ctrl+Alt+F (default: true).
// Set to false to keep focus in the editor instead.
"prismSearch.addSearchFromCursor.focusInput": true
}
⚠️ Known Limitations
- Without ripgrep,
.gitignore is not respected (a VS Code API limitation) — customize excludeGlobs instead
- Ripgrep's regex engine doesn't support lookahead/lookbehind/backreferences; those patterns fall back to the built-in scanner automatically for workspace search
- Scans are capped (2000 files, 2MB/file, 500 matches total) to avoid runaway operations
- Workspace search only re-runs when you change the term/options, not when other files change in the background
- Find in Selection's boundary is fixed to wherever it was captured; it doesn't follow your cursor/selection afterward (use the 🔄 icon to re-capture), though it does track edits to the file itself
- When combined with workspace search, Find in Selection scopes the badge/navigation/Replace All for your active file, but never touches the file/line list, which always lists every match workspace-wide
🛡️ Regex Mode Security Note
Regex patterns run as real JavaScript RegExp. Nested-quantifier patterns like (a+)+ can cause catastrophic backtracking, freezing the entire extension host. This extension detects common cases and blocks execution instead (the input gets an orange border) — but detection isn't exhaustive (e.g. alternation-based patterns can slip through). If this concerns you, use literal search instead. This check doesn't apply when ripgrep is used, since its regex engine is immune to this by design.
🛠️ Troubleshooting
Ripgrep doesn't seem to be used, even though I turned it on
Make sure rg is installed and on your PATH (check with rg --version in a terminal). If it's missing, you'll see a one-time warning notification, and the extension automatically falls back to the built-in scanner until it's found.
Workspace search is missing a file I expect to see
Check prismSearch.workspaceSearch.excludeGlobs and respectFilesExclude — a pattern may be excluding it. Files over 2MB, or scans beyond the file/match caps, are also skipped (see "Known Limitations").
The input turns orange, or shows no matches, in regex mode
The pattern was flagged as a possible catastrophic-backtracking risk and wasn't executed, for safety (see "Regex Mode Security Note"). Simplify the pattern, or use literal search instead.
The Undo button is greyed out
It's only enabled right after a Replace/Replace All, and only until you edit that file again (anything at all, even unrelated to this search box). This is intentional — it avoids the risk of undoing the wrong edit. Use Ctrl+Z if you've already made another change and still want to undo the replace.
📄 License & Links
日本語版 (Japanese)
複数の検索語をそれぞれ別の検索ボックスで管理し、色分けしてハイライトする拡張機能です。現在のファイルだけでなく、ワークスペース全体も検索できます。
✨ 主な機能
- 複数の独立した検索ボックス — 検索語・色・オプション(大文字小文字/単語単位/正規表現)をそれぞれ個別に管理
- 複数色での同時ハイライト — アクティブなエディタと、表示中の分割ペイン全てに同時表示
- マッチ間の移動 — ▲▼や
Enter / Shift+Enter で各ボックスのマッチを順に移動
- ワークスペース全体の検索・置換 — ripgrepを使えば高速化・
.gitignore自動対応も可能
- ボックスごとの置換 — ワークスペース全体のReplace Allは確認ダイアログ+ワンクリックUndo付き
- 選択範囲内検索(Find in Selection) — 現在の選択範囲だけに絞って検索。ワークスペース検索中でも併用可能(後述)
- 検索履歴・クイック操作 — 直近の検索語を再利用、キーバインド/アイコンでカーソル位置の単語を即検索
🔍 使い方
ハイライト
- 検索ボックスに入力すると、アクティブなエディタ内がその色でハイライトされる。分割ペインも全てハイライトされる(非アクティブなペインは少し暗く表示)
- 「+ Add Search Box」で色パレットの次の色を割り当てたボックスを追加
Aa / ab / .* で大文字小文字区別・単語単位・正規表現を切り替え
- 目のアイコンはハイライト表示だけをON/OFF(検索自体は止まらない)。
✕ でボックスを削除
移動
- ▲▼、または入力欄で
Enter / Shift+Enter で次/前のマッチへ移動。カーソル位置から開始し、末尾/先頭で循環
- マッチ数(
1/12)は常に「次へ」で実際に着地する位置と一致する
ワークスペース検索
- フォルダアイコン📁でワークスペース全体検索に切り替え。結果はボックス下にファイル/行のクリック可能な一覧で表示
- 「Include」欄で検索対象ファイルを名前/パスで絞り込み(プレーンテキストまたはglob、カンマ区切り)
- 結果は現在のファイルに近い順に並ぶ
- Find in Selectionとの併用: ワークスペース検索中でも選択範囲アイコンをONにすると、現在アクティブなファイルのハイライト・件数バッジ・上下ナビゲーション・Replace Allが選択範囲内だけに絞り込まれる。ボックス下の一覧(ファイル/行リスト)はこれに関わらず全ファイルの全マッチを表示したままになる ―― 絞り込まれるのはバッジ・上下ボタン・実際に書き換わる範囲だけ
置換
- 置換アイコンでReplace / Replace All / Undoを表示
- 現在のファイル: Undoは直前に行った置換(ReplaceまたはReplace All)を1件戻す。ただし、その置換の後にそのファイルへ何か編集をしていないときだけ有効 ―― Undoボタンは置換直後だけ押せる状態になり、(このボックスと無関係なものも含めて)何か1つでも編集をすると自動的に無効(グレーアウト)になる。誤って別の編集を戻してしまわないための仕様。それ以降に取り消したい場合は
Ctrl+Z を使う
- ワークスペース全体: Replace Allのみ利用可(実行前に対象件数の確認ダイアログあり)。各ファイルへの変更は独立しているため、Ctrl+Zは今のファイルにしか効かない。まとめて戻すにはUndoボタンを使う(同様に、他の操作をすると使えなくなる一回限りの仕様)
- 正規表現モードでは置換後文字列に
$1, $2, $&, $$ が使える
その他のショートカット
Ctrl+Alt+F で選択範囲(無ければカーソル位置の単語)を新規検索語として追加。末尾のボックスが空ならそれを再利用し、そのボックスの入力欄へフォーカスする(設定で変更可能、後述の「その他の設定」参照)
- 各ボックスのターゲットアイコンも同様だが、常にそのボックス自身に入力する
- 履歴アイコンでこのワークスペースの直近の検索語を表示
- 色ドットでカラーピッカーを開く。変更後はリセットボタンが表示される
- 選択範囲アイコンで Find in Selection(選択範囲内のみ検索)をON(ワークスペース検索との併用も可能、上記参照)。表示される🔄アイコンは、その時点の選択で範囲を捕捉し直す。範囲自体はワークスペースに保存され再起動後も復元されるほか、その後のファイルへの編集にも正しく追従する
- タイトルバー下の専用ツールバーで、表示/ワークスペース検索/大文字小文字区別/単語単位/正規表現を全ボックス一括切り替え
- 検索ボックスの状態はワークスペースごとに保存され、再起動後も復元される
⚡ Ripgrep統合
ワークスペース検索は既定で内蔵スキャナを使用。prismSearch.workspaceSearch.useRipgrep をONにすると、PATH上に rg(ripgrep)があればそちらを使用する(高速・.gitignoreを自動で尊重):
{
"prismSearch.workspaceSearch.useRipgrep": true
}
ripgrepは同梱していません。rg が見つからない場合、または一部のパターンが非対応な場合(例: 先読み/後読み)は、自動的に内蔵スキャナへフォールバックします。ONにしても壊れることはありません。
📁 ワークスペース全体検索の除外設定
// .vscode/settings.json (ワークスペース単位) または ユーザー設定
{
"prismSearch.workspaceSearch.excludeGlobs": [
"**/node_modules/**",
"**/.git/**",
"**/dist/**",
"**/generated/**"
],
"prismSearch.workspaceSearch.respectFilesExclude": true
}
excludeGlobs は既定の除外リストを丸ごと上書きする(必要なら自分でコピー&追記)
respectFilesExclude(既定ON)は、VS Codeのfiles.exclude / search.excludeのパターンもあわせて除外する
⚙️ その他の設定
{
// 非アクティブな分割ペインにもハイライトを表示するか(既定: true)
"prismSearch.highlightInactiveEditors": false,
// 新規作成する検索ボックスの既定値
"prismSearch.newSearch.caseSensitive": false,
"prismSearch.newSearch.wholeWord": false,
"prismSearch.newSearch.regex": false,
"prismSearch.newSearch.scope": "file", // または "workspace"
// Ctrl+Alt+Fの後、検索欄へフォーカスを移すか(既定: true)。
// falseにすると、エディタ側にフォーカスを残したままにする。
"prismSearch.addSearchFromCursor.focusInput": true
}
⚠️ 既知の制約
- ripgrepを使わない場合、
.gitignore は考慮されない(VS Code API側の制限)。excludeGlobs でカスタマイズ可能
- ripgrepの正規表現エンジンは先読み/後読み/後方参照に非対応。該当パターンはワークスペース検索時に自動で内蔵スキャナへフォールバック
- 暴走防止のためスキャンには上限がある(最大2000ファイル・1ファイル2MBまで・マッチ数最大500件)
- ワークスペース検索は検索語/オプション変更時のみ再実行(他ファイルの背後での変更は自動検知しない)
- Find in Selectionの範囲は捕捉した時点のまま固定され、その後のカーソル/選択の変化には自動追従しない(選び直したい場合は🔄アイコンを使う)。ただし、そのファイル自体への編集(改行・置換など)には正しく追従する
- ワークスペース検索と併用した場合、Find in Selectionが絞り込むのはアクティブなファイルのバッジ・ナビゲーション・Replace Allのみで、ボックス下の一覧(ファイル/行リスト)は常にワークスペース全体の全マッチを表示したままになる
🛡️ 正規表現モードのセキュリティ上の注意
正規表現は実際のJavaScript RegExp として実行されます。(a+)+ のような入れ子の量指定子は「壊滅的バックトラッキング」を起こし、拡張機能ホスト全体が無応答になることがあります。この拡張機能は代表的なパターンを検出して実行をブロックします(入力欄がオレンジ枠になる)が、完全ではありません(alternationを使ったパターンなどはすり抜けます)。心配な場合はリテラル検索を使ってください。ripgrep使用時はエンジンの特性上この問題自体が起こらないため、このチェックは適用されません。
🛠️ トラブルシューティング
ripgrepをONにしたのに使われている気配がない
rg がインストール済みで PATH 上にあるか確認してください(ターミナルで rg --version を実行)。無い場合は一度だけ警告通知が表示され、見つかるまで自動的に内蔵スキャナにフォールバックします。
ワークスペース検索で期待したファイルが出てこない
prismSearch.workspaceSearch.excludeGlobs と respectFilesExclude を確認してください。パターンに引っかかって除外されている可能性があります。2MBを超えるファイルや、ファイル数/マッチ数の上限(「既知の制約」参照)を超えた分もスキップされます。
正規表現モードで入力欄がオレンジ枠になる/マッチが出ない
壊滅的バックトラッキングの疑いがあるパターンとして検出され、安全のため実行されなかった状態です(「正規表現モードのセキュリティ上の注意」参照)。パターンを単純化するか、リテラル検索を使ってください。
Undoボタンがグレーアウトしていて押せない
Undoが有効なのは置換(Replace/Replace All)の直後だけで、その後そのファイルに何か編集(このボックスと無関係なものも含む)をすると自動的に無効になります。誤って別の編集を巻き戻してしまわないための仕様です。それ以降に取り消したい場合は Ctrl+Z を使ってください。
📄 ライセンス・リンク