IDE: messages: use left token for mlfLeftToken

git-svn-id: trunk@45288 -
This commit is contained in:
mattias 2014-06-01 17:40:43 +00:00
parent d72d8c2db8
commit c0772a50ef
2 changed files with 35 additions and 6 deletions

View File

@ -46,6 +46,7 @@ const
FPCMsgIDErrorWhileCompilingResources = 9029;
FPCMsgIDCallingResourceCompiler = 9028;
FPCMsgIDThereWereErrorsCompiling = 10026;
FPCMsgIDIdentifierNotFound = 5000;
FPCMsgAttrWorkerDirectory = 'WD';
FPCMsgAttrMissingUnit = 'MissingUnit';
@ -150,6 +151,7 @@ type
fMsgItemCantFindUnitUsedBy: TFPCMsgItem;
fMsgItemCompilationAborted: TFPCMsgItem;
fMsgItemThereWereErrorsCompiling: TFPCMsgItem;
fMsgItemIdentifierNotFound: TFPCMsgItem;
fMsgItemErrorWhileLinking: TFPCMsgItem;
fMsgItemErrorWhileCompilingResources: TFPCMsgItem;
fMissingFPCMsgItem: TFPCMsgItem;
@ -2225,7 +2227,10 @@ begin
else if IsMsgID(MsgLine,FPCMsgIDThereWereErrorsCompiling,
fMsgItemThereWereErrorsCompiling)
then
MsgLine.Urgency:=mluVerbose;
MsgLine.Urgency:=mluVerbose
else if IsMsgID(MsgLine,FPCMsgIDIdentifierNotFound,fMsgItemIdentifierNotFound)
then
MsgLine.Flags:=MsgLine.Flags+[mlfLeftToken];
inherited AddMsgLine(MsgLine);
end;

View File

@ -34,9 +34,10 @@ unit etSrcEditMarks;
interface
uses
Classes, SysUtils, math, SynGutterLineOverview, SynEditMarkupGutterMark,
Classes, SysUtils, math, LazLogger, LazFileUtils, AvgLvlTree,
KeywordFuncLists, Graphics, Controls, Forms, ImgList,
SynGutterLineOverview, SynEditMarkupGutterMark,
SynEditMarks, SynEditMiscClasses, SynEditTypes, SynEdit, LazSynEditText,
LazLogger, LazFileUtils, AvgLvlTree, Graphics, Controls, Forms, ImgList,
IDEExternToolIntf;
type
@ -94,7 +95,7 @@ type
fMarkStyles: array[TMessageLineUrgency] of TETMarkStyle;
FOnGetSynEditOfFile: TOnGetSynEditOfFile;
FPriority: integer;
function GetMarkStyles(Urgency: TMessageLineUrgency): TETMarkStyle;
function GetMarkStyles(Urgency: TMessageLineUrgency): TETMarkStyle; inline;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
@ -1051,6 +1052,7 @@ end;
{ TETMarks }
// inline
function TETMarks.GetMarkStyles(Urgency: TMessageLineUrgency): TETMarkStyle;
begin
Result:=fMarkStyles[Urgency];
@ -1086,6 +1088,10 @@ end;
function TETMarks.CreateMark(MsgLine: TMessageLine; aSynEdit: TSynEdit
): TETMark;
var
Line: Integer;
Column: Integer;
LineSrc: String;
begin
Result:=nil;
if (MsgLine.Line<1) or (MsgLine.Column<1) or (MsgLine.Filename='') then exit;
@ -1094,11 +1100,29 @@ begin
OnGetSynEditOfFile(Self,MsgLine.Filename,aSynEdit);
if (aSynEdit=nil) then exit;
end;
Line:=MsgLine.Line;
Column:=MsgLine.Column;
if (mlfLeftToken in MsgLine.Flags) then begin
// the mark is at the of the token
// synedit only supports starts of tokens
// => adjust to start of token
if (Column>1) and (Line>=1) and (Line<=aSynEdit.Lines.Count) then begin
LineSrc:=aSynEdit.Lines[Line-1];
if (Column<=length(LineSrc)+1) and (not IsSpaceChar[LineSrc[Column-1]])
then begin
dec(Column);
if IsIdentChar[LineSrc[Column]] then begin
while (Column>1) and (IsIdentChar[LineSrc[Column-1]]) do
dec(Column);
end;
end;
end;
end;
Result:=TETMark.Create(aSynEdit);
Result.SourceMarks:=Self;
Result.MsgLine:=MsgLine;
Result.Line:=MsgLine.Line;
Result.Column:=MsgLine.Column;
Result.Line:=Line;
Result.Column:=Column;
Result.Visible:=true;
Result.Priority:=Priority;
Result.Urgency:=MsgLine.Urgency;