But why are you opening the .lpi via the menu File > Open?
If you do it via
Project > Open Project and open the .lpi you won't get such message.
Opening it in File > Open it could be that you want to open it as xml.
(Even opening it via the explorer via file association the project opens fine if you open the .lpi, at least in Laz 1.8+)
You can of course hack Lazarus yourself and force the opening as project.
The dialog is in lazarus\ide\sourcefilemanager.pas.
Search for lisOpenAsXmlFile and you see the dialogs you can remove.
(so you only end up with MainIDE.DoOpenProjectFile() for the lpi and PkgBoss.DoOpenPackageFile() for the lpk files)
You can also always put in a feature request to make this default and settable in settings.
// check for special files
if ([ofRegularFile,ofRevert,ofProjectLoading]*FFlags=[])
and FilenameIsAbsolute(FFilename) and FileExistsCached(FFilename) then begin
// check if file is a lazarus project (.lpi)
if (CompareFileExt(FFilename,'.lpi',false)=0) then
begin
case
IDEQuestionDialog(lisOpenProject, Format(lisOpenTheProject, [FFilename]),
mtConfirmation, [mrYes, lisOpenProject2,
mrNoToAll, lisOpenAsXmlFile,
mrCancel])
of
mrYes: begin
Result:=MainIDE.DoOpenProjectFile(FFilename,[ofAddToRecent]);
exit;
end;
mrNoToAll: include(FFlags, ofRegularFile);
mrCancel: exit(mrCancel);
end;
end;
// check if file is a lazarus package (.lpk)
if (CompareFileExt(FFilename,'.lpk',false)=0) then
begin
case
IDEQuestionDialog(lisOpenPackage,
Format(lisOpenThePackage, [FFilename]),
mtConfirmation, [mrYes, lisCompPalOpenPackage,
mrNoToAll, lisOpenAsXmlFile,
mrCancel])
of
mrYes: begin
Result:=PkgBoss.DoOpenPackageFile(FFilename,[pofAddToRecent],
[ofProjectLoading,ofMultiOpen]*FFlags<>[]);
exit;
end;
mrCancel: exit(mrCancel);
end;
end;
end;