diff --git a/components/codetools/finddeclarationtool.pas b/components/codetools/finddeclarationtool.pas index bed61fc122..3e7d915502 100644 --- a/components/codetools/finddeclarationtool.pas +++ b/components/codetools/finddeclarationtool.pas @@ -6247,13 +6247,6 @@ begin exit; end; - {if (fdfCollect in params.Flags) - and (FoundContext.Node.Parent<>nil) - and (FoundContext.Node.Parent.Desc in AllClassSections) - and () then begin - - end;} - Result:=ifrProceedSearch; if (Params.FoundProc=nil) then begin // this is the first proc found diff --git a/components/codetools/identcompletiontool.pas b/components/codetools/identcompletiontool.pas index 99a763661b..00948128a6 100644 --- a/components/codetools/identcompletiontool.pas +++ b/components/codetools/identcompletiontool.pas @@ -120,9 +120,9 @@ type TIdentifierListFlags = set of TIdentifierListFlag; TIdentifierListContextFlag = ( - ilcfStartInStatement, - ilcfStartIsLValue, - ilcfContextNeedsEndSemicolon + ilcfStartInStatement, // context starts in statements. e.g. between begin..end + ilcfStartIsLValue, // position is start of one statement. e.g. 'A:=' + ilcfNeedsEndSemicolon // after context a semicolon is needed. e.g. 'A end' ); TIdentifierListContextFlags = set of TIdentifierListContextFlag; @@ -1117,6 +1117,7 @@ var ExprType: TExpressionType; ContextExprStartPos: Integer; StartInSubContext: Boolean; + StartPosOfVariable: LongInt; begin Result:=false; if IdentifierList=nil then IdentifierList:=TIdentifierList.Create; @@ -1216,45 +1217,57 @@ begin GatherUsefulIdentifiers(IdentStartPos,GatherContext,BeautifyCodeOptions); // check for incomplete context + // context bracket level CurrentIdentifierList.StartBracketLvl:= GetBracketLvl(Src,CursorNode.StartPos,IdentStartPos, Scanner.NestedComments); + if CursorNode.Desc in AllPascalStatements then begin + CurrentIdentifierList.ContextFlags:= + CurrentIdentifierList.ContextFlags+[ilcfStartInStatement]; + end; + // context in front of + StartPosOfVariable:=FindStartOfVariable(IdentStartPos); + if StartPosOfVariable>0 then begin + MoveCursorToCleanPos(StartPosOfVariable); + ReadPriorAtom; + CurrentIdentifierList.StartAtomInFront:=CurPos; + // check if LValue + if (ilcfStartInStatement in CurrentIdentifierList.ContextFlags) then + begin + if (CurPos.Flag in [cafSemicolon,cafBegin,cafEnd]) + or WordIsBlockKeyWord.DoItUpperCase(UpperSrc, + CurPos.StartPos,CurPos.EndPos-CurPos.StartPos) + then begin + CurrentIdentifierList.ContextFlags:= + CurrentIdentifierList.ContextFlags+[ilcfStartIsLValue]; + end; + end; + end; // context behind if IdentEndPos