mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 14:56:00 +02:00
IDE: fpc msg parser: improve cant find unit when an indirectly used unit has no ppu in project and package
git-svn-id: trunk@47656 -
This commit is contained in:
parent
7feade1dc9
commit
d868b219ae
@ -2188,14 +2188,18 @@ end;
|
|||||||
|
|
||||||
function TMessageLine.GetToolData: TIDEExternalToolData;
|
function TMessageLine.GetToolData: TIDEExternalToolData;
|
||||||
var
|
var
|
||||||
View: TExtToolView;
|
Tool: TAbstractExternalTool;
|
||||||
begin
|
begin
|
||||||
Result:=nil;
|
Result:=nil;
|
||||||
if Lines=nil then exit;
|
if Lines=nil then exit;
|
||||||
View:=TExtToolView(Lines.Owner);
|
if Lines.Owner is TAbstractExternalTool then
|
||||||
if not (View is TExtToolView) then exit;
|
Tool:=TAbstractExternalTool(Lines.Owner)
|
||||||
if View.Tool=nil then exit;
|
else if Lines.Owner is TExtToolView then begin
|
||||||
Result:=TIDEExternalToolData(View.Tool.Data);
|
Tool:=TExtToolView(Lines.Owner).Tool;
|
||||||
|
if Tool=nil then exit;
|
||||||
|
end else
|
||||||
|
exit;
|
||||||
|
Result:=TIDEExternalToolData(Tool.Data);
|
||||||
if not (Result is TIDEExternalToolData) then
|
if not (Result is TIDEExternalToolData) then
|
||||||
Result:=nil;
|
Result:=nil;
|
||||||
end;
|
end;
|
||||||
|
@ -1796,6 +1796,7 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
DepOwner: TObject;
|
DepOwner: TObject;
|
||||||
PkgFile: TLazPackageFile;
|
PkgFile: TLazPackageFile;
|
||||||
|
TheOwner: TObject;
|
||||||
begin
|
begin
|
||||||
if MsgLine.Urgency<mluError then exit;
|
if MsgLine.Urgency<mluError then exit;
|
||||||
if not IsMsgID(MsgLine,FPCMsgIDCantFindUnitUsedBy,fMsgItemCantFindUnitUsedBy)
|
if not IsMsgID(MsgLine,FPCMsgIDCantFindUnitUsedBy,fMsgItemCantFindUnitUsedBy)
|
||||||
@ -1811,6 +1812,8 @@ begin
|
|||||||
etpspAfterSync: exit;
|
etpspAfterSync: exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// in main thread
|
||||||
|
|
||||||
if not GetFPCMsgValues(MsgLine,MissingUnitName,UsedByUnit) then
|
if not GetFPCMsgValues(MsgLine,MissingUnitName,UsedByUnit) then
|
||||||
exit;
|
exit;
|
||||||
MsgLine.Attribute[FPCMsgAttrMissingUnit]:=MissingUnitName;
|
MsgLine.Attribute[FPCMsgAttrMissingUnit]:=MissingUnitName;
|
||||||
@ -1844,7 +1847,12 @@ begin
|
|||||||
ExtractFilePath(Filename),UsedByUnit,true);
|
ExtractFilePath(Filename),UsedByUnit,true);
|
||||||
end;
|
end;
|
||||||
if NewFilename='' then begin
|
if NewFilename='' then begin
|
||||||
NewFilename:=LazarusIDE.FindUnitFile(UsedByUnit);
|
if Tool.Data is TIDEExternalToolData then
|
||||||
|
TheOwner:=ExternalToolList.GetIDEObject(TIDEExternalToolData(Tool.Data))
|
||||||
|
else if Tool.Data=nil then begin
|
||||||
|
debugln(['TIDEFPCParser.ImproveMsgUnitNotFound Tool.Data=nil, ProcDir=',Tool.Process.CurrentDirectory]);
|
||||||
|
end;
|
||||||
|
NewFilename:=LazarusIDE.FindUnitFile(UsedByUnit,TheOwner);
|
||||||
if NewFilename='' then begin
|
if NewFilename='' then begin
|
||||||
{$IFDEF VerboseFPCMsgUnitNotFound}
|
{$IFDEF VerboseFPCMsgUnitNotFound}
|
||||||
debugln(['TIDEFPCParser.ImproveMsgUnitNotFound unit not found: ',UsedByUnit]);
|
debugln(['TIDEFPCParser.ImproveMsgUnitNotFound unit not found: ',UsedByUnit]);
|
||||||
|
@ -187,6 +187,7 @@ var
|
|||||||
UsedByUnit: string;
|
UsedByUnit: string;
|
||||||
CodeBuf: TCodeBuffer;
|
CodeBuf: TCodeBuffer;
|
||||||
Dlg: TFindUnitDialog;
|
Dlg: TFindUnitDialog;
|
||||||
|
StartFilename: String;
|
||||||
begin
|
begin
|
||||||
// get unitname
|
// get unitname
|
||||||
if not IsApplicable(Msg,MissingUnit,UsedByUnit) then exit;
|
if not IsApplicable(Msg,MissingUnit,UsedByUnit) then exit;
|
||||||
@ -202,9 +203,10 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
CodeBuf:=CodeToolBoss.LoadFile(Msg.GetFullFilename,true,false);
|
StartFilename:=Msg.GetFullFilename;
|
||||||
|
CodeBuf:=CodeToolBoss.LoadFile(StartFilename,true,false);
|
||||||
if CodeBuf=nil then begin
|
if CodeBuf=nil then begin
|
||||||
debugln(['TQuickFixUnitNotFound_Search.QuickFix can not open file "',Msg.GetFullFilename,'"']);
|
debugln(['TQuickFixUnitNotFound_Search.QuickFix cannot open file "',StartFilename,'", Msg="',Msg.Line,'"']);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user