AndreOneti / qml-formatter

Formatter, definition and autocomplete for QML language
MIT License
18 stars 2 forks source link

Jsdoc support. #21

Open AndreOneti opened 2 years ago

AndreOneti commented 2 years ago

Add support to define functions and signals with jsdoc and show on autocomplete.

AndreOneti commented 2 years ago

Maybe do using a an logic like

const fs = require('fs');

let data = fs.readFileSync("MyQmlFile.qml", { encoding: "utf-8" });

let regex = /\/\*\*\s*\n([^\*]|(\*(?!\/)))*\*\/\s*\n\s{0,}function.*/g

data.match(regex);

let list;

while ((list = regex.exec(data)) !== null) {
    let [jsdoc, funcName] = list[0].split("function");
    console.log(jsdoc, funcName.split("(")[0]);
}