mirror of
https://github.com/moparisthebest/Simba
synced 2024-11-17 23:05:00 -05:00
Few changes.
This commit is contained in:
parent
2d8389be3e
commit
a1fb0742ab
@ -363,9 +363,9 @@ begin
|
|||||||
s := mp.GetExpressionAtPos;
|
s := mp.GetExpressionAtPos;
|
||||||
if (s <> '') then
|
if (s <> '') then
|
||||||
begin
|
begin
|
||||||
sp := LastDelimiter('.', s);
|
ep := LastDelimiter('.', s);
|
||||||
if (sp > 0) then
|
if (ep > 0) then
|
||||||
Delete(s, sp, Length(s) - sp + 1)
|
Delete(s, ep, Length(s) - ep + 1)
|
||||||
else
|
else
|
||||||
s := '';
|
s := '';
|
||||||
end;
|
end;
|
||||||
@ -377,7 +377,7 @@ begin
|
|||||||
if (Data = nil) then
|
if (Data = nil) then
|
||||||
begin
|
begin
|
||||||
mp.FillSynCompletionProposal(ItemList, InsertList, s);
|
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;
|
p.y := p.y + SynEdit.LineHeight;
|
||||||
SimbaForm.CodeCompletionForm.Show(p, ItemList, InsertList, Filter, SynEdit);
|
SimbaForm.CodeCompletionForm.Show(p, ItemList, InsertList, Filter, SynEdit);
|
||||||
end;
|
end;
|
||||||
@ -410,11 +410,15 @@ begin
|
|||||||
s := mp.GetExpressionAtPos(bcc, bck, cc,posi, true);
|
s := mp.GetExpressionAtPos(bcc, bck, cc,posi, true);
|
||||||
|
|
||||||
bracketpos := posi + length(s);
|
bracketpos := posi + length(s);
|
||||||
if pos('(',s) > 0 then
|
cc := LastDelimiter('(',s);
|
||||||
|
if cc > 0 then
|
||||||
begin;
|
begin;
|
||||||
bracketpos := pos('(',s) + posi;
|
bracketpos := cc + posi;
|
||||||
delete(s,pos('(',s),length(s) - pos('(',s) + 1);
|
delete(s, cc, length(s) - cc + 1);
|
||||||
end;
|
end;
|
||||||
|
cc := LastDelimiter('.',s);
|
||||||
|
if cc > 0 then
|
||||||
|
posi := posi + cc;
|
||||||
d := mp.FindVarBase(s);
|
d := mp.FindVarBase(s);
|
||||||
dd := nil;
|
dd := nil;
|
||||||
//Find the declaration -> For example if one uses var x : TNotifyEvent..
|
//Find the declaration -> For example if one uses var x : TNotifyEvent..
|
||||||
|
@ -613,10 +613,10 @@ var
|
|||||||
i,ii :integer;
|
i,ii :integer;
|
||||||
CursorXY : TPoint;
|
CursorXY : TPoint;
|
||||||
begin
|
begin
|
||||||
result := -1;
|
Result := -1;
|
||||||
|
MustHide := True;
|
||||||
if (FSynEdit = nil) then
|
if (FSynEdit = nil) then
|
||||||
Exit;
|
Exit;
|
||||||
MustHide := True;
|
|
||||||
Parser := TmwPasLex.Create; //The position of the bracket
|
Parser := TmwPasLex.Create; //The position of the bracket
|
||||||
try
|
try
|
||||||
Parser.Origin:= PChar(StringListPartToText(Point(FBracketPoint.x,FBracketPoint.y-1),
|
Parser.Origin:= PChar(StringListPartToText(Point(FBracketPoint.x,FBracketPoint.y-1),
|
||||||
@ -745,6 +745,10 @@ begin
|
|||||||
OnHide:=@ParamHintHide;
|
OnHide:=@ParamHintHide;
|
||||||
LastParameterIndex:= -1;
|
LastParameterIndex:= -1;
|
||||||
Application.AddOnIdleHandler(@ApplicationIdle);
|
Application.AddOnIdleHandler(@ApplicationIdle);
|
||||||
|
|
||||||
|
Fmp := nil;
|
||||||
|
FDecl := nil;
|
||||||
|
FSynEdit := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TParamHint.CalculateBounds;
|
procedure TParamHint.CalculateBounds;
|
||||||
@ -870,7 +874,7 @@ var
|
|||||||
continue;
|
continue;
|
||||||
end;
|
end;
|
||||||
StartPos := Pos;
|
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
|
begin
|
||||||
while ((Pos < length(line)) and (Line[Pos + 1] in ['a'..'z', 'A'..'Z', '0'..'9', '_'])) do
|
while ((Pos < length(line)) and (Line[Pos + 1] in ['a'..'z', 'A'..'Z', '0'..'9', '_'])) do
|
||||||
inc(pos);
|
inc(pos);
|
||||||
|
@ -153,7 +153,6 @@ begin
|
|||||||
end
|
end
|
||||||
else if DefineMatch then
|
else if DefineMatch then
|
||||||
begin
|
begin
|
||||||
|
|
||||||
//if (IncludeBuffer[i].LastChanged = lc) then
|
//if (IncludeBuffer[i].LastChanged = lc) then
|
||||||
begin
|
begin
|
||||||
ci.Lexer.LoadDefines(IncludeBuffer[i].DefinesOut);
|
ci.Lexer.LoadDefines(IncludeBuffer[i].DefinesOut);
|
||||||
@ -182,13 +181,16 @@ begin
|
|||||||
//Lexer.CloneDefinesFrom(ci.Lexer);
|
//Lexer.CloneDefinesFrom(ci.Lexer);
|
||||||
|
|
||||||
if (ci.Lexer.Defines.IndexOf('IS_INCLUDE') < 0) then
|
if (ci.Lexer.Defines.IndexOf('IS_INCLUDE') < 0) then
|
||||||
i := ci.Lexer.Defines.Add('IS_INCLUDE')
|
i := ci.Lexer.Defines.Add('IS_INCLUDE');
|
||||||
else
|
else
|
||||||
i := -1;
|
i := -1;
|
||||||
Run;
|
Run;
|
||||||
|
if (i > -1) then
|
||||||
|
begin
|
||||||
|
i := ci.Lexer.Defines.IndexOf('IS_INCLUDE');
|
||||||
if (i > -1) then
|
if (i > -1) then
|
||||||
ci.Lexer.Defines.Delete(i);
|
ci.Lexer.Defines.Delete(i);
|
||||||
|
end;
|
||||||
//DefinesOut := Lexer.SaveDefines; Weird bug, so moved out of the with statement
|
//DefinesOut := Lexer.SaveDefines; Weird bug, so moved out of the with statement
|
||||||
ci.Lexer.CloneDefinesFrom(Lexer);
|
ci.Lexer.CloneDefinesFrom(Lexer);
|
||||||
end;
|
end;
|
||||||
@ -475,7 +477,7 @@ begin
|
|||||||
c[3] := nil;
|
c[3] := nil;
|
||||||
end;
|
end;
|
||||||
else
|
else
|
||||||
Continue;
|
Break;
|
||||||
end;
|
end;
|
||||||
if (i = High(InFunc) + 1) then
|
if (i = High(InFunc) + 1) then
|
||||||
a := fItems.GetItemsOfClass(c[1])
|
a := fItems.GetItemsOfClass(c[1])
|
||||||
@ -664,7 +666,7 @@ begin
|
|||||||
Dec(StartPos);
|
Dec(StartPos);
|
||||||
while (StartPos > 0) and (s[StartPos] in [#10, #11, #13, #32]) do
|
while (StartPos > 0) and (s[StartPos] in [#10, #11, #13, #32]) do
|
||||||
Dec(StartPos);
|
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
|
begin
|
||||||
StartPos := i - BracketCount - BraceCount;
|
StartPos := i - BracketCount - BraceCount;
|
||||||
Break;
|
Break;
|
||||||
|
@ -112,8 +112,7 @@ type
|
|||||||
private
|
private
|
||||||
fProcType: string;
|
fProcType: string;
|
||||||
fParams: string;
|
fParams: string;
|
||||||
fSynParams: string;
|
fName: TciProcedureName;
|
||||||
fName : TciProcedureName;
|
|
||||||
fCleanDecl : string;
|
fCleanDecl : string;
|
||||||
|
|
||||||
function GetCleanDeclaration: string;
|
function GetCleanDeclaration: string;
|
||||||
@ -356,7 +355,7 @@ function TDeclarationList.GetItemsOfClass(AClass: TDeclarationClass; SubSearch:
|
|||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
if (Item is AClass) then
|
if ((Item = nil) and (AClass = nil)) or (Item is AClass) then
|
||||||
begin
|
begin
|
||||||
SetLength(Res, ResIndex + 1);
|
SetLength(Res, ResIndex + 1);
|
||||||
Res[ResIndex] := Item;
|
Res[ResIndex] := Item;
|
||||||
@ -384,7 +383,7 @@ function TDeclarationList.GetFirstItemOfClass(AClass: TDeclarationClass; SubSear
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
if (Item is AClass) then
|
if ((Item = nil) and (AClass = nil)) or (Item is AClass) then
|
||||||
begin
|
begin
|
||||||
Res := Item;
|
Res := Item;
|
||||||
Result := True;
|
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;
|
function IsOwner(Item: TDeclaration; AClass: TDeclarationClass; out Decl: TDeclaration; Recursive: Boolean): Boolean;
|
||||||
begin
|
begin
|
||||||
if (Item.Owner is AClass) then
|
if ((AClass = nil) and (Item.Owner = nil)) or (Item.Owner is AClass) then
|
||||||
begin
|
begin
|
||||||
Result := True;
|
Result := True;
|
||||||
Decl := Item.Owner;
|
Decl := Item.Owner;
|
||||||
@ -576,7 +575,7 @@ function TDeclaration.GetOwnersOfClass(AClass: TDeclarationClass): TDeclarationA
|
|||||||
var Res: TDeclarationArray;
|
var Res: TDeclarationArray;
|
||||||
var ResIndex: Integer);
|
var ResIndex: Integer);
|
||||||
begin
|
begin
|
||||||
if (Item.Owner is AClass) then
|
if ((AClass = nil) and (Item.Owner = nil)) or (Item.Owner is AClass) then
|
||||||
begin
|
begin
|
||||||
SetLength(Res, ResIndex + 1);
|
SetLength(Res, ResIndex + 1);
|
||||||
Res[ResIndex] := Item.Owner;
|
Res[ResIndex] := Item.Owner;
|
||||||
@ -597,6 +596,8 @@ end;
|
|||||||
|
|
||||||
constructor TDeclaration.Create(AParser: TmwSimplePasPar; AOwner: TDeclaration; AOrigin: PAnsiChar; AStart, AEnd: Integer);
|
constructor TDeclaration.Create(AParser: TmwSimplePasPar; AOwner: TDeclaration; AOrigin: PAnsiChar; AStart, AEnd: Integer);
|
||||||
begin
|
begin
|
||||||
|
inherited Create;
|
||||||
|
|
||||||
fParser := AParser;
|
fParser := AParser;
|
||||||
fOwner := AOwner;
|
fOwner := AOwner;
|
||||||
fOrigin := AOrigin;
|
fOrigin := AOrigin;
|
||||||
@ -797,7 +798,7 @@ begin
|
|||||||
if (LowerCase(fProcType) = 'class') then
|
if (LowerCase(fProcType) = 'class') then
|
||||||
begin
|
begin
|
||||||
Delete(s, 1, 6);
|
Delete(s, 1, 6);
|
||||||
fProcType := GetFirstWord(s);
|
fProcType := 'class ' + GetFirstWord(s);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if (fProcType = '') then
|
if (fProcType = '') then
|
||||||
@ -811,19 +812,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TciProcedureDeclaration.GetName: TciProcedureName;
|
function TciProcedureDeclaration.GetName: TciProcedureName;
|
||||||
var
|
|
||||||
ProcedureName : TciProcedureName;
|
|
||||||
begin
|
begin
|
||||||
if (fName <> nil) then
|
if (fName <> nil) then
|
||||||
result := fName
|
Result := fName
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
ProcedureName := TciProcedureName(fItems.GetFirstItemOfClass(TciProcedureName));
|
fName := TciProcedureName(fItems.GetFirstItemOfClass(TciProcedureName));
|
||||||
if ProcedureName <> nil then
|
Result := fName;
|
||||||
result := ProcedureName
|
|
||||||
else
|
|
||||||
Result := nil;
|
|
||||||
fName := result;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -835,11 +830,10 @@ begin
|
|||||||
result := fCleanDecl
|
result := fCleanDecl
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
result := '';
|
result := proctype;
|
||||||
if Name = nil then
|
if (Name <> nil) then
|
||||||
exit;
|
result := result + ' ' + Name.ShortText;
|
||||||
result := proctype + ' ' + Name.ShortText;
|
if (Params <> '') then
|
||||||
if Params <> '' then
|
|
||||||
result := result + '(' + params + ')';
|
result := result + '(' + params + ')';
|
||||||
Return := fItems.GetFirstItemOfClass(TciReturnType) as TciReturnType;
|
Return := fItems.GetFirstItemOfClass(TciReturnType) as TciReturnType;
|
||||||
if (Return <> nil) then
|
if (Return <> nil) then
|
||||||
@ -849,7 +843,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TciProcedureDeclaration.GetParams: string;
|
function TciProcedureDeclaration.GetParams: string;
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
|
Loading…
Reference in New Issue
Block a user