mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-11 22:37:28 +02:00
codetools: use unit scopes from fpc output
git-svn-id: trunk@57844 -
This commit is contained in:
parent
c9e2e41f99
commit
7943f543f2
@ -43,6 +43,7 @@ uses
|
|||||||
Classes, SysUtils, contnrs, TypInfo, types, Laz_AVL_Tree,
|
Classes, SysUtils, contnrs, TypInfo, types, Laz_AVL_Tree,
|
||||||
// LazUtils
|
// LazUtils
|
||||||
LazFileUtils, LazFileCache, LazMethodList, LazDbgLog, AvgLvlTree,
|
LazFileUtils, LazFileCache, LazMethodList, LazDbgLog, AvgLvlTree,
|
||||||
|
LazUtilities,
|
||||||
// Codetools
|
// Codetools
|
||||||
FileProcs, BasicCodeTools, CodeToolsStrConsts,
|
FileProcs, BasicCodeTools, CodeToolsStrConsts,
|
||||||
EventCodeTool, CodeTree, CodeAtom, SourceChanger, DefineTemplates, CodeCache,
|
EventCodeTool, CodeTree, CodeAtom, SourceChanger, DefineTemplates, CodeCache,
|
||||||
@ -1702,6 +1703,7 @@ function TCodeToolManager.GetNamespacesForDirectory(const Directory: string;
|
|||||||
var
|
var
|
||||||
Evaluator: TExpressionEvaluator;
|
Evaluator: TExpressionEvaluator;
|
||||||
FPCFullVersion: LongInt;
|
FPCFullVersion: LongInt;
|
||||||
|
UnitSet: TFPCUnitSetCache;
|
||||||
begin
|
begin
|
||||||
if UseCache then begin
|
if UseCache then begin
|
||||||
Result:=DirectoryCachePool.GetString(Directory,ctdcsNamespaces,true)
|
Result:=DirectoryCachePool.GetString(Directory,ctdcsNamespaces,true)
|
||||||
@ -1716,6 +1718,10 @@ begin
|
|||||||
if FPCFullVersion>=30101 then
|
if FPCFullVersion>=30101 then
|
||||||
Result:=Evaluator[NamespacesMacroName];
|
Result:=Evaluator[NamespacesMacroName];
|
||||||
end;
|
end;
|
||||||
|
// add default unit scopes from compiler cfg
|
||||||
|
UnitSet:=GetUnitSetForDirectory(Directory);
|
||||||
|
if UnitSet<>nil then
|
||||||
|
Result:=MergeWithDelimiter(Result,UnitSet.GetUnitScopes,';');
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -977,6 +977,7 @@ type
|
|||||||
procedure IncreaseChangeStamp;
|
procedure IncreaseChangeStamp;
|
||||||
function GetUnitSetID: string;
|
function GetUnitSetID: string;
|
||||||
function GetFirstFPCCfg: string;
|
function GetFirstFPCCfg: string;
|
||||||
|
function GetUnitScopes: string;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TCompilerDefinesCache }
|
{ TCompilerDefinesCache }
|
||||||
@ -8636,7 +8637,6 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
p: Integer;
|
p: Integer;
|
||||||
StartPos: Integer;
|
StartPos: Integer;
|
||||||
Filename: String;
|
|
||||||
begin
|
begin
|
||||||
Clear;
|
Clear;
|
||||||
|
|
||||||
@ -10378,19 +10378,41 @@ function TFPCUnitSetCache.GetFirstFPCCfg: string;
|
|||||||
var
|
var
|
||||||
Cfg: TPCTargetConfigCache;
|
Cfg: TPCTargetConfigCache;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
|
Files: TPCConfigFileStateList;
|
||||||
begin
|
begin
|
||||||
Result:='';
|
Result:='';
|
||||||
Cfg:=GetConfigCache(false);
|
Cfg:=GetConfigCache(false);
|
||||||
if Cfg=nil then exit;
|
if Cfg=nil then exit;
|
||||||
if Cfg.ConfigFiles=nil then exit;
|
Files:=Cfg.ConfigFiles;
|
||||||
for i:=0 to Cfg.ConfigFiles.Count-1 do begin
|
if Files=nil then exit;
|
||||||
if Cfg.ConfigFiles[i].FileExists then begin
|
for i:=0 to Files.Count-1 do begin
|
||||||
Result:=Cfg.ConfigFiles[i].Filename;
|
if Files[i].FileExists then begin
|
||||||
|
Result:=Files[i].Filename;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TFPCUnitSetCache.GetUnitScopes: string;
|
||||||
|
var
|
||||||
|
Cfg: TPCTargetConfigCache;
|
||||||
|
Scopes: TStrings;
|
||||||
|
Scope: String;
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
Result:='';
|
||||||
|
Cfg:=GetConfigCache(false);
|
||||||
|
if Cfg=nil then exit;
|
||||||
|
Scopes:=Cfg.UnitScopes;
|
||||||
|
if Scopes=nil then exit;
|
||||||
|
for i:=0 to Scopes.Count-1 do begin
|
||||||
|
Scope:=Scopes[i];
|
||||||
|
if Scope='' then continue;
|
||||||
|
Result:=Result+';'+Scope;
|
||||||
|
end;
|
||||||
|
Delete(Result,1,1);
|
||||||
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
InitDefaultFPCSourceRules;
|
InitDefaultFPCSourceRules;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user