You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
899 B
41 lines
899 B
|
|
try {
|
|
|
|
const vscode = require("vscode")
|
|
const fs = require("fs")
|
|
const axios = require("axios")
|
|
|
|
let start = vscode.window.activeTextEditor.selection.start.line
|
|
let fileName = vscode.window.activeTextEditor.document.fileName
|
|
|
|
console.log(start)
|
|
console.log(fileName)
|
|
fs.readFile(fileName, 'utf8', (err, data) => {
|
|
if (err) throw err;
|
|
|
|
|
|
var context_arr = data.split("\n")
|
|
|
|
|
|
|
|
let a = context_arr[start].trim(" ")
|
|
|
|
console.log(a)
|
|
for (; a.indexOf(" ") > 0;) {
|
|
a = a.replace(" ", " ")
|
|
}
|
|
let b = a.split(" ")
|
|
if (b[0] != "type" || b[2] != "struct" || b[3] != "{") {
|
|
vscode.window.showErrorMessage("找不到结构")
|
|
return
|
|
}
|
|
let struct = b[1]
|
|
|
|
axios.get("")
|
|
console.log(struct)
|
|
})
|
|
|
|
} catch (error) {
|
|
|
|
console.log(error)
|
|
}
|