Skip to content

devreplay/vscode-devreplay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DevReplay for Visual Studio Code

Suggest source code fix based on your regular expressions.

howtouse

Quick start

  1. Install this extension!
  2. Create your own programming pattern(.devreplay.json) on the root like bellow
{
  "before": [
    "(?<tmp>.+)\\s*=\\s*(?<a>.+)",
    "\\k<a>\\s*=\\s*(?<b>.+)",
    "\\k<b>\\s*=\\s*\\k<tmp>"
  ],
  "after": [
    "$2, $3 = $3, $2"
  ],
  "isRegex": true
}

or You can chose the your programming language and framework.

"python"

Following languages and Frameworks are supported.

Languages Frameworks
C Android
CPP Angular
Cobol chainer2pytouch
Dart Rails
Java React
JavaScript TensorFlow
PHP
Python
Ruby
TypeScript
VS Code
Vue

If you write the following code,

tmp = a
a = b
b = tmp

it will be

a, b = b, a

the problem display can be custimized by editing severity like following. howtouse

[
  {
    "before": [
      "(?<tmp>.+)\\s*=\\s*(?<a>.+)",
      "\\k<a>\\s*=\\s*(?<b>.+)",
      "\\k<b>\\s*=\\s*\\k<tmp>"
    ],
    "after": [
      "$2, $3 = $3, $2"
    ],
    "isRegex": true,
    "severity": "error",
    "author": "Yuki",
    "message": "Value exchanging can be one line"
  },
]

Configs

  • devreplay.add.save: Add rules when a file is saved (default: false)
  • devreplay.rule.size: Size of max change lines when making rules (default: 1)

Other Implementation

Contributing

Please check CONTRIBUTING.md

TODO

  • Add support for other programming languages
  • Add support for other frameworks
  • Add support for regular expression generator using Regexp preview

Acknowledgements

DevReplay is supported by 2019 Exploratory IT Human Resources Project The MITOU Program.