IDE: fixed adding spaces for identifier completion adding method declarations to classes

git-svn-id: trunk@10479 -
This commit is contained in:
mattias 2007-01-19 16:48:20 +00:00
parent 32652db6f4
commit dd7b5ba113
4 changed files with 12 additions and 13 deletions

View File

@ -2236,8 +2236,8 @@ begin
+GetIndentStr(BeautifyCodeOptions.Indent)
+ProcCall+BeautifyCodeOptions.LineEnd
+'end;';
// Graeme
DebugLn(['TCodeCompletionCodeTool.CheckForOverrideAndAddInheritedCode ProcCode="',ProcCode,'"']);
ProcCode:=ASourceChangeCache.BeautifyCodeOptions.BeautifyProc(
ProcCode,0,false);
ANodeExt.ExtTxt3:=ProcCode;
end;
AnAVLNode:=ClassProcs.FindSuccessor(AnAVLNode);
@ -2258,14 +2258,11 @@ var
ProcCode:=ANodeExt.ExtTxt1;
ProcCode:=ASourceChangeCache.BeautifyCodeOptions.AddClassAndNameToProc(
ProcCode,TheClassName,'');
{ $IFDEF CTDEBUG}
// Graeme
{$IFDEF CTDEBUG}
DebugLn('CreateMissingProcBodies InsertProcBody ',TheClassName,' "',ProcCode,'"');
{ $ENDIF}
{$ENDIF}
ProcCode:=ASourceChangeCache.BeautifyCodeOptions.BeautifyProc(
ProcCode,Indent,ANodeExt.ExtTxt3='');
// Graeme
DebugLn(['CreateMissingProcBodies beautified ProcCode="',ProcCode,'"']);
ASourceChangeCache.Replace(gtEmptyLine,gtEmptyLine,InsertPos,InsertPos,
ProcCode);
if JumpToProcName='' then begin
@ -2292,8 +2289,6 @@ var
phpWithParameterNames,phpWithResultType,phpWithCallingSpecs]);
TheNodeExt.ExtTxt3:=ASourceChangeCache.BeautifyCodeOptions.BeautifyProc(
ProcCode,Indent,true);
// Graeme
DebugLn(['CreateCodeForMissingProcBody TheNodeExt.ExtTxt3="',TheNodeExt.ExtTxt3,'" ProcCode="',ProcCode,'"']);
end;
end;
end;

View File

@ -3686,7 +3686,7 @@ begin
CurPos.StartPos-LastAtomEndPos);
end else if (ExtractMemStream.Position>0) then
begin
// some code was skipped
// some space/comments were skipped
// -> check if a space must be inserted
if AddAtom
and ((phpCommentsToSpace in Attr)

View File

@ -788,7 +788,6 @@ begin
BeautifyCodeOptions.DoNotSplitLineAfter:=DoNotSplitLineAfter;
BeautifyCodeOptions.DoInsertSpaceInFront:=DoInsertSpaceInFront;
BeautifyCodeOptions.DoInsertSpaceAfter:=DoInsertSpaceAfter;
DebugLn(['TCodeToolsOptions.AssignTo DoInsertSpaceInFront=',AtomTypesToStr(BeautifyCodeOptions.DoInsertSpaceInFront),' DoInsertSpaceAfter=',AtomTypesToStr(BeautifyCodeOptions.DoInsertSpaceAfter)]);
BeautifyCodeOptions.PropertyReadIdentPrefix:=PropertyReadIdentPrefix;
BeautifyCodeOptions.PropertyWriteIdentPrefix:=PropertyWriteIdentPrefix;
BeautifyCodeOptions.PropertyStoredIdentPostfix:=PropertyStoredIdentPostfix;

View File

@ -440,17 +440,20 @@ begin
Result:=IdentItem.Tool.ExtractProcHead(IdentItem.Node,
[phpWithStart,phpWithVarModifiers,phpWithParameterNames,
phpWithDefaultValues,phpWithResultType,phpWithCallingSpecs,
phpCommentsToSpace,phpWithProcModifiers]);
phpWithProcModifiers]);
// replace virtual with override
ProcModifierPos:=System.Pos('VIRTUAL;',UpperCaseStr(Result));
if ProcModifierPos>0 then
Result:=copy(Result,1,ProcModifierPos-1)+'override;'
+copy(Result,ProcModifierPos+8,length(Result));
// remove abstact
// remove abstract
ProcModifierPos:=System.Pos('ABSTRACT;',UpperCaseStr(Result));
if ProcModifierPos>0 then
Result:=copy(Result,1,ProcModifierPos-1)
+copy(Result,ProcModifierPos+9,length(Result));
Result:=TrimLeft(CodeToolBoss.SourceChangeCache
.BeautifyCodeOptions.BeautifyProc(
Result,CodeToolBoss.IdentifierList.StartContextPos.X,false));
end;
end;
@ -473,6 +476,8 @@ begin
or ([ilcfStartIsLValue,ilcfIsExpression]*IdentList.ContextFlags<>[]) then
inc(CursorToLeft);
end;
//DebugLn(['GetIdentCompletionValue END Result="',Result,'"']);
end;
function BreakLinesInText(const s: string; MaxLineLength: integer): string;