Skip to content

Instantly share code, notes, and snippets.

@nondanee
Last active February 16, 2019 09:20
Show Gist options
  • Save nondanee/dcc46991dd399eb22f277b7052d3f6fa to your computer and use it in GitHub Desktop.
Save nondanee/dcc46991dd399eb22f277b7052d3f6fa to your computer and use it in GitHub Desktop.
[VSC] Beijing Third District Transportation Committee
const fs = require('fs')
const path = require('path')
const appDir = 'C:\\Program Files\\Microsoft VS Code\\resources\\app\\out'
const fsOptions = {encoding: 'utf8'}
const fileName = 'vs/workbench/workbench.main.js'
const filePath = path.join(appDir, fileName)
const patches = [
[
/(<h1 class="caption">').+?('<\/h1>)/g,
'$1+\'' + 'Visual Studio Code 提醒您' + '\'+$2',
'$1+i.escape(n.localize(0,null))+$2',
],
[
/(<p class="subtitle detail">').+?('<\/p>)/g,
'$1+\'' + '代码千万行 文档第一行<br><br>命名不规范 同事两行泪' + '\'+$2',
'$1+i.escape(n.localize(1,null))+$2',
]
]
const content = fs.readFileSync(filePath, fsOptions)
const patched = patches.reduce((result, rule) => result.replace(rule[0], rule[1]), content)
fs.writeFileSync(filePath, patched, fsOptions)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment