mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-17 05:00:47 +01:00
IDE: code templates: added macro AddSemicolon
git-svn-id: trunk@53110 -
This commit is contained in:
parent
8a18022cc5
commit
9dbd2f1f15
@ -169,6 +169,10 @@ function CodeMacroAddMissingEnd(const {%H-}Parameter: string;
|
|||||||
{%H-}InteractiveValue: TPersistent;
|
{%H-}InteractiveValue: TPersistent;
|
||||||
SrcEdit: TSourceEditorInterface;
|
SrcEdit: TSourceEditorInterface;
|
||||||
var Value, {%H-}ErrorMsg: string): boolean;
|
var Value, {%H-}ErrorMsg: string): boolean;
|
||||||
|
function CodeMacroAddSemicolon(const {%H-}Parameter: string;
|
||||||
|
{%H-}InteractiveValue: TPersistent;
|
||||||
|
SrcEdit: TSourceEditorInterface;
|
||||||
|
var Value, {%H-}ErrorMsg: string): boolean;
|
||||||
function CodeMacroOfAll(const {%H-}Parameter: string; {%H-}InteractiveValue: TPersistent;
|
function CodeMacroOfAll(const {%H-}Parameter: string; {%H-}InteractiveValue: TPersistent;
|
||||||
SrcEdit: TSourceEditorInterface;
|
SrcEdit: TSourceEditorInterface;
|
||||||
var Value, ErrorMsg: string): boolean;
|
var Value, ErrorMsg: string): boolean;
|
||||||
@ -481,6 +485,29 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function CodeMacroAddSemicolon(const Parameter: string;
|
||||||
|
InteractiveValue: TPersistent; SrcEdit: TSourceEditorInterface; var Value,
|
||||||
|
ErrorMsg: string): boolean;
|
||||||
|
var
|
||||||
|
XY: TPoint;
|
||||||
|
Code: TCodeBuffer;
|
||||||
|
p, AtomStart: integer;
|
||||||
|
Src, Token: String;
|
||||||
|
begin
|
||||||
|
Result:=true;
|
||||||
|
Value:='';
|
||||||
|
XY:=SrcEdit.CursorTextXY;
|
||||||
|
if XY.y<1 then exit;
|
||||||
|
Code:=SrcEdit.CodeToolsBuffer as TCodeBuffer;
|
||||||
|
Code.LineColToPosition(XY.y,XY.x,p);
|
||||||
|
Src:=Code.Source;
|
||||||
|
ReadRawNextPascalAtom(Src,p,AtomStart,true,true);
|
||||||
|
Token:=lowercase(copy(Src,AtomStart,p-AtomStart));
|
||||||
|
if (Token='else') or (Token='do') or (Token=';') or (Token=')') or (Token=']') then
|
||||||
|
exit;
|
||||||
|
Value:=';';
|
||||||
|
end;
|
||||||
|
|
||||||
function CodeMacroOfAll(const Parameter: string; InteractiveValue: TPersistent;
|
function CodeMacroOfAll(const Parameter: string; InteractiveValue: TPersistent;
|
||||||
SrcEdit: TSourceEditorInterface; var Value, ErrorMsg: string): boolean;
|
SrcEdit: TSourceEditorInterface; var Value, ErrorMsg: string): boolean;
|
||||||
// completes
|
// completes
|
||||||
@ -772,6 +799,9 @@ begin
|
|||||||
RegisterCodeMacro('AddMissingEnd', lisInsertEndIfNeeded,
|
RegisterCodeMacro('AddMissingEnd', lisInsertEndIfNeeded,
|
||||||
lisCheckIfTheNextTokenInSourceIsAnEndAndIfNotReturnsL,
|
lisCheckIfTheNextTokenInSourceIsAnEndAndIfNotReturnsL,
|
||||||
@CodeMacroAddMissingEnd,nil);
|
@CodeMacroAddMissingEnd,nil);
|
||||||
|
RegisterCodeMacro('AddSemicolon', lisInsertSemicolonIfNeeded,
|
||||||
|
lisCheckTheNextTokenInSourceAndAddsASemicolonIfNeeded,
|
||||||
|
@CodeMacroAddSemicolon,nil);
|
||||||
RegisterCodeMacro('OfAll', lisListOfAllCaseValues,
|
RegisterCodeMacro('OfAll', lisListOfAllCaseValues,
|
||||||
lisReturnsListOfAllValuesOfCaseVariableInFrontOfVaria,
|
lisReturnsListOfAllValuesOfCaseVariableInFrontOfVaria,
|
||||||
@CodeMacroOfAll,nil);
|
@CodeMacroOfAll,nil);
|
||||||
|
|||||||
@ -5637,6 +5637,9 @@ resourcestring
|
|||||||
lisInsertEndIfNeeded = 'insert end if needed';
|
lisInsertEndIfNeeded = 'insert end if needed';
|
||||||
lisCheckIfTheNextTokenInSourceIsAnEndAndIfNotReturnsL = 'Check if the next '
|
lisCheckIfTheNextTokenInSourceIsAnEndAndIfNotReturnsL = 'Check if the next '
|
||||||
+'token in source is an "end" and if not return "LineEnding + end; + LineEnding".';
|
+'token in source is an "end" and if not return "LineEnding + end; + LineEnding".';
|
||||||
|
lisInsertSemicolonIfNeeded = 'Insert semicolon if needed';
|
||||||
|
lisCheckTheNextTokenInSourceAndAddsASemicolonIfNeeded = 'Check the next '
|
||||||
|
+'token in source and adds a semicolon if needed';
|
||||||
lisListOfAllCaseValues = 'list of all case values';
|
lisListOfAllCaseValues = 'list of all case values';
|
||||||
lisReturnsListOfAllValuesOfCaseVariableInFrontOfVaria = 'Return the list of '
|
lisReturnsListOfAllValuesOfCaseVariableInFrontOfVaria = 'Return the list of '
|
||||||
+'all values of case variable in front of variable.'#13
|
+'all values of case variable in front of variable.'#13
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user