diff --git a/README.md b/README.md index 1a8fff0..798b41e 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ![ActiveFileInStatusBar in action](media/ActiveFileInStatusBar.gif) ## Install ## -Install [ActiveFileInStatusBar](https://marketplace.visualstudio.com/items?itemName=RoscoP.ActiveFileInStatusBar) directly from the Visual Studio Code extension gallery. +Install [ActiveFileInStatusBar](https://marketplace.visualstudio.com/items?itemName=RoscoP.ActiveFileInStatusBar) directly from the Visual Studio Code extension gallery. ## Options ## @@ -17,6 +17,10 @@ Install [ActiveFileInStatusBar](https://marketplace.visualstudio.com/items?itemN "ActiveFileInStatusBar.revealFile": false, // Set text color for the filename in the status bar. "ActiveFileInStatusBar.color": "", +// Do I need to search immediately after copying. +"ActiveFileInStatusBar.searchАfterСopy": false, +// Regex mask if you need to dissect the path before copying. +"ActiveFileInStatusBar.regex": "string", ``` ## Contribute ## diff --git a/extension.js b/extension.js index a52a404..edac0c8 100644 --- a/extension.js +++ b/extension.js @@ -59,7 +59,19 @@ function activate(context) { vscode.commands.executeCommand('workbench.action.files.revealActiveFileInWindows') } else { - copypaste.copy(sb.text) + copypaste.copy( + config.regex + ? sb.text.replace(new RegExp(config.regex), '$1') + : sb.text + ) + + if (config.searchАfterСopy) { + vscode.commands.executeCommand('workbench.view.search'); + + setTimeout(() => { + vscode.commands.executeCommand('editor.action.clipboardPasteAction'); + }, 100); + } } }); context.subscriptions.push(disposable); diff --git a/package.json b/package.json index 177db25..3c16ded 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,16 @@ "type": "string", "default": "", "description": "Set text color for the filename in the status bar." + }, + "ActiveFileInStatusBar.searchАfterСopy": { + "type": "boolean", + "default": false, + "description": "Do I need to search immediately after copying." + }, + "ActiveFileInStatusBar.regex": { + "type": "string", + "default": "", + "description": "Regex mask if you need to dissect the path before copying." } } }