|
|
@ -72,43 +72,43 @@ try { |
|
|
|
vscode.window.showInputBox({ |
|
|
|
placeHolder: "请输入接口前缀,例如输入admin则填充为/admin/结构名/get|save..." |
|
|
|
}).then((prefix) => { |
|
|
|
// for (; prefix.indexOf(" ") > 0;) {
|
|
|
|
// prefix = prefix.replace(" ", " ")
|
|
|
|
// }
|
|
|
|
// prefix = prefix.replace(/ /g, "/")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// let endPosition = new vscode.Position(endLine, endChar)
|
|
|
|
// axios({
|
|
|
|
// method: 'get',
|
|
|
|
// url: 'http://git.ouxuan.net/3136352472/vscode-helper-js/raw/branch/master/hasaki-gen-crud/template.go',
|
|
|
|
// responseType: 'text'
|
|
|
|
// }).then(res => {
|
|
|
|
// console.log("123")
|
|
|
|
// let text = "" + res['data']
|
|
|
|
// let tmp = text.split("// ----------------------------temp------------------------------------")
|
|
|
|
|
|
|
|
// text = tmp[1]
|
|
|
|
// text = text.replace(/Temp3A60/g, struct)
|
|
|
|
// let structHeadLower = struct
|
|
|
|
// structHeadLower[0] = struct[0].toLocaleLowerCase()
|
|
|
|
// text = text.replace(/temp3A60/g, struct)
|
|
|
|
// text = text.replace(/Prefix3A60/g, prefix)
|
|
|
|
// console.log(text)
|
|
|
|
// console.log(endPosition)
|
|
|
|
|
|
|
|
// vscode.window.activeTextEditor.edit(function (textEditorEdit) {
|
|
|
|
// textEditorEdit.insert(
|
|
|
|
// endPosition,
|
|
|
|
// text,
|
|
|
|
// )
|
|
|
|
// })
|
|
|
|
// // vscode.window.showErrorMessage(res)
|
|
|
|
// }).catch(error => {
|
|
|
|
|
|
|
|
// vscode.window.showErrorMessage(`err:${error.message}`)
|
|
|
|
// })
|
|
|
|
for (; prefix.indexOf(" ") > 0;) { |
|
|
|
prefix = prefix.replace(" ", " ") |
|
|
|
} |
|
|
|
prefix = prefix.replace(/ /g, "/") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let endPosition = new vscode.Position(endLine, endChar) |
|
|
|
axios({ |
|
|
|
method: 'get', |
|
|
|
url: 'http://git.ouxuan.net/3136352472/vscode-helper-js/raw/branch/master/hasaki-gen-crud/template.go', |
|
|
|
responseType: 'text' |
|
|
|
}).then(res => { |
|
|
|
console.log("123") |
|
|
|
let text = "" + res['data'] |
|
|
|
let tmp = text.split("// ----------------------------temp------------------------------------") |
|
|
|
|
|
|
|
text = tmp[1] |
|
|
|
text = text.replace(/Temp3A60/g, struct) |
|
|
|
let structHeadLower = struct |
|
|
|
structHeadLower[0] = struct[0].toLocaleLowerCase() |
|
|
|
text = text.replace(/temp3A60/g, struct) |
|
|
|
text = text.replace(/Prefix3A60/g, prefix) |
|
|
|
console.log(text) |
|
|
|
console.log(endPosition) |
|
|
|
|
|
|
|
vscode.window.activeTextEditor.edit(function (textEditorEdit) { |
|
|
|
textEditorEdit.insert( |
|
|
|
endPosition, |
|
|
|
text, |
|
|
|
) |
|
|
|
}) |
|
|
|
// vscode.window.showErrorMessage(res)
|
|
|
|
}).catch(error => { |
|
|
|
|
|
|
|
vscode.window.showErrorMessage(`err:${error.message}`) |
|
|
|
}) |
|
|
|
}); |
|
|
|
|
|
|
|
}) |
|
|
|