Skip to content

Commit

Permalink
改变了一些接口名。 重构了typeInfer和codeSymbol
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartwang committed Dec 18, 2019
1 parent 361214f commit bb19e41
Show file tree
Hide file tree
Showing 9 changed files with 242 additions and 292 deletions.
2 changes: 1 addition & 1 deletion src/code/server/codeCompletion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export class CodeCompletion {
// 普通搜索。这里返回的必须是一个数组,哪怕是一个空数组
private static commonCompletionSearch(uri, searchPrefix){
//searchAllSymbolinRequireTreeforCompleting这个实际搜索函数中,应该包含数量控制逻辑
let retSymb = CodeSymbol.searchAllSymbolinRequireTreeforCompleting(uri, searchPrefix, Tools.SearchMode.PrefixMatch);
let retSymb = CodeSymbol.searchSymbolforCompletion(uri, searchPrefix, Tools.SearchMode.PrefixMatch);
if(!isArray(retSymb)){
return [];
}
Expand Down
4 changes: 2 additions & 2 deletions src/code/server/codeDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class CodeDefinition {

private static commonSearch(uri, symbolStr, method){
//做一次普通搜索
return CodeSymbol.searchAllSymbolinRequireTreeforCompleting(uri, symbolStr, method);
return CodeSymbol.searchSymbolforGlobalDefinition(uri, symbolStr, method);
}

//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -180,7 +180,7 @@ export class CodeDefinition {

// 按行号查询function
public static getFunctionInfoByLine(uri: string, line: number): { functionName: string, functionParam: string[] } {
let displaySymbolArray = CodeSymbol.getCertainDocSymbolsReturnArray(uri, null, Tools.SearchRange.AllSymbols);
let displaySymbolArray = CodeSymbol.getOneDocSymbolsArray(uri, null, Tools.SearchRange.AllSymbols);
let result = { functionName: "", functionParam: [] };
for (const key in displaySymbolArray) {
const docDisplaySymbol = displaySymbolArray[key];
Expand Down
12 changes: 6 additions & 6 deletions src/code/server/codeExport/cppCodeProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class CppCodeProcessor {

public static loadIntelliSenseRes() {
if (fs.existsSync(this.cppInterfaceIntelliSenseResPath)) {
CodeSymbol.refreshPreLoadSymbals(this.cppInterfaceIntelliSenseResPath);
CodeSymbol.refreshUserPreloadSymbals(this.cppInterfaceIntelliSenseResPath);
}
}

Expand Down Expand Up @@ -229,23 +229,23 @@ export class CppCodeProcessor {
if (result.className !== '') {
let filePath = path.join(this.cppInterfaceIntelliSenseResPath, subDir, result.className + '.lua');
this.appendText2File(result.luaText, filePath);
CodeSymbol.refreshSinglePreLoadFile(filePath);
CodeSymbol.refreshOneUserPreloadDocSymbols(filePath);
}
} else if (foundUSTRUCT === true) {
let result = this.handleUSTRUCT(child);
foundUSTRUCT = false;
if (result.structName !== '') {
let filePath = path.join(this.cppInterfaceIntelliSenseResPath, subDir, result.structName + '.lua');
this.appendText2File(result.luaText, filePath);
CodeSymbol.refreshSinglePreLoadFile(filePath);
CodeSymbol.refreshOneUserPreloadDocSymbols(filePath);
}
} else if (foundUENUM === true) {
let result = this.handleUENUM(child);
foundUENUM = false;
if (result.enumType !== '') {
let filePath = path.join(this.cppInterfaceIntelliSenseResPath, subDir, result.enumType + '.lua');
this.appendText2File(result.luaText, filePath);
CodeSymbol.refreshSinglePreLoadFile(filePath);
CodeSymbol.refreshOneUserPreloadDocSymbols(filePath);
}
// 外层有namespace的情况,要放到UENUM后面,UENUM后面的节点有可能是namespace
child.children.forEach((child: Node) => {
Expand Down Expand Up @@ -705,7 +705,7 @@ export class CppCodeProcessor {
let filePath = path.join(this.cppInterfaceIntelliSenseResPath, subDir, className + '.lua');
let luaText = this.assembleLuaClassText(className, baseClass, methodList);
this.appendText2File(luaText, filePath);
CodeSymbol.refreshSinglePreLoadFile(filePath);
CodeSymbol.refreshOneUserPreloadDocSymbols(filePath);
className = '';
baseClass.length = 0;
methodList.length = 0;
Expand Down Expand Up @@ -875,7 +875,7 @@ export class CppCodeProcessor {
// 删除preload symbol
// 先清空文件内容,然后刷新symbol,再删除文件。
fs.writeFileSync(currentPath, '');
CodeSymbol.refreshSinglePreLoadFile(currentPath);
CodeSymbol.refreshOneUserPreloadDocSymbols(currentPath);
fs.unlinkSync(currentPath);
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/code/server/codeExport/nativeCodeExportBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class NativeCodeExportBase {
// 如果文件存在,刷新
let dirPath = this.LuaPandaInterfaceIntelliSenseResPath;
if (fs.existsSync(dirPath)) {
CodeSymbol.refreshPreLoadSymbals(dirPath);
CodeSymbol.refreshUserPreloadSymbals(dirPath);
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/code/server/codeExport/sluaCSharpProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class SluaCSharpProcessor {

// 加载原生接口导出的分析结果
public static loadIntelliSenseRes() {
CodeSymbol.refreshPreLoadSymbals(this.sluaCSharpInterfaceIntelliSenseResPath);
CodeSymbol.refreshUserPreloadSymbals(this.sluaCSharpInterfaceIntelliSenseResPath);
}

// sluaUE的分析路径
Expand Down Expand Up @@ -40,7 +40,7 @@ export class SluaCSharpProcessor {
// 从cppDir中读出files列表
let files = this.getCSharpFiles(cppDir);
this.readSluaCSSymbols(files, subDir);
CodeSymbol.refreshPreLoadSymbals(intelLuaPath);
CodeSymbol.refreshUserPreloadSymbals(intelLuaPath);
Tools.showTips('处理完成!');
}

Expand Down Expand Up @@ -147,7 +147,7 @@ export class SluaCSharpProcessor {

}
// luaCode 写入文件
console.log(luaCode);
// console.log(luaCode);
return luaCode;
}
}
Loading

0 comments on commit bb19e41

Please sign in to comment.