mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-26 01:19:36 +02:00
accelerated identifier completion
git-svn-id: trunk@6877 -
This commit is contained in:
parent
80090ba2b3
commit
33f3ea4927
@ -79,6 +79,8 @@ type
|
||||
);
|
||||
TIdentListItemFlags = set of TIdentListItemFlag;
|
||||
|
||||
{ TIdentifierListItem }
|
||||
|
||||
TIdentifierListItem = class
|
||||
private
|
||||
FNext: TIdentifierListItem;
|
||||
@ -110,6 +112,7 @@ type
|
||||
procedure UpdateBaseContext;
|
||||
function HasChilds: boolean;
|
||||
procedure Clear;
|
||||
function CompareParamList(CompareItem: TIdentifierListItem): integer;
|
||||
public
|
||||
property ParamList: string read GetParamList write SetParamList;
|
||||
end;
|
||||
@ -277,7 +280,7 @@ begin
|
||||
if Result<>0 then exit;
|
||||
|
||||
// then sort for ParamList (lower is better)
|
||||
Result:=AnsiCompareText(Item2.ParamList,Item1.ParamList);
|
||||
Result:=Item2.CompareParamList(Item1);
|
||||
end;
|
||||
|
||||
function CompareIdentListItemsForIdents(Data1, Data2: Pointer): integer;
|
||||
@ -293,7 +296,7 @@ begin
|
||||
if Result<>0 then exit;
|
||||
|
||||
// then sort for ParamList (lower is better)
|
||||
Result:=AnsiCompareText(Item2.ParamList,Item1.ParamList);
|
||||
Result:=Item2.CompareParamList(Item1);
|
||||
end;
|
||||
|
||||
function CompareIdentHistListItem(Data1, Data2: Pointer): integer;
|
||||
@ -307,6 +310,7 @@ begin
|
||||
Result:=CompareIdentifiers(PChar(Item2.Identifier),PChar(Item1.Identifier));
|
||||
if Result<>0 then exit;
|
||||
|
||||
//debugln('CompareIdentHistListItem ',Item2.Identifier,'=',Item1.Identifier);
|
||||
Result:=CompareIdentifiers(PChar(Item2.ParamList),PChar(Item1.ParamList));
|
||||
end;
|
||||
|
||||
@ -321,7 +325,8 @@ begin
|
||||
Result:=CompareIdentifiers(PChar(HistItem.Identifier),IdentItem.Identifier);
|
||||
if Result<>0 then exit;
|
||||
|
||||
Result:=AnsiCompareText(HistItem.ParamList,IdentItem.ParamList);
|
||||
debugln('CompareIdentItemWithHistListItem ',HistItem.Identifier,'=',GetIdentifier(IdentItem.Identifier));
|
||||
Result:=SysUtils.CompareText(HistItem.ParamList,IdentItem.ParamList);
|
||||
end;
|
||||
|
||||
type
|
||||
@ -970,11 +975,14 @@ end;
|
||||
function TIdentifierListItem.GetParamList: string;
|
||||
begin
|
||||
if not FParamListValid then begin
|
||||
if (Node<>nil) and (Node.Desc=ctnProcedure) then
|
||||
// Note: if you implement param lists for other than ctnProcedure, check
|
||||
// CompareParamList
|
||||
if (Node<>nil) and (Node.Desc=ctnProcedure) then begin
|
||||
FParamList:=Tool.ExtractProcHead(Node,
|
||||
[phpWithoutClassKeyword,phpWithoutClassName,
|
||||
phpWithoutName,phpInUpperCase])
|
||||
else
|
||||
phpWithoutName,phpInUpperCase]);
|
||||
//debugln('TIdentifierListItem.GetParamList A ',GetIdentifier(Identifier),' ',Tool.MainFilename,' ',dbgs(Node.StartPos));
|
||||
end else
|
||||
FParamList:='';
|
||||
FParamListValid:=true;
|
||||
end;
|
||||
@ -1106,6 +1114,23 @@ begin
|
||||
BaseExprType:=CleanExpressionType;
|
||||
end;
|
||||
|
||||
function TIdentifierListItem.CompareParamList(CompareItem: TIdentifierListItem
|
||||
): integer;
|
||||
begin
|
||||
Result:=0;
|
||||
if Self=CompareItem then exit;
|
||||
if (Node=CompareItem.Node) then exit;
|
||||
if (Node.Desc<>ctnProcedure) or (CompareItem.Node.Desc<>ctnProcedure) then
|
||||
exit;
|
||||
{DbgOut('TIdentifierListItem.CompareParamList ',GetIdentifier(Identifier),'=',GetIdentifier(CompareItem.Identifier));
|
||||
if Node<>nil then
|
||||
DbgOut(' Self=',Tool.MainFilename,' ',dbgs(Node.StartPos));
|
||||
if CompareItem.Node<>nil then
|
||||
DbgOut(' Other=',CompareItem.Tool.MainFilename,' ',dbgs(CompareItem.Node.StartPos));
|
||||
debugln('');}
|
||||
Result:=SysUtils.CompareText(ParamList,CompareItem.ParamList);
|
||||
end;
|
||||
|
||||
{ TIdentifierHistoryList }
|
||||
|
||||
procedure TIdentifierHistoryList.SetCapacity(const AValue: integer);
|
||||
|
@ -1922,12 +1922,12 @@ begin
|
||||
InputHistories.ApplyFileDialogSettings(OpenDialog);
|
||||
OpenDialog.Title:=lisOpenFile;
|
||||
OpenDialog.Options:=OpenDialog.Options+[ofAllowMultiSelect];
|
||||
OpenDialog.Filter:='Lazarus unit (*.pas;*.pp)|*.pas;*.pp'
|
||||
OpenDialog.Filter:='All files ('+GetAllFilesMask+')|'+GetAllFilesMask
|
||||
+'|Lazarus unit (*.pas;*.pp)|*.pas;*.pp'
|
||||
+'|Lazarus project (*.lpi)|*.lpi'
|
||||
+'|Lazarus form (*.lfm)|*.lfm'
|
||||
+'|Lazarus package (*.lpk)|*.lpk'
|
||||
+'|Lazarus project source (*.lpr)|*.lpr'
|
||||
+'|All files ('+GetAllFilesMask+')|'+GetAllFilesMask;
|
||||
+'|Lazarus project source (*.lpr)|*.lpr';
|
||||
if OpenDialog.Execute and (OpenDialog.Files.Count>0) then begin
|
||||
OpenFlags:=[ofAddToRecent];
|
||||
//debugln('TMainIDE.mnuOpenClicked OpenDialog.Files.Count=',dbgs(OpenDialog.Files.Count));
|
||||
@ -11457,6 +11457,9 @@ end.
|
||||
|
||||
{ =============================================================================
|
||||
$Log$
|
||||
Revision 1.852 2005/03/02 15:59:53 mattias
|
||||
accelerated identifier completion
|
||||
|
||||
Revision 1.851 2005/02/28 22:43:48 mattias
|
||||
implemented updating lrs files from lfm files
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
{$IFDEF Gtk1}
|
||||
const
|
||||
GDK_KEY_VoidSymbol = GDK_VoidSymbol;
|
||||
GDK_KEY_BackSpace = GDK_BackSpace;
|
||||
@ -1319,3 +1320,4 @@ const
|
||||
GDK_KEY_Hangul_J_KkogjiDalrinIeung = GDK_Hangul_J_KkogjiDalrinIeung;
|
||||
GDK_KEY_Hangul_J_YeorinHieuh = GDK_Hangul_J_YeorinHieuh;
|
||||
GDK_KEY_Korean_Won = GDK_Korean_Won;
|
||||
{$ENDIF}
|
||||
|
Loading…
Reference in New Issue
Block a user