编辑器

修正namespace 代码跳转问题
This commit is contained in:
JianjunLiu 2023-04-17 11:54:35 +08:00
parent b171538798
commit 13e5738b61
2 changed files with 63 additions and 19 deletions

View File

@ -1744,6 +1744,7 @@ type TTsfFileParser = class() //
public
function Create();
begin
FNsCaches := array();
fmsgcaches := array();
fiofs := ioFileseparator();
FCacheDir :=TS_GetUserProfileHome()+"TslSynMemo"+fiofs+"cmpCaches";// d["value"];
@ -1771,6 +1772,10 @@ type TTsfFileParser = class() //
begin
return DirSet(d["value"]);
end
"namespace":
begin
end
"getfinddirs":
begin
return FFindDirs;
@ -1797,17 +1802,35 @@ type TTsfFileParser = class() //
end
end
private
function addnsfile(us);
begin
if not ifarray(us) then return array();
r := us;
rl := length(r);
for i,v in us do
begin
for j,vj in FNsCaches[v] do
begin
if vj then
begin
r[rl++] := v+j;
end
end
end
return r;
end
function getinheriteds(r,m,dounits,us,uso,cs,cso);
begin
if not ifarray(us) then us := array();
if not ifarray(uso) then uso := array();
if not ifarray(cs) then cs := array();
if not ifarray(cso) then cso := array();
for i,v in r["units"] do
for i,v in addnsfile(r["units"]) do
begin
vfn := checknamespacename(v);
//vfn := checknamespacename(v);
vfn := v;
if m=(lowercase(vfn)+".tsf") then continue;
vi := LoadByName(vfn);
vi := LoadByName(vfn);
if vi then
begin
if vi["msg"] in dounits then
@ -1820,9 +1843,10 @@ type TTsfFileParser = class() //
getinheriteds(vi,m,dounits,us,uso,cs,cso);
end
end
for i,v in r["class"] do
for i,v in addnsfile(r["class"]) do
begin
vfn := checknamespacename(v);
vfn := v;
//vfn := checknamespacename(v);
if m=(lowercase(vfn)+".tsf") then continue;
vi := LoadByName(vfn);
if vi then
@ -1911,16 +1935,17 @@ type TTsfFileParser = class() //
//echo FFilePaths;
if FFilePaths and not(FFilePaths[v]) then continue; //已经排除
wd := vv["functions"][0];
if wd and ifarray(wd) and (wd0:=wd[0]) and wd0 and (v=lowercase(wd0)+vv["nspace"]+".tsf") then //
nns := vv["nspace"];
if wd and ifarray(wd) and (wd0:=wd[0]) and wd0 and (v=lowercase(wd0)+nns+".tsf") then //
begin
t := Formatfparams(wd)+" <locfunc> "+inttostr(vv["lines"][0]);
t := Formatfparams(wd)+" <locfunc"+nns+"> "+inttostr(vv["lines"][0]);
d[idx]["value"]:= wd0;
d[idx]["lvalue"] := lowercase(wd0);
d[idx]["vlen"] := length(wd0);
d[idx]["clen"] := length(t);
d[idx]["jump"] := true;
d[idx]["caption"] :=t;
d[idx]["file"] := wd0+vv["nspace"];
d[idx]["file"] := wd0+nns;
if od>=0 then d[idx]["order"] := od;
d[idx]["line"] := vv["lines"][0];
idx++;
@ -1931,7 +1956,7 @@ type TTsfFileParser = class() //
begin
wd0 := vv["words"][0];
if wd0 and ( (lowercase(wd0)+vv["nspace"]+".tsf")=v) then
if wd0 and ( (lowercase(wd0)+nns+".tsf")=v) then
begin
end else
@ -1939,11 +1964,11 @@ type TTsfFileParser = class() //
d[idx]["value"]:= wd0;
d[idx]["lvalue"] := lowercase(wd0);
d[idx]["vlen"] := length(wd0);
t := wd0+" <file>" ;
t := wd0+" <file"+nns+ ">" ;
d[idx]["jump"] := true;
d[idx]["caption"] := t;
d[idx]["clen"] := length(t);
d[idx]["file"] := wd0+vv["nspace"];
d[idx]["file"] := wd0+nns;
d[idx]["line"] := 1;
idx++;
end
@ -2061,7 +2086,6 @@ type TTsfFileParser = class() //
li := li .& 0x3FFFFFFF;
end
end
d[idx]["value"]:= v0;
lvl := lowercase(v0);
d[idx]["lvalue"]:= lvl;
@ -2128,7 +2152,7 @@ type TTsfFileParser = class() //
begin
fn := lowercase( v["FileName"]);
if FFileNames[fn] then return ;
if fn=mf then return ;
//if fn=mf then return ;
pfn := dir+fiofs+fn;
sz := v["Size"];
flt := v["Time"];
@ -2158,8 +2182,11 @@ type TTsfFileParser = class() //
r["name"] := fn;
if (aid := pos("@",fn)) then
begin
r["nspace"] := fn[aid:(length(fn)-4)];
r["name"] := fn[1:(aid-1)];
nn := fn[1:(aid-1)];
nns := fn[aid:(length(fn)-4)];
r["nspace"] := nns;
r["name"] := nn;
FNsCaches[nn][nns] := 1;
//echo "\r\nfn:",fn[aid:];
end else r["nspace"] := "";
r["msg"] := getmsgd_Crc32(rdd);//GetMsgdigest(rdd,0);
@ -2215,7 +2242,13 @@ type TTsfFileParser = class() //
if FCacheDir then
begin
fn := FCacheDir+fiofs+"lasttime"+fiofs+ModifyFname(n)+".t";
if importfile(ftstream(),"",fn,d)=1 then return d;
if importfile(ftstream(),"",fn,d)=1 and ifarray(d) then
begin
nns := d["nspace"];
nn := d["name"];
FNsCaches[nn][nns] := 1;
return d;
end
end
end
function ReadParseredFile(n,g); //读取解析的文件
@ -2242,6 +2275,14 @@ type TTsfFileParser = class() //
end
end
end
function setnamespace(ns);
begin
if FNamespace<>ns then
begin
FNamespace := ns;
ClearCache(FFindDirs?true:false);
end
end
function DirSet(d); //设置
begin
if not ifarray(d) then return FFindDirs;
@ -2250,7 +2291,7 @@ type TTsfFileParser = class() //
FFinddirsseted := true;
if ifarray(d) and d then
begin
cl := FFindDirs?true:falsse;
cl := FFindDirs?true:false;
FFindDirs := d;
ClearCache(cl);
end
@ -2265,6 +2306,7 @@ type TTsfFileParser = class() //
FFileNames := array();
FFilePaths := array();
FCacheS := array();
FNsCaches := array();
end
function filechanged(d);
begin
@ -2275,12 +2317,14 @@ type TTsfFileParser = class() //
FFileWorker;
FFilePaths;
FCacheS; //缓存
FNsCaches;
FCacheblk;
FFileNames; //文件名
FCacheDir; //缓存目录非 \结尾
FCacheList;//目录列表 以
//FCacheAbsFileName;//缓存概要
FFindDirs; //²éÕÒĿ¼
FFindDirs; //²éÕÒĿ¼
FNamespace; //±ðÃû
fmsgcaches;
function errtslcode(s); //判断 function procedure结尾搞不定

View File

@ -981,7 +981,7 @@ type TTslDebuga=class(TCustomControl)
end
"DebugInfo": //调试信息
begin
if "dbgdetach"=remotewaitinit(d)then return;
if "dbgdetach"=remotewaitinit(d)then return;
stk := magicgetarray(d,array("result","CmdData","CallStack")); //深度
if fremotedbugstart then
begin