release 0.3.1

This commit is contained in:
geequlim
2017-09-22 23:57:26 +08:00
parent bc96a9462b
commit 4f0550ce86
12 changed files with 92126 additions and 87244 deletions

View File

@@ -123,7 +123,9 @@ class Config {
argstr += `${arg.type} ${arg.name}${arg.default_value.length>0?'='+arg.default_value:''}${m.arguments.indexOf(arg)==m.arguments.length-1?'':', '}`;
});
// mi.label=`${m.name}(${argstr}) ${m.qualifiers}`;
let mdoc = `${m.return_type} ${classdoc.name}.${m.name}(${argstr}) ${m.qualifiers}`;
let methodName = `${classdoc.name}.${m.name}`;
if (classdoc.name == m.name) methodName = m.name;
let mdoc = `${m.return_type} ${methodName}(${argstr}) ${m.qualifiers}`;
mdoc += " \n\n";
mdoc += m.description;
mi.documentation = mdoc;

View File

@@ -17,9 +17,7 @@ function genLink(title:string, uri:string, span=true):string {
function getProp(rawDoc:any, propname: string, action=(s :string)=>s): string {
let prop = rawDoc[propname];
if(prop && prop.length > 0)
prop = action(prop);
return prop;
return action(prop);
}
class GDScriptDocumentContentProvider implements TextDocumentContentProvider{
@@ -67,12 +65,18 @@ class GDScriptDocumentContentProvider implements TextDocumentContentProvider{
});
}
format_documentation(text: string): string {
let doc = text.replace(/\[code\]/g, "<code>").replace(/\[\/code\]/g, "</code>");
doc = doc.replace(/\[codeblock\]/g, '<pre><code class="gdscript">').replace(/\[\/codeblock]/g, "</code></pre>");
return doc;
};
genMethodDoc(mDoc:any):string {
let ret_type = getProp(mDoc, "return_type", (type:string):string =>{
if(type.length > 0)
return `${genLink(type,type)} `;
else
return "<b>void</b>";
return "void";
});
let args = "";
for(let arg of mDoc.arguments){
@@ -96,7 +100,7 @@ class GDScriptDocumentContentProvider implements TextDocumentContentProvider{
if(type.length > 0)
return `${genLink(type,type)} `;
else
return "<b>void</b>";
return "void";
});
let args = "";
for(let arg of mDoc.arguments){
@@ -274,7 +278,7 @@ class GDScriptDocumentContentProvider implements TextDocumentContentProvider{
<p>${props}</p>
<p>${methods}</p>
`;
return doc;
return this.format_documentation(doc);
}
}

View File

@@ -104,11 +104,17 @@ class GDScriptHoverProvider implements HoverProvider {
}
};
const format_documentation = (text) => {
let doc = text.replace(/\[code\]/g, "`").replace(/\[\/code\]/g, "`");
doc = doc.replace(/\[codeblock\]/g, "\n```gdscript\n").replace(/\[\/codeblock]/g, "\n```");
return doc;
};
// check from builtin
const genBuiltinTips = ()=> {
const item2MarkdStrings = (name: string,item: CompletionItem, rowDoc: any):MarkedString[] => {
let value = "";
let doc = item.documentation;
let doc = format_documentation(item.documentation);
// get class name
let classname = name;
let matchs = name.match(/[@A-z][A-z0-9]*\./);
@@ -120,8 +126,7 @@ class GDScriptHoverProvider implements HoverProvider {
const genMethodMarkDown = ():string =>{
let content = `${genLink(rowDoc.return_type, rowDoc.return_type)} `;
let matchs = name.match(/[@A-z][A-z0-9]*\./);
content += `${genLink(classname, classname)}.`;
if (rowDoc.name != classname) content += `${genLink(classname, classname)}.`;
let args = "";
for(let arg of rowDoc.arguments){
if(rowDoc.arguments.indexOf(arg)!=0)
@@ -130,7 +135,7 @@ class GDScriptHoverProvider implements HoverProvider {
if(arg.default_value && arg.default_value.length > 0)
args += `=${arg.default_value}`;
}
content += `${genLink(rowDoc.name, classname+'.'+rowDoc.name)}(${args}) ${rowDoc.qualifiers}`;
content += `${genLink(rowDoc.name, classname+'.' + rowDoc.name)}(${args}) ${rowDoc.qualifiers}`;
return content;
};
@@ -138,10 +143,10 @@ class GDScriptHoverProvider implements HoverProvider {
case CompletionItemKind.Class:
return [`Native Class ${genLink(classname, classname)}`, doc];
case CompletionItemKind.Method:
doc = item.documentation.substring(item.documentation.indexOf("\n")+1, item.documentation.length);
doc = doc.substring(doc.indexOf("\n")+1, doc.length);
return [genMethodMarkDown(), doc];
case CompletionItemKind.Interface:
doc = item.documentation.substring(item.documentation.indexOf("\n")+1, item.documentation.length);
doc = doc.substring(doc.indexOf("\n")+1, doc.length);
return ['signal ' + genMethodMarkDown(), doc];
case CompletionItemKind.Variable:
case CompletionItemKind.Property:

View File

@@ -20,8 +20,7 @@ class ToolManager {
private _context: vscode.ExtensionContext;
private _projectFile : string = "engine.cfg";
private _rootDir : string = "";
private _biuitinDocFile : string = "doc/classes.json";
private _biuitinDocFile : string = "doc/classes-2.1.json";
constructor(context: vscode.ExtensionContext) {
this._context = context;