Skip to content

Commit

Permalink
feat(regreplace): first init
Browse files Browse the repository at this point in the history
  • Loading branch information
DomiR committed Nov 1, 2017
0 parents commit 040c4af
Show file tree
Hide file tree
Showing 17 changed files with 3,160 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
out
node_modules
*vsix
28 changes: 28 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// A launch configuration that compiles the extension and then opens it inside a new window
{
"version": "0.1.0",
"configurations": [
{
"name": "Launch Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceRoot}" ],
"stopOnEntry": false,
"sourceMaps": true,
"outDir": "${workspaceRoot}/out/src",
"preLaunchTask": "npm"
},
{
"name": "Launch Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/out/test" ],
"stopOnEntry": false,
"sourceMaps": true,
"outDir": "${workspaceRoot}/out/test",
"preLaunchTask": "npm"
}
]
}
10 changes: 10 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.exclude": {
"out": false // set this to true to hide the "out" folder with the compiled JS files
},
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
},
"typescript.tsdk": "./node_modules/typescript/lib" // we want to use the TS server from our node_modules folder to control its version
}
1 change: 1 addition & 0 deletions .vscode/symbols.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"symbols":{"ICommand":{"hasNamespace":false,"type":1,"moduleName":"extension","relativePath":"src/extension"},"IConfig":{"hasNamespace":false,"type":1,"moduleName":"extension","relativePath":"src/extension"},"RunOnSaveExtension":{"hasNamespace":false,"type":0,"moduleName":"extension","relativePath":"src/extension"}},"files":{"src/extension.ts":"2016-11-13T01:43:53.000Z","test/extension.test.ts":"2016-11-13T00:59:24.000Z","test/index.ts":"2016-11-13T00:59:24.000Z","typings/node.d.ts":"2016-11-13T00:59:24.000Z","typings/vscode-typings.d.ts":"2016-11-13T00:59:24.000Z"}}
30 changes: 30 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Available variables which can be used inside of strings.
// ${workspaceRoot}: the root folder of the team
// ${file}: the current opened file
// ${fileBasename}: the current opened file's basename
// ${fileDirname}: the current opened file's dirname
// ${fileExtname}: the current opened file's extension
// ${cwd}: the current working directory of the spawned process

// A task runner that calls a custom npm script that compiles the extension.
{
"version": "0.1.0",

// we want to run npm
"command": "npm",

// the command is a shell script
"isShellCommand": true,

// show the output window only if unrecognized errors occur.
"showOutput": "silent",

// we run the custom script "compile" as defined in package.json
"args": ["run", "compile", "--loglevel", "silent"],

// The tsc compiler is started in watching mode
"isWatching": true,

// use the standard tsc in watch mode problem matcher to find compile problems in the output.
"problemMatcher": "$tsc-watch"
}
9 changes: 9 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.vscode/**
typings/**
out/test/**
test/**
src/**
**/*.map
.gitignore
tsconfig.json
vsc-extension-quickstart.md
88 changes: 88 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# regreplace README

Reg Replace is a plugin for Visual Studio Code that allows the creating of commands consisting of sequences of find and replace instructions.

It is heavily inspired from [Reg Replace for Sublime Text](https://github.com/facelessuser/RegReplace)

## Features

- Create find and replace rules that can then be used to create VSCode Commands to call at any time.
- Chain multiple regex find and replace rules together.
- Create rules that can filter regex results by filename.
- Create rules that run on save.

<!-- Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file.
For example if there is an image subfolder under your extension project workspace:
\!\[feature X\]\(images/feature-x.png\)
-->

## Extension Settings

This extension contributes the following settings:

* `on-save` - defaults to true, run commands on save.
* `suppress-warnings` - (optional) Suppress warnings when regreplace fails.
* `commands` - array of commands that will be run whenever a file is saved.
* `name` - command name for debugging.
* `match` - regex for matching files to run commands on. e.g. \"\\.(ts|js|tsx)$\"
* `exclude` - regex for matching files *not* to run commands on. e.g. \"^\\.$\" exclude dot files
* `priority` - command priority determines order.
* `find` - use simple find command. e.g. \"** what\"
* `regexp` - use regexp find command. Needs to be escaped. e.g. \"(\\n)*\"
* `replace` - replace text. Supports groups. e.g. \"$2\n$1\"
* `global` - run command asynchronously.



### Sample Config
This sample configuration will remove newlines from end of file.
```typescript
"regreplace.commands": [
{
"match": ".(ts|js|tsx)$", // typescript
"regexp": "\n+$", // escaped regexp
"global": true, // glob
"replace": "" // replace with empty string
}
]
```


## Known Issues

None yet :)

## Release Notes

Users appreciate release notes as you update your extension.

### 1.0.0

Initial release of regreplace.

-----------------------------------------------------------------------------------------------------------

## Licence

MIT License

Copyright (c) 2017 DomiR

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Binary file added assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 040c4af

Please sign in to comment.