diff --git a/ide/main.pp b/ide/main.pp index 60ee6d0f07..8a8fdf2caf 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -16224,50 +16224,52 @@ begin end; case ToolStatus of itDebugger: begin - if SrcEdit.SelectionAvailable and SrcEdit.CaretInSelection(CaretPos) then - Expression := SrcEdit.GetText(True) - else - Expression := SrcEdit.GetOperandFromCaret(CaretPos); - if Expression='' then exit; - //DebugLn(['TMainIDE.OnSrcNotebookShowHintForSource Expression="',Expression,'"']); - DBGType:=nil; - DBGTypeDerefer:=nil; - Opts := []; - if EditorOpts.DbgHintAutoTypeCastClass - then Opts := [defClassAutoCast]; - if not DebugBoss.Evaluate(Expression, DebugEval, DBGType, Opts) or (DebugEval = '') then - DebugEval := '???'; - // deference a pointer - maybe it is a class - if Assigned(DBGType) and (DBGType.Kind in [skPointer]) and - not( StringCase(Lowercase(DBGType.TypeName), ['char', 'character', 'ansistring']) in [0..2] ) - then - begin - if DBGType.Value.AsPointer <> nil then + if EditorOpts.AutoToolTipExprEval then begin + if SrcEdit.SelectionAvailable and SrcEdit.CaretInSelection(CaretPos) then + Expression := SrcEdit.GetText(True) + else + Expression := SrcEdit.GetOperandFromCaret(CaretPos); + if Expression='' then exit; + //DebugLn(['TMainIDE.OnSrcNotebookShowHintForSource Expression="',Expression,'"']); + DBGType:=nil; + DBGTypeDerefer:=nil; + Opts := []; + if EditorOpts.DbgHintAutoTypeCastClass + then Opts := [defClassAutoCast]; + if not DebugBoss.Evaluate(Expression, DebugEval, DBGType, Opts) or (DebugEval = '') then + DebugEval := '???'; + // deference a pointer - maybe it is a class + if Assigned(DBGType) and (DBGType.Kind in [skPointer]) and + not( StringCase(Lowercase(DBGType.TypeName), ['char', 'character', 'ansistring']) in [0..2] ) + then begin - if DebugBoss.Evaluate(Expression + '^', DebugEvalDerefer, DBGTypeDerefer, Opts) then + if DBGType.Value.AsPointer <> nil then begin - if Assigned(DBGTypeDerefer) and - ( (DBGTypeDerefer.Kind <> skPointer) or - (StringCase(Lowercase(DBGTypeDerefer.TypeName), ['char', 'character', 'ansistring']) in [0..2]) - ) - then - DebugEval := DebugEval + ' = ' + DebugEvalDerefer; + if DebugBoss.Evaluate(Expression + '^', DebugEvalDerefer, DBGTypeDerefer, Opts) then + begin + if Assigned(DBGTypeDerefer) and + ( (DBGTypeDerefer.Kind <> skPointer) or + (StringCase(Lowercase(DBGTypeDerefer.TypeName), ['char', 'character', 'ansistring']) in [0..2]) + ) + then + DebugEval := DebugEval + ' = ' + DebugEvalDerefer; + end; end; end; + FreeAndNil(DBGType); + FreeAndNil(DBGTypeDerefer); + HasHint:=true; + Expression := Expression + ' = ' + DebugEval; + if SmartHintStr<>'' then begin + p:=System.Pos('
',lowercase(SmartHintStr)); + if p>0 then begin + Insert('