From 9be47aa3c886ee5ce615e6e95064d39aaaff5b9f Mon Sep 17 00:00:00 2001 From: public_host Date: Tue, 20 Apr 2021 10:45:06 +0800 Subject: [PATCH] fix --- hasaki-gen-crud/hasaki-gen-crud.js | 74 +++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/hasaki-gen-crud/hasaki-gen-crud.js b/hasaki-gen-crud/hasaki-gen-crud.js index 99d5b55..1a9b431 100644 --- a/hasaki-gen-crud/hasaki-gen-crud.js +++ b/hasaki-gen-crud/hasaki-gen-crud.js @@ -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}`) + }) }); })