Few changes.

This commit is contained in:
Niels 2010-05-24 11:06:39 +02:00
parent 2d8389be3e
commit a1fb0742ab
4 changed files with 41 additions and 38 deletions

View File

@ -363,9 +363,9 @@ begin
s := mp.GetExpressionAtPos;
if (s <> '') then
begin
sp := LastDelimiter('.', s);
if (sp > 0) then
Delete(s, sp, Length(s) - sp + 1)
ep := LastDelimiter('.', s);
if (ep > 0) then
Delete(s, ep, Length(s) - ep + 1)
else
s := '';
end;
@ -377,7 +377,7 @@ begin
if (Data = nil) then
begin
mp.FillSynCompletionProposal(ItemList, InsertList, s);
p := SynEdit.ClientToScreen(SynEdit.RowColumnToPixels(Point(ep, SynEdit.CaretY)));
p := SynEdit.ClientToScreen(SynEdit.RowColumnToPixels(Point(sp, SynEdit.CaretY)));
p.y := p.y + SynEdit.LineHeight;
SimbaForm.CodeCompletionForm.Show(p, ItemList, InsertList, Filter, SynEdit);
end;
@ -410,11 +410,15 @@ begin
s := mp.GetExpressionAtPos(bcc, bck, cc,posi, true);
bracketpos := posi + length(s);
if pos('(',s) > 0 then
cc := LastDelimiter('(',s);
if cc > 0 then
begin;
bracketpos := pos('(',s) + posi;
delete(s,pos('(',s),length(s) - pos('(',s) + 1);
bracketpos := cc + posi;
delete(s, cc, length(s) - cc + 1);
end;
cc := LastDelimiter('.',s);
if cc > 0 then
posi := posi + cc;
d := mp.FindVarBase(s);
dd := nil;
//Find the declaration -> For example if one uses var x : TNotifyEvent..

View File

@ -613,10 +613,10 @@ var
i,ii :integer;
CursorXY : TPoint;
begin
result := -1;
Result := -1;
MustHide := True;
if (FSynEdit = nil) then
Exit;
MustHide := True;
Parser := TmwPasLex.Create; //The position of the bracket
try
Parser.Origin:= PChar(StringListPartToText(Point(FBracketPoint.x,FBracketPoint.y-1),
@ -745,6 +745,10 @@ begin
OnHide:=@ParamHintHide;
LastParameterIndex:= -1;
Application.AddOnIdleHandler(@ApplicationIdle);
Fmp := nil;
FDecl := nil;
FSynEdit := nil;
end;
procedure TParamHint.CalculateBounds;
@ -870,7 +874,7 @@ var
continue;
end;
StartPos := Pos;
if (Line[Pos] in ['a'..'z', 'A'..'Z', '0'..'9', '_']) then //We are in a word, lets draw that completely ;)
if (Pos <= Length(Line)) and (Line[Pos] in ['a'..'z', 'A'..'Z', '0'..'9', '_']) then //We are in a word, lets draw that completely ;)
begin
while ((Pos < length(line)) and (Line[Pos + 1] in ['a'..'z', 'A'..'Z', '0'..'9', '_'])) do
inc(pos);

View File

@ -153,7 +153,6 @@ begin
end
else if DefineMatch then
begin
//if (IncludeBuffer[i].LastChanged = lc) then
begin
ci.Lexer.LoadDefines(IncludeBuffer[i].DefinesOut);
@ -182,13 +181,16 @@ begin
//Lexer.CloneDefinesFrom(ci.Lexer);
if (ci.Lexer.Defines.IndexOf('IS_INCLUDE') < 0) then
i := ci.Lexer.Defines.Add('IS_INCLUDE')
i := ci.Lexer.Defines.Add('IS_INCLUDE');
else
i := -1;
Run;
if (i > -1) then
ci.Lexer.Defines.Delete(i);
begin
i := ci.Lexer.Defines.IndexOf('IS_INCLUDE');
if (i > -1) then
ci.Lexer.Defines.Delete(i);
end;
//DefinesOut := Lexer.SaveDefines; Weird bug, so moved out of the with statement
ci.Lexer.CloneDefinesFrom(Lexer);
end;
@ -475,7 +477,7 @@ begin
c[3] := nil;
end;
else
Continue;
Break;
end;
if (i = High(InFunc) + 1) then
a := fItems.GetItemsOfClass(c[1])
@ -664,7 +666,7 @@ begin
Dec(StartPos);
while (StartPos > 0) and (s[StartPos] in [#10, #11, #13, #32]) do
Dec(StartPos);
if not ((LastWasDot and (s[StartPos] in ['a'..'z', 'A'..'Z', '0'..'9', '_', ']', ')'])) or ((not LastWasDot) and (s[StartPos] = '.'))) then
if (StartPos > 0) and (not ((LastWasDot and (s[StartPos] in ['a'..'z', 'A'..'Z', '0'..'9', '_', ']', ')'])) or ((not LastWasDot) and (s[StartPos] = '.')))) then
begin
StartPos := i - BracketCount - BraceCount;
Break;

View File

@ -112,8 +112,7 @@ type
private
fProcType: string;
fParams: string;
fSynParams: string;
fName : TciProcedureName;
fName: TciProcedureName;
fCleanDecl : string;
function GetCleanDeclaration: string;
@ -356,7 +355,7 @@ function TDeclarationList.GetItemsOfClass(AClass: TDeclarationClass; SubSearch:
var
i: Integer;
begin
if (Item is AClass) then
if ((Item = nil) and (AClass = nil)) or (Item is AClass) then
begin
SetLength(Res, ResIndex + 1);
Res[ResIndex] := Item;
@ -384,7 +383,7 @@ function TDeclarationList.GetFirstItemOfClass(AClass: TDeclarationClass; SubSear
i: Integer;
begin
Result := False;
if (Item is AClass) then
if ((Item = nil) and (AClass = nil)) or (Item is AClass) then
begin
Res := Item;
Result := True;
@ -549,7 +548,7 @@ function TDeclaration.HasOwnerClass(AClass: TDeclarationClass; out Declaration:
function IsOwner(Item: TDeclaration; AClass: TDeclarationClass; out Decl: TDeclaration; Recursive: Boolean): Boolean;
begin
if (Item.Owner is AClass) then
if ((AClass = nil) and (Item.Owner = nil)) or (Item.Owner is AClass) then
begin
Result := True;
Decl := Item.Owner;
@ -576,7 +575,7 @@ function TDeclaration.GetOwnersOfClass(AClass: TDeclarationClass): TDeclarationA
var Res: TDeclarationArray;
var ResIndex: Integer);
begin
if (Item.Owner is AClass) then
if ((AClass = nil) and (Item.Owner = nil)) or (Item.Owner is AClass) then
begin
SetLength(Res, ResIndex + 1);
Res[ResIndex] := Item.Owner;
@ -597,6 +596,8 @@ end;
constructor TDeclaration.Create(AParser: TmwSimplePasPar; AOwner: TDeclaration; AOrigin: PAnsiChar; AStart, AEnd: Integer);
begin
inherited Create;
fParser := AParser;
fOwner := AOwner;
fOrigin := AOrigin;
@ -797,7 +798,7 @@ begin
if (LowerCase(fProcType) = 'class') then
begin
Delete(s, 1, 6);
fProcType := GetFirstWord(s);
fProcType := 'class ' + GetFirstWord(s);
end;
if (fProcType = '') then
@ -811,19 +812,13 @@ begin
end;
function TciProcedureDeclaration.GetName: TciProcedureName;
var
ProcedureName : TciProcedureName;
begin
if (fName <> nil) then
result := fName
Result := fName
else
begin
ProcedureName := TciProcedureName(fItems.GetFirstItemOfClass(TciProcedureName));
if ProcedureName <> nil then
result := ProcedureName
else
Result := nil;
fName := result;
fName := TciProcedureName(fItems.GetFirstItemOfClass(TciProcedureName));
Result := fName;
end;
end;
@ -835,11 +830,10 @@ begin
result := fCleanDecl
else
begin
result := '';
if Name = nil then
exit;
result := proctype + ' ' + Name.ShortText;
if Params <> '' then
result := proctype;
if (Name <> nil) then
result := result + ' ' + Name.ShortText;
if (Params <> '') then
result := result + '(' + params + ')';
Return := fItems.GetFirstItemOfClass(TciReturnType) as TciReturnType;
if (Return <> nil) then
@ -849,7 +843,6 @@ begin
end;
end;
function TciProcedureDeclaration.GetParams: string;
var
i: Integer;