Skip to content

Commit c88c176

Browse files
committed
Update
1 parent cb06253 commit c88c176

File tree

4 files changed

+25
-21
lines changed

4 files changed

+25
-21
lines changed
Binary file not shown.

extension.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ const findFiles = require('./findFiles')
55
const fs = require('fs')
66
const { getProperties, getInput, getQuickPick } = require('./util')
77
const { UIString } = require('./constant')
8-
98
// fetch setting value from vscode's settings
109
// See package.json's contributes's configuration
11-
const maxLogDisplayCnt = vscode.workspace.getConfiguration().get('code.replacer.setting')
10+
const maxLogDisplayCnt = vscode.workspace.getConfiguration().get('Code-replacer.maxLogDisplayCnt')
1211

1312
/**
1413
* @param {vscode.ExtensionContext} context
@@ -92,7 +91,7 @@ const fetchLog = ({ jsonPath, keyName }) => {
9291

9392
const activate = (context) => {
9493
const disposable = vscode.commands.registerCommand(
95-
'code-replacer-vscode-plugin.entry',
94+
'Code-replacer.entry',
9695
async function () {
9796
if (
9897
!vscode.window.activeTextEditor ||
@@ -106,22 +105,20 @@ const activate = (context) => {
106105

107106
const currentlyOpenTabfilePath =
108107
vscode.window.activeTextEditor.document.fileName
109-
110108
const currentlyOpenTabfileName = path.basename(currentlyOpenTabfilePath)
111-
112-
const codeReplacerPath = `${__dirname}${path.sep}node_modules${path.sep}code-replacer${path.sep}dist`
113-
const binPath = path.resolve(`${codeReplacerPath}${path.sep}index.js`)
114-
const envPath = path.resolve(`${codeReplacerPath}${path.sep}${'.env'}`)
109+
const pathSep = process.platform === 'win32' ? `${path.sep}${path.sep}` : `${path.sep}`
110+
const codeReplacerPath = `${__dirname}${pathSep}node_modules${pathSep}code-replacer${pathSep}dist`
111+
const binPath = path.resolve(`${codeReplacerPath}${pathSep}index.js`)
112+
const envPath = path.resolve(`${codeReplacerPath}${pathSep}${'.env'}`)
115113
const usageLogPath = path.resolve(
116-
`${codeReplacerPath}${path.sep}usageLog.json`
114+
`${codeReplacerPath}${pathSep}usageLog.json`
117115
)
118116
const workspaceName = vscode.workspace.name
119117
const workspacePath = vscode.workspace.rootPath
120118
const csvFiles = await findFiles({
121119
dir: workspacePath,
122120
ext: 'csv'
123121
})
124-
125122
const selectedCSV = await getQuickPick({
126123
items: [UIString.EXIT, ...csvFiles],
127124
placeHolder: 'Select your csv file or type esc to pass csv option.'

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "code-replacer-vscode-plugin",
3-
"displayName": "code-replacer-vscode-plugin",
2+
"name": "code-replacer",
3+
"displayName": "Code replacer",
44
"description": "Replace codes line by line with regex for target files",
55
"author": "jopemachine",
66
"publisher": "jopemachine",
@@ -20,21 +20,28 @@
2020
"cope-replacing"
2121
],
2222
"activationEvents": [
23-
"onCommand:code-replacer-vscode-plugin.entry"
23+
"onCommand:Code-replacer.entry"
2424
],
2525
"main": "./extension.js",
2626
"contributes": {
2727
"commands": [
2828
{
29-
"command": "code-replacer-vscode-plugin.entry",
30-
"title": "rp",
29+
"command": "Code-replacer.entry",
30+
"title": "Replace the currently opened document.",
3131
"category": "Code-replacer"
3232
}
3333
],
34+
"keybindings": [
35+
{
36+
"command": "Code-replacer.entry",
37+
"key": "ctrl+alt+r",
38+
"mac": "ctrl+cmd+r"
39+
}
40+
],
3441
"configuration": {
35-
"title": "codeReplacerSetting",
42+
"title": "maxLogDisplayCnt",
3643
"properties": {
37-
"code.replacer.setting": {
44+
"Code-replacer.maxLogDisplayCnt": {
3845
"type": "integer",
3946
"default": 5,
4047
"description": "Please specify up to how many logs you want to display."
@@ -67,6 +74,6 @@
6774
},
6875
"dependencies": {
6976
"recursive-readdir": "^2.2.2",
70-
"code-replacer": "0.0.210"
77+
"code-replacer": "0.0.212"
7178
}
7279
}

0 commit comments

Comments
 (0)