codetools: CompleteLocalVariableAsParameter: trim space of type

git-svn-id: trunk@29908 -
This commit is contained in:
mattias 2011-03-19 13:51:37 +00:00
parent 3a715d162c
commit 910c1dfb56
3 changed files with 9 additions and 8 deletions

View File

@ -940,7 +940,7 @@ var
OldCodePos: TCodePosition;
Node: TCodeTreeNode;
begin
//DebugLn('TCodeCompletionCodeTool.AddLocalVariable A ');
//DebugLn('TCodeCompletionCodeTool.AddLocalVariable START ');
Result:=false;
CursorNode:=FindDeepestNodeAtPos(CleanCursorPos,true);
if not CleanPosToCodePos(CleanCursorPos,OldCodePos) then begin
@ -1024,8 +1024,8 @@ begin
end;
function TCodeCompletionCodeTool.AddVariable(CursorNode: TCodeTreeNode;
CleanCursorPos,
OldTopLine: integer; const VariableName, NewType, NewUnitName: string;
CleanCursorPos, OldTopLine: integer;
const VariableName, NewType, NewUnitName: string;
out NewPos: TCodeXYPosition;
out NewTopLine: integer; SourceChangeCache: TSourceChangeCache): boolean;
var
@ -1034,7 +1034,9 @@ var
VarType: String;
VarTypeUnitName: String;
begin
// ask what for location of new variable
//debugln(['TCodeCompletionCodeTool.AddVariable CursorNode=',CursorNode.DescAsString,
// ' VariableName="',VariableName,'" NewType="',NewType,'" NewUnitName="',NewUnitName,'"']);
// ask for location of new variable
VarLocation:=ncpvLocal;
VarType:=NewType;
VarTypeUnitName:=NewUnitName;
@ -1883,8 +1885,8 @@ begin
DebugLn(' CompleteLocalVariableAsParameter Parameter has no type');
exit;
end;
NewType:=copy(Params.NewCodeTool.Src,TypeNode.StartPos,
TypeNode.EndPos-TypeNode.StartPos);
NewType:=Trim(copy(Params.NewCodeTool.Src,TypeNode.StartPos,
TypeNode.EndPos-TypeNode.StartPos));
// ToDo: find unit of type declaration
MissingUnitName:=''; //GetUnitForUsesSection(Params.NewCodeTool);

View File

@ -21,7 +21,7 @@
Author: Mattias Gaertner
Abstract:
Demonstrating, how to add a method to a class and extending the uses section.
Demonstrating how to add a method to a class and extending the uses section.
}
program AddEventMethod;

View File

@ -14082,7 +14082,6 @@ begin
Variables[ExternalMacroStart+'FPCSrcDir']:=EnvironmentOptions.GetFPCSourceDirectory;
end;
debugln(['TMainIDE.InitCodeToolBoss AAA2']);
// the first template is the "use default" flag
CreateUseDefaultsFlagTemplate;