mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 08:19:29 +02:00
ide+codetools: less hints
This commit is contained in:
parent
74f240f5f3
commit
68920c7d01
@ -238,7 +238,7 @@ type
|
|||||||
constructor Create;
|
constructor Create;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure Clear;
|
procedure Clear;
|
||||||
procedure AddIndent(Typ, SubType: TFABBlockType; SrcPos, Indent: integer);
|
procedure AddIndent(Typ, SubType: TFABBlockType; {%H-}SrcPos, Indent: integer);
|
||||||
function GetSmallestIndent(Typ: TFABBlockType): integer;// -1 if none found
|
function GetSmallestIndent(Typ: TFABBlockType): integer;// -1 if none found
|
||||||
function GetIndent(Typ, SubType: TFABBlockType;
|
function GetIndent(Typ, SubType: TFABBlockType;
|
||||||
UseNoneIfNotFound,
|
UseNoneIfNotFound,
|
||||||
|
@ -813,7 +813,7 @@ begin
|
|||||||
Result:=(ANodeExt.Flags=ord(ncpPublishedVars))
|
Result:=(ANodeExt.Flags=ord(ncpPublishedVars))
|
||||||
or (ANodeExt.Flags=ord(ncpPublishedProcs));
|
or (ANodeExt.Flags=ord(ncpPublishedProcs));
|
||||||
else
|
else
|
||||||
Result:=false;
|
Result:=false{%H-};
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -6559,7 +6559,7 @@ begin
|
|||||||
ctdcsUnitSet: Result:=GetUnitSetIDForDirectory(ADirectory,false);
|
ctdcsUnitSet: Result:=GetUnitSetIDForDirectory(ADirectory,false);
|
||||||
ctdcsFPCUnitPath: Result:=GetFPCUnitPathForDirectory(ADirectory,false);
|
ctdcsFPCUnitPath: Result:=GetFPCUnitPathForDirectory(ADirectory,false);
|
||||||
ctdcsNamespaces: Result:=GetNamespacesForDirectory(ADirectory,false);
|
ctdcsNamespaces: Result:=GetNamespacesForDirectory(ADirectory,false);
|
||||||
else RaiseCatchableException('');
|
else RaiseCatchableException(''){%H-};
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -812,7 +812,7 @@ var
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
else
|
else
|
||||||
exit;
|
exit{%H-};
|
||||||
end;
|
end;
|
||||||
Result:=true;
|
Result:=true;
|
||||||
end;
|
end;
|
||||||
|
@ -978,6 +978,10 @@ type
|
|||||||
function FindUnitCaseInsensitive(var AnUnitName,
|
function FindUnitCaseInsensitive(var AnUnitName,
|
||||||
AnUnitInFilename: string): string;
|
AnUnitInFilename: string): string;
|
||||||
procedure GatherUnitAndSrcPath(var UnitPath, CompleteSrcPath: string);
|
procedure GatherUnitAndSrcPath(var UnitPath, CompleteSrcPath: string);
|
||||||
|
function GatherUnitFiles(const SearchPath,
|
||||||
|
Extensions, NameSpacePath: string; KeepDoubles, CaseInsensitive: boolean;
|
||||||
|
var TreeOfUnitFiles, TreeOfNamespaces: TAVLTree): boolean;
|
||||||
|
|
||||||
function SearchUnitInUnitSet(const TheUnitName: string): string;
|
function SearchUnitInUnitSet(const TheUnitName: string): string;
|
||||||
function GetNameSpaces: string;
|
function GetNameSpaces: string;
|
||||||
|
|
||||||
@ -3153,6 +3157,183 @@ begin
|
|||||||
//DebugLn('TFindDeclarationTool.GatherUnitAndSrcPath UnitPath="',UnitPath,'" CompleteSrcPath="',CompleteSrcPath,'"');
|
//DebugLn('TFindDeclarationTool.GatherUnitAndSrcPath UnitPath="',UnitPath,'" CompleteSrcPath="',CompleteSrcPath,'"');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TFindDeclarationTool.GatherUnitFiles(const SearchPath, Extensions,
|
||||||
|
NameSpacePath: string; KeepDoubles, CaseInsensitive: boolean;
|
||||||
|
var TreeOfUnitFiles, TreeOfNamespaces: TAVLTree): boolean;
|
||||||
|
{
|
||||||
|
SearchPath: semicolon separated list of directories
|
||||||
|
Extensions: semicolon separated list of extensions (e.g. 'pas;.pp;ppu')
|
||||||
|
NameSpacePath: gather files only from this namespace path, empty '' for all
|
||||||
|
KeepDoubles: false to return only the first match of each unit
|
||||||
|
CaseInsensitive: true to ignore case on comparing extensions
|
||||||
|
TreeOfUnitFiles: tree of TUnitFileInfo
|
||||||
|
TreeOfNamespaces: tree of TNameSpaceInfo }
|
||||||
|
var
|
||||||
|
SearchedDirectories: TAVLTree; // tree of AnsiString
|
||||||
|
|
||||||
|
function DirectoryAlreadySearched(const ADirectory: string): boolean;
|
||||||
|
begin
|
||||||
|
Result:=(SearchedDirectories<>nil)
|
||||||
|
and (SearchedDirectories.Find(Pointer(ADirectory))<>nil);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure MarkDirectoryAsSearched(const ADirectory: string);
|
||||||
|
var
|
||||||
|
s: String;
|
||||||
|
begin
|
||||||
|
// increase refcount
|
||||||
|
//DebugLn('MarkDirectoryAsSearched ',ADirectory);
|
||||||
|
s:=ADirectory; // increase refcount
|
||||||
|
if SearchedDirectories=nil then
|
||||||
|
SearchedDirectories:=TAVLTree.Create(@CompareAnsiStringFilenames);
|
||||||
|
SearchedDirectories.Add(Pointer(s));
|
||||||
|
Pointer(s):=nil; // keep refcount
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure FreeSearchedDirectories;
|
||||||
|
var
|
||||||
|
ANode: TAVLTreeNode;
|
||||||
|
s: String;
|
||||||
|
begin
|
||||||
|
if SearchedDirectories=nil then exit;
|
||||||
|
s:='';
|
||||||
|
ANode:=SearchedDirectories.FindLowest;
|
||||||
|
while ANode<>nil do begin
|
||||||
|
Pointer(s):=ANode.Data;
|
||||||
|
//DebugLn('FreeSearchedDirectories ',s);
|
||||||
|
s:=''; // decrease refcount
|
||||||
|
ANode:=SearchedDirectories.FindSuccessor(ANode);
|
||||||
|
end;
|
||||||
|
if s='' then ;
|
||||||
|
SearchedDirectories.Free;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function ExtensionFits(const Filename: string): boolean;
|
||||||
|
var
|
||||||
|
ExtStart: Integer;
|
||||||
|
ExtLen: Integer; // length without '.'
|
||||||
|
CurExtStart: Integer;
|
||||||
|
CurExtEnd: LongInt;
|
||||||
|
CompareCaseInsensitive: Boolean;
|
||||||
|
p: Integer;
|
||||||
|
begin
|
||||||
|
CompareCaseInsensitive:=CaseInsensitive;
|
||||||
|
{$IFDEF Windows}
|
||||||
|
CompareCaseInsensitive:=true;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
ExtStart:=length(Filename);
|
||||||
|
while (ExtStart>=1) and (not (Filename[ExtStart] in [PathDelim,'.'])) do
|
||||||
|
dec(ExtStart);
|
||||||
|
if (ExtStart>0) and (Filename[ExtStart]='.') then begin
|
||||||
|
// filename has an extension
|
||||||
|
ExtLen:=length(Filename)-ExtStart;
|
||||||
|
inc(ExtStart);
|
||||||
|
CurExtStart:=1;
|
||||||
|
while (CurExtStart<=length(Extensions)) do begin
|
||||||
|
// skip '.'
|
||||||
|
if Extensions[CurExtStart]='.' then inc(CurExtStart);
|
||||||
|
// read till semicolon
|
||||||
|
CurExtEnd:=CurExtStart;
|
||||||
|
while (CurExtEnd<=length(Extensions)) and (Extensions[CurExtEnd]<>';')
|
||||||
|
do
|
||||||
|
inc(CurExtEnd);
|
||||||
|
if (CurExtEnd>CurExtStart) and (CurExtEnd-CurExtStart=ExtLen) then begin
|
||||||
|
// compare extension
|
||||||
|
p:=ExtLen-1;
|
||||||
|
while (p>=0) do begin
|
||||||
|
if CompareCaseInsensitive then begin
|
||||||
|
if UpChars[Filename[ExtStart+p]]
|
||||||
|
<>UpChars[Extensions[CurExtStart+p]]
|
||||||
|
then
|
||||||
|
break;
|
||||||
|
end else begin
|
||||||
|
if Filename[ExtStart+p]<>Extensions[CurExtStart+p] then
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
dec(p);
|
||||||
|
end;
|
||||||
|
if p<0 then begin
|
||||||
|
// extension fit
|
||||||
|
Result:=true;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
CurExtStart:=CurExtEnd+1;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
Result:=false;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure CollectFile(const aFilename: string);
|
||||||
|
begin
|
||||||
|
if ExtensionFits(aFilename) then
|
||||||
|
AddToTreeOfUnitFilesOrNamespaces(TreeOfUnitFiles, TreeOfNamespaces,
|
||||||
|
NameSpacePath, aFilename, CaseInsensitive, KeepDoubles);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function SearchDirectory(const ADirectory: string): boolean;
|
||||||
|
var
|
||||||
|
Cache: TCTDirectoryBaseCache;
|
||||||
|
StarCache: TCTStarDirectoryCache;
|
||||||
|
DirCache: TCTDirectoryCache;
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
Result:=true;
|
||||||
|
//DebugLn('SearchDirectory ADirectory="',ADirectory,'"');
|
||||||
|
if DirectoryAlreadySearched(ADirectory) then exit;
|
||||||
|
MarkDirectoryAsSearched(ADirectory);
|
||||||
|
//DebugLn('SearchDirectory searching ...');
|
||||||
|
|
||||||
|
Cache:=DirectoryCache.Pool.GetBaseCache(ADirectory);
|
||||||
|
if Cache=nil then exit;
|
||||||
|
Cache.UpdateListing;
|
||||||
|
if Cache is TCTStarDirectoryCache then
|
||||||
|
begin
|
||||||
|
StarCache:=TCTStarDirectoryCache(Cache);
|
||||||
|
for i:=0 to StarCache.Listing.Count-1 do
|
||||||
|
CollectFile(StarCache.Listing.GetSubDirFilename(i));
|
||||||
|
end else if Cache is TCTDirectoryCache then begin
|
||||||
|
DirCache:=TCTDirectoryCache(Cache);
|
||||||
|
for i:=0 to DirCache.Listing.Count-1 do
|
||||||
|
CollectFile(DirCache.Directory+DirCache.Listing.GetFilename(i));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
PathStartPos: Integer;
|
||||||
|
PathEndPos: LongInt;
|
||||||
|
CurDir, BaseDir: String;
|
||||||
|
begin
|
||||||
|
Result:=false;
|
||||||
|
SearchedDirectories:=nil;
|
||||||
|
try
|
||||||
|
// search all paths in SearchPath
|
||||||
|
BaseDir:=ExtractFilePath(MainFilename);
|
||||||
|
PathStartPos:=1;
|
||||||
|
while PathStartPos<=length(SearchPath) do begin
|
||||||
|
PathEndPos:=PathStartPos;
|
||||||
|
while (PathEndPos<=length(SearchPath)) and (SearchPath[PathEndPos]<>';')
|
||||||
|
do
|
||||||
|
inc(PathEndPos);
|
||||||
|
if PathEndPos>PathStartPos then begin
|
||||||
|
CurDir:=AppendPathDelim(TrimFilename(
|
||||||
|
copy(SearchPath,PathStartPos,PathEndPos-PathStartPos)));
|
||||||
|
if not FilenameIsAbsolute(CurDir) then
|
||||||
|
CurDir:=AppendPathDelim(BaseDir)+CurDir;
|
||||||
|
if not SearchDirectory(CurDir) then exit;
|
||||||
|
end;
|
||||||
|
PathStartPos:=PathEndPos;
|
||||||
|
while (PathStartPos<=length(SearchPath))
|
||||||
|
and (SearchPath[PathStartPos]=';') do
|
||||||
|
inc(PathStartPos);
|
||||||
|
end;
|
||||||
|
Result:=true;
|
||||||
|
finally
|
||||||
|
FreeSearchedDirectories;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function TFindDeclarationTool.SearchUnitInUnitSet(const TheUnitName: string): string;
|
function TFindDeclarationTool.SearchUnitInUnitSet(const TheUnitName: string): string;
|
||||||
begin
|
begin
|
||||||
Result:=DirectoryCache.FindUnitInUnitSet(TheUnitName);
|
Result:=DirectoryCache.FindUnitInUnitSet(TheUnitName);
|
||||||
|
@ -475,7 +475,7 @@ begin
|
|||||||
ogetParentChild: Result:=10;
|
ogetParentChild: Result:=10;
|
||||||
ogetAncestorInherited: Result:=1;
|
ogetAncestorInherited: Result:=1;
|
||||||
ogetAliasOld: Result:=1;
|
ogetAliasOld: Result:=1;
|
||||||
else Result:=100;
|
else Result:=100{%H-};
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ begin
|
|||||||
OuterRadiusY:=(y2-y1)/2;
|
OuterRadiusY:=(y2-y1)/2;
|
||||||
InnerRadiusX:=OuterRadiusX*InnerSize;
|
InnerRadiusX:=OuterRadiusX*InnerSize;
|
||||||
InnerRadiusY:=OuterRadiusY*InnerSize;
|
InnerRadiusY:=OuterRadiusY*InnerSize;
|
||||||
SetLength(Points,OuterCnt*2+2);
|
SetLength(Points{%H-},OuterCnt*2+2);
|
||||||
j:=0;
|
j:=0;
|
||||||
// outer arc
|
// outer arc
|
||||||
for i:=0 to OuterCnt do begin
|
for i:=0 to OuterCnt do begin
|
||||||
|
@ -5600,7 +5600,7 @@ var
|
|||||||
p, StartP, EndP: PChar;
|
p, StartP, EndP: PChar;
|
||||||
|
|
||||||
const
|
const
|
||||||
space: char = ' ';
|
{%H-}space: char = ' ';
|
||||||
begin
|
begin
|
||||||
LastStreamPos:=ExtractMemStream.Position;
|
LastStreamPos:=ExtractMemStream.Position;
|
||||||
if LastAtoms.HasPrior then begin
|
if LastAtoms.HasPrior then begin
|
||||||
|
@ -602,7 +602,7 @@ var
|
|||||||
ParentNode: TCodeTreeNode;
|
ParentNode: TCodeTreeNode;
|
||||||
OldPos: TAtomPosition;
|
OldPos: TAtomPosition;
|
||||||
const
|
const
|
||||||
SemiColon : char = ';';
|
{%H-}SemiColon : char = ';';
|
||||||
|
|
||||||
procedure PrependName(const Prepend: string; var aPath: string);
|
procedure PrependName(const Prepend: string; var aPath: string);
|
||||||
begin
|
begin
|
||||||
|
@ -32,7 +32,7 @@ unit IDEOptionDefs;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, types,
|
Classes, SysUtils,
|
||||||
// LazUtils
|
// LazUtils
|
||||||
LazFileUtils, LazConfigStorage, Laz2_XMLCfg, LazUTF8,
|
LazFileUtils, LazConfigStorage, Laz2_XMLCfg, LazUTF8,
|
||||||
// BuildIntf
|
// BuildIntf
|
||||||
|
@ -301,7 +301,7 @@ function CreateBuildMatrixOptionGUID: string;
|
|||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
SetLength(Result,12);
|
SetLength(Result{%H-},12);
|
||||||
for i:=1 to length(Result) do
|
for i:=1 to length(Result) do
|
||||||
Result[i]:=chr(ord('0')+random(10));
|
Result[i]:=chr(ord('0')+random(10));
|
||||||
end;
|
end;
|
||||||
@ -728,7 +728,7 @@ begin
|
|||||||
l:=p-StartP;
|
l:=p-StartP;
|
||||||
while p^ in [#10,#13] do inc(p);
|
while p^ in [#10,#13] do inc(p);
|
||||||
if l=0 then continue; // skip empty strings
|
if l=0 then continue; // skip empty strings
|
||||||
SetLength(CurMode,l);
|
SetLength(CurMode{%H-},l);
|
||||||
System.Move(StartP^,CurMode[1],l);
|
System.Move(StartP^,CurMode[1],l);
|
||||||
if Assigned(SaveModes) and not SaveModes(CurMode) then continue;
|
if Assigned(SaveModes) and not SaveModes(CurMode) then continue;
|
||||||
// convert a single comma to double comma
|
// convert a single comma to double comma
|
||||||
|
Loading…
Reference in New Issue
Block a user