mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-02 03:42:01 +02:00
codetools: adding missing semicolon on code completing classes
git-svn-id: trunk@10140 -
This commit is contained in:
parent
0b3a85d0e6
commit
dead2dc443
@ -139,6 +139,7 @@ type
|
|||||||
procedure InsertNewClassParts(PartType: TNewClassPart);
|
procedure InsertNewClassParts(PartType: TNewClassPart);
|
||||||
function InsertAllNewClassParts: boolean;
|
function InsertAllNewClassParts: boolean;
|
||||||
function InsertClassHeaderComment: boolean;
|
function InsertClassHeaderComment: boolean;
|
||||||
|
function InsertMissingClassSemicolons: boolean;
|
||||||
function InsertAllNewUnitsToMainUsesSection: boolean;
|
function InsertAllNewUnitsToMainUsesSection: boolean;
|
||||||
function CreateMissingProcBodies: boolean;
|
function CreateMissingProcBodies: boolean;
|
||||||
function NodeExtIsVariable(ANodeExt: TCodeTreeNodeExtension): boolean;
|
function NodeExtIsVariable(ANodeExt: TCodeTreeNodeExtension): boolean;
|
||||||
@ -1893,6 +1894,9 @@ begin
|
|||||||
Result:=InsertClassHeaderComment;
|
Result:=InsertClassHeaderComment;
|
||||||
if not Result then exit;
|
if not Result then exit;
|
||||||
|
|
||||||
|
Result:=InsertMissingClassSemicolons;
|
||||||
|
if not Result then exit;
|
||||||
|
|
||||||
if FirstInsert=nil then begin
|
if FirstInsert=nil then begin
|
||||||
Result:=true;
|
Result:=true;
|
||||||
exit;
|
exit;
|
||||||
@ -1965,6 +1969,41 @@ begin
|
|||||||
InsertPos,InsertPos,Code);
|
InsertPos,InsertPos,Code);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCodeCompletionCodeTool.InsertMissingClassSemicolons: boolean;
|
||||||
|
var
|
||||||
|
ANode: TCodeTreeNode;
|
||||||
|
ProcCode: String;
|
||||||
|
begin
|
||||||
|
Result:=false;
|
||||||
|
ANode:=FCompletingStartNode;
|
||||||
|
while (ANode<>nil) do begin
|
||||||
|
if ANode.Desc=ctnProcedure then begin
|
||||||
|
ProcCode:=ExtractProcHead(ANode,[phpWithStart,
|
||||||
|
phpWithoutClassKeyword,
|
||||||
|
phpWithVarModifiers,phpWithParameterNames,phpWithResultType,
|
||||||
|
phpWithCallingSpecs,phpDoNotAddSemicolon]);
|
||||||
|
if ProcCode[length(ProcCode)]<>';' then begin
|
||||||
|
// add missing semicolon
|
||||||
|
UndoReadNextAtom;
|
||||||
|
if not ASourceChangeCache.Replace(gtNone,gtNone,
|
||||||
|
CurPos.EndPos,CurPos.EndPos,';') then
|
||||||
|
RaiseException('InsertMissingClassSemicolons: unable to insert semicolon');
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
// next node
|
||||||
|
if ANode.NextBrother<>nil then begin
|
||||||
|
ANode:=ANode.NextBrother;
|
||||||
|
end else begin
|
||||||
|
ANode:=ANode.Parent.NextBrother;
|
||||||
|
while (ANode<>nil) and (ANode.Desc in (AllCodeSections+AllClassSections))
|
||||||
|
and (ANode.FirstChild=nil) do
|
||||||
|
ANode:=ANode.NextBrother;
|
||||||
|
if ANode<>nil then ANode:=ANode.FirstChild;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
Result:=true;
|
||||||
|
end;
|
||||||
|
|
||||||
function TCodeCompletionCodeTool.InsertAllNewUnitsToMainUsesSection: boolean;
|
function TCodeCompletionCodeTool.InsertAllNewUnitsToMainUsesSection: boolean;
|
||||||
var
|
var
|
||||||
UsesNode: TCodeTreeNode;
|
UsesNode: TCodeTreeNode;
|
||||||
|
Loading…
Reference in New Issue
Block a user