From 910c1dfb566da10f4e356de6fabb6c873bdeb6a0 Mon Sep 17 00:00:00 2001 From: mattias Date: Sat, 19 Mar 2011 13:51:37 +0000 Subject: [PATCH] codetools: CompleteLocalVariableAsParameter: trim space of type git-svn-id: trunk@29908 - --- components/codetools/codecompletiontool.pas | 14 ++++++++------ components/codetools/examples/addeventmethod.lpr | 2 +- ide/main.pp | 1 - 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/components/codetools/codecompletiontool.pas b/components/codetools/codecompletiontool.pas index 8a7f886447..c123c6b2ea 100644 --- a/components/codetools/codecompletiontool.pas +++ b/components/codetools/codecompletiontool.pas @@ -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); diff --git a/components/codetools/examples/addeventmethod.lpr b/components/codetools/examples/addeventmethod.lpr index 9b7025a273..1c8557c7a8 100644 --- a/components/codetools/examples/addeventmethod.lpr +++ b/components/codetools/examples/addeventmethod.lpr @@ -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; diff --git a/ide/main.pp b/ide/main.pp index de4185a8b2..2ea6b9f9f1 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -14082,7 +14082,6 @@ begin Variables[ExternalMacroStart+'FPCSrcDir']:=EnvironmentOptions.GetFPCSourceDirectory; end; - debugln(['TMainIDE.InitCodeToolBoss AAA2']); // the first template is the "use default" flag CreateUseDefaultsFlagTemplate;