mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-07 12:16:20 +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,
|
||||
// LazUtils
|
||||
LazFileUtils, LazFileCache, LazMethodList, LazDbgLog, AvgLvlTree,
|
||||
LazUtilities,
|
||||
// Codetools
|
||||
FileProcs, BasicCodeTools, CodeToolsStrConsts,
|
||||
EventCodeTool, CodeTree, CodeAtom, SourceChanger, DefineTemplates, CodeCache,
|
||||
@ -1702,6 +1703,7 @@ function TCodeToolManager.GetNamespacesForDirectory(const Directory: string;
|
||||
var
|
||||
Evaluator: TExpressionEvaluator;
|
||||
FPCFullVersion: LongInt;
|
||||
UnitSet: TFPCUnitSetCache;
|
||||
begin
|
||||
if UseCache then begin
|
||||
Result:=DirectoryCachePool.GetString(Directory,ctdcsNamespaces,true)
|
||||
@ -1716,6 +1718,10 @@ begin
|
||||
if FPCFullVersion>=30101 then
|
||||
Result:=Evaluator[NamespacesMacroName];
|
||||
end;
|
||||
// add default unit scopes from compiler cfg
|
||||
UnitSet:=GetUnitSetForDirectory(Directory);
|
||||
if UnitSet<>nil then
|
||||
Result:=MergeWithDelimiter(Result,UnitSet.GetUnitScopes,';');
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -977,6 +977,7 @@ type
|
||||
procedure IncreaseChangeStamp;
|
||||
function GetUnitSetID: string;
|
||||
function GetFirstFPCCfg: string;
|
||||
function GetUnitScopes: string;
|
||||
end;
|
||||
|
||||
{ TCompilerDefinesCache }
|
||||
@ -8636,7 +8637,6 @@ var
|
||||
i: Integer;
|
||||
p: Integer;
|
||||
StartPos: Integer;
|
||||
Filename: String;
|
||||
begin
|
||||
Clear;
|
||||
|
||||
@ -10378,19 +10378,41 @@ function TFPCUnitSetCache.GetFirstFPCCfg: string;
|
||||
var
|
||||
Cfg: TPCTargetConfigCache;
|
||||
i: Integer;
|
||||
Files: TPCConfigFileStateList;
|
||||
begin
|
||||
Result:='';
|
||||
Cfg:=GetConfigCache(false);
|
||||
if Cfg=nil then exit;
|
||||
if Cfg.ConfigFiles=nil then exit;
|
||||
for i:=0 to Cfg.ConfigFiles.Count-1 do begin
|
||||
if Cfg.ConfigFiles[i].FileExists then begin
|
||||
Result:=Cfg.ConfigFiles[i].Filename;
|
||||
Files:=Cfg.ConfigFiles;
|
||||
if Files=nil then exit;
|
||||
for i:=0 to Files.Count-1 do begin
|
||||
if Files[i].FileExists then begin
|
||||
Result:=Files[i].Filename;
|
||||
exit;
|
||||
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
|
||||
InitDefaultFPCSourceRules;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user