IDE: code completion: show message when nothing was done

git-svn-id: trunk@38550 -
This commit is contained in:
mattias 2012-09-07 07:10:47 +00:00
parent 5899b6bcb0
commit 0c0a7fb0de
3 changed files with 12 additions and 15 deletions

View File

@ -941,7 +941,7 @@ begin
// find variable name
GetIdentStartEndAtPosition(Src,CleanCursorPos,
VarNameAtom.StartPos,VarNameAtom.EndPos);
debugln('TCodeCompletionCodeTool.CheckLocalVarForInSyntax A ',GetAtom(VarNameAtom),' "',copy(Src,CleanCursorPos,10),'"');
//debugln('TCodeCompletionCodeTool.CheckLocalVarForInSyntax A ',GetAtom(VarNameAtom),' "',copy(Src,CleanCursorPos,10),'"');
if VarNameAtom.StartPos=VarNameAtom.EndPos then begin
{$IFDEF VerboseForInCompletion}
debugln('TCodeCompletionCodeTool.CheckLocalVarForInSyntax no identifier at cursor ',GetAtom(VarNameAtom),' "',copy(Src,CleanCursorPos,10),'"');

View File

@ -724,7 +724,7 @@ begin
exit(false);
p1:=@Src[CleanStartPos1];
p2:=@Src[CleanStartPos2];
while (CleanStartPos1<=SrcLen) and IsIdentChar[p1^] do begin
while IsIdentChar[p1^] do begin
if (UpChars[p1^]<>UpChars[p2^]) then
exit(false);
inc(CleanStartPos1);

View File

@ -16648,23 +16648,20 @@ begin
writeln('');
writeln('[TMainIDE.DoCompleteCodeAtCursor] ************');
{$ENDIF}
if CodeToolBoss.CompleteCode(ActiveUnitInfo.Source,
CodeToolBoss.CompleteCode(ActiveUnitInfo.Source,
ActiveSrcEdit.EditorComponent.CaretX,
ActiveSrcEdit.EditorComponent.CaretY,
ActiveSrcEdit.EditorComponent.TopLine,
NewSource,NewX,NewY,NewTopLine) then
begin
ApplyCodeToolChanges;
if NewSource<>nil then
DoJumpToCodePosition(ActiveSrcEdit, ActiveUnitInfo,
NewSource, NewX, NewY, NewTopLine, [jfAddJumpPoint, jfFocusEditor]);
end else begin
// error: probably a syntax error or just not in a procedure head/body
// or not in a class
// -> there are enough events to handle everything, so it can be ignored here
ApplyCodeToolChanges;
NewSource,NewX,NewY,NewTopLine);
if (CodeToolBoss.ErrorMessage='')
and (CodeToolBoss.SourceChangeCache.BuffersToModifyCount=0) then
CodeToolBoss.SetError(nil,0,0,'there is no completion for this code');
ApplyCodeToolChanges;
if (CodeToolBoss.ErrorMessage='') and (NewSource<>nil) then
DoJumpToCodePosition(ActiveSrcEdit, ActiveUnitInfo,
NewSource, NewX, NewY, NewTopLine, [jfAddJumpPoint, jfFocusEditor])
else
DoJumpToCodeToolBossError;
end;
finally
OpenEditorsOnCodeToolChange:=OldChange;
end;