mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 16:56:03 +02:00
IDE: quick fix: add -vm option
git-svn-id: trunk@45342 -
This commit is contained in:
parent
ee966ac457
commit
ec6d63f4a5
@ -91,6 +91,26 @@ type
|
|||||||
coptParsedPlatformIndependent // all but platform macros resolved
|
coptParsedPlatformIndependent // all but platform macros resolved
|
||||||
);
|
);
|
||||||
|
|
||||||
|
{$IFDEF EnableNewExtTools}
|
||||||
|
TCompilerFlagValue = (
|
||||||
|
cfvNone, // default, do not pass the flag
|
||||||
|
cfvHide, // pass the flag, e.g. -vm5000
|
||||||
|
cfvShow // pass the -flag, e.g. -vm-5000
|
||||||
|
);
|
||||||
|
|
||||||
|
TAbstractCompilerMsgIDFlags = class(TPersistent)
|
||||||
|
protected
|
||||||
|
function GetValues(MsgId: integer): TCompilerFlagValue; virtual; abstract;
|
||||||
|
function GetModified: boolean; virtual; abstract;
|
||||||
|
procedure SetModified(AValue: boolean); virtual; abstract;
|
||||||
|
procedure SetValues(MsgId: integer; AValue: TCompilerFlagValue); virtual; abstract;
|
||||||
|
public
|
||||||
|
procedure Clear; virtual; abstract;
|
||||||
|
property Values[MsgId: integer]: TCompilerFlagValue read GetValues write SetValues; default;
|
||||||
|
property Modified: boolean read GetModified write SetModified;
|
||||||
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
const
|
const
|
||||||
crAll = [crCompile, crBuild, crRun];
|
crAll = [crCompile, crBuild, crRun];
|
||||||
|
|
||||||
@ -257,6 +277,10 @@ type
|
|||||||
fShowHintsForSenderNotUsed: Boolean;
|
fShowHintsForSenderNotUsed: Boolean;
|
||||||
fWriteFPCLogo: Boolean;
|
fWriteFPCLogo: Boolean;
|
||||||
fStopAfterErrCount: integer;
|
fStopAfterErrCount: integer;
|
||||||
|
{$IFDEF EnableNewExtTools}
|
||||||
|
// Turn specific types of compiler messages on or off
|
||||||
|
fMessageFlags: TAbstractCompilerMsgIDFlags;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
// Other:
|
// Other:
|
||||||
fDontUseConfigFile: Boolean;
|
fDontUseConfigFile: Boolean;
|
||||||
@ -426,6 +450,9 @@ type
|
|||||||
read fShowHintsForSenderNotUsed write SetShowHintsForSenderNotUsed;
|
read fShowHintsForSenderNotUsed write SetShowHintsForSenderNotUsed;
|
||||||
property WriteFPCLogo: Boolean read fWriteFPCLogo write SetWriteFPCLogo;
|
property WriteFPCLogo: Boolean read fWriteFPCLogo write SetWriteFPCLogo;
|
||||||
property StopAfterErrCount: integer read fStopAfterErrCount write SetStopAfterErrCount;
|
property StopAfterErrCount: integer read fStopAfterErrCount write SetStopAfterErrCount;
|
||||||
|
{$IFDEF EnableNewExtTools}
|
||||||
|
property MessageFlags: TAbstractCompilerMsgIDFlags read fMessageFlags;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
// other
|
// other
|
||||||
property DontUseConfigFile: Boolean read fDontUseConfigFile write SetDontUseConfigFile;
|
property DontUseConfigFile: Boolean read fDontUseConfigFile write SetDontUseConfigFile;
|
||||||
|
@ -36,6 +36,23 @@ const
|
|||||||
|
|
||||||
AbortedExitCode = 12321;
|
AbortedExitCode = 12321;
|
||||||
|
|
||||||
|
const
|
||||||
|
IDEToolCompilePackage = 'Package';
|
||||||
|
IDEToolCompileProject = 'Project';
|
||||||
|
type
|
||||||
|
|
||||||
|
{ TIDEExternalToolData
|
||||||
|
When the IDE compiles a package or a project it creates an instance and sets
|
||||||
|
TAbstractExternalTool.Data. }
|
||||||
|
|
||||||
|
TIDEExternalToolData = class
|
||||||
|
public
|
||||||
|
Kind: string; // e.g. IDEToolCompilePackage or IDEToolCompileProject
|
||||||
|
ModuleName: string; // e.g. the package name
|
||||||
|
Filename: string; // e.g. the lpi or lpk filename
|
||||||
|
constructor Create(aKind, aModuleName, aFilename: string);
|
||||||
|
end;
|
||||||
|
|
||||||
type
|
type
|
||||||
TETShareStringEvent = procedure(var s: string) of object;
|
TETShareStringEvent = procedure(var s: string) of object;
|
||||||
|
|
||||||
@ -139,6 +156,7 @@ type
|
|||||||
procedure MarkFixed;
|
procedure MarkFixed;
|
||||||
function HasSourcePosition: boolean;
|
function HasSourcePosition: boolean;
|
||||||
procedure GetAttributes(List: TStrings);
|
procedure GetAttributes(List: TStrings);
|
||||||
|
function GetToolData: TIDEExternalToolData; virtual;
|
||||||
public
|
public
|
||||||
property Index: integer read FIndex; // index in Lines (Note: Lines can have more or less items than the raw output has text lines)
|
property Index: integer read FIndex; // index in Lines (Note: Lines can have more or less items than the raw output has text lines)
|
||||||
property Urgency: TMessageLineUrgency read FUrgency write SetUrgency;
|
property Urgency: TMessageLineUrgency read FUrgency write SetUrgency;
|
||||||
@ -570,6 +588,7 @@ type
|
|||||||
procedure ConsistencyCheck; virtual;
|
procedure ConsistencyCheck; virtual;
|
||||||
procedure EnterCriticalSection; virtual; abstract;
|
procedure EnterCriticalSection; virtual; abstract;
|
||||||
procedure LeaveCriticalSection; virtual; abstract;
|
procedure LeaveCriticalSection; virtual; abstract;
|
||||||
|
function GetIDEObject(ToolData: TIDEExternalToolData): TObject; virtual; abstract;
|
||||||
// parsers
|
// parsers
|
||||||
procedure RegisterParser(Parser: TExtToolParserClass); virtual; abstract; // (main thread)
|
procedure RegisterParser(Parser: TExtToolParserClass); virtual; abstract; // (main thread)
|
||||||
procedure UnregisterParser(Parser: TExtToolParserClass); virtual; abstract; // (main thread)
|
procedure UnregisterParser(Parser: TExtToolParserClass); virtual; abstract; // (main thread)
|
||||||
@ -584,24 +603,6 @@ type
|
|||||||
var
|
var
|
||||||
ExternalToolList: TIDEExternalTools = nil; // will be set by the IDE
|
ExternalToolList: TIDEExternalTools = nil; // will be set by the IDE
|
||||||
|
|
||||||
const
|
|
||||||
IDEToolCompilePackage = 'Package';
|
|
||||||
IDEToolCompileProject = 'Project';
|
|
||||||
type
|
|
||||||
|
|
||||||
{ TIDEExternalToolData
|
|
||||||
When the IDE compiles a package or a project it creates an instance and sets
|
|
||||||
TAbstractExternalTool.Data. }
|
|
||||||
|
|
||||||
TIDEExternalToolData = class
|
|
||||||
public
|
|
||||||
Kind: string; // e.g. IDEToolCompilePackage or IDEToolCompileProject
|
|
||||||
ModuleName: string; // e.g. the package name
|
|
||||||
Filename: string; // e.g. the lpi or lpk filename
|
|
||||||
constructor Create(aKind, aModuleName, aFilename: string);
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
type
|
type
|
||||||
{ TIDEExternalToolOptions }
|
{ TIDEExternalToolOptions }
|
||||||
|
|
||||||
@ -2117,6 +2118,20 @@ begin
|
|||||||
List.Values['OriginalLine']:=OriginalLine;
|
List.Values['OriginalLine']:=OriginalLine;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TMessageLine.GetToolData: TIDEExternalToolData;
|
||||||
|
var
|
||||||
|
View: TExtToolView;
|
||||||
|
begin
|
||||||
|
Result:=nil;
|
||||||
|
if Lines=nil then exit;
|
||||||
|
View:=TExtToolView(Lines.Owner);
|
||||||
|
if not (View is TExtToolView) then exit;
|
||||||
|
if View.Tool=nil then exit;
|
||||||
|
Result:=TIDEExternalToolData(View.Tool.Data);
|
||||||
|
if not (Result is TIDEExternalToolData) then
|
||||||
|
Result:=nil;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TExtToolView }
|
{ TExtToolView }
|
||||||
|
|
||||||
procedure TExtToolView.FetchAllPending;
|
procedure TExtToolView.FetchAllPending;
|
||||||
|
@ -324,6 +324,8 @@ begin
|
|||||||
Tool:=ExternalToolList.Add('Compile Project');
|
Tool:=ExternalToolList.Add('Compile Project');
|
||||||
Tool.Reference(Self,ClassName);
|
Tool.Reference(Self,ClassName);
|
||||||
try
|
try
|
||||||
|
Tool.Data:=TIDEExternalToolData.Create(IDEToolCompileProject,'',AProject.ProjectInfoFile);
|
||||||
|
Tool.FreeData:=true;
|
||||||
Tool.Hint:=aCompileHint;
|
Tool.Hint:=aCompileHint;
|
||||||
Tool.Process.Executable:=CompilerFilename;
|
Tool.Process.Executable:=CompilerFilename;
|
||||||
Tool.CmdLineParams:=CmdLine;
|
Tool.CmdLineParams:=CmdLine;
|
||||||
|
@ -368,12 +368,6 @@ type
|
|||||||
TCompilationToolClass = class of TCompilationToolOptions;
|
TCompilationToolClass = class of TCompilationToolOptions;
|
||||||
|
|
||||||
{$IFDEF EnableNewExtTools}
|
{$IFDEF EnableNewExtTools}
|
||||||
TCompilerFlagValue = (
|
|
||||||
cfvNone, // default, do not pass the flag
|
|
||||||
cfvHide, // pass the flag
|
|
||||||
cfvShow // pass the -flag
|
|
||||||
);
|
|
||||||
|
|
||||||
TCompilerMsgIdFlag = record
|
TCompilerMsgIdFlag = record
|
||||||
MsgId: integer;
|
MsgId: integer;
|
||||||
Flag: TCompilerFlagValue;
|
Flag: TCompilerFlagValue;
|
||||||
@ -396,25 +390,24 @@ type
|
|||||||
|
|
||||||
{ TCompilerMsgIDFlags }
|
{ TCompilerMsgIDFlags }
|
||||||
|
|
||||||
TCompilerMsgIDFlags = class(TPersistent)
|
TCompilerMsgIDFlags = class(TAbstractCompilerMsgIDFlags)
|
||||||
private
|
private
|
||||||
FChangeStamp: int64;
|
FChangeStamp: int64;
|
||||||
fLastSavedStamp: int64;
|
fLastSavedStamp: int64;
|
||||||
fTree: TAvgLvlTree; // tree of TCompilerMsgIdFlag
|
fTree: TAvgLvlTree; // tree of TCompilerMsgIdFlag
|
||||||
function FindNode(MsgId: integer): TAvgLvlTreeNode;
|
function FindNode(MsgId: integer): TAvgLvlTreeNode;
|
||||||
function GetValues(MsgId: integer): TCompilerFlagValue;
|
protected
|
||||||
function GetModified: boolean;
|
function GetValues(MsgId: integer): TCompilerFlagValue; override;
|
||||||
procedure SetModified(AValue: boolean);
|
function GetModified: boolean; override;
|
||||||
procedure SetValues(MsgId: integer; AValue: TCompilerFlagValue);
|
procedure SetModified(AValue: boolean); override;
|
||||||
|
procedure SetValues(MsgId: integer; AValue: TCompilerFlagValue); override;
|
||||||
public
|
public
|
||||||
constructor Create;
|
constructor Create;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure Clear;
|
procedure Clear; override;
|
||||||
procedure Assign(Source: TPersistent); override;
|
procedure Assign(Source: TPersistent); override;
|
||||||
function Equals(Obj: TObject): boolean; override;
|
function Equals(Obj: TObject): boolean; override;
|
||||||
procedure IncreaseChangeStamp;
|
procedure IncreaseChangeStamp;
|
||||||
property Values[MsgId: integer]: TCompilerFlagValue read GetValues write SetValues; default;
|
|
||||||
property Modified: boolean read GetModified write SetModified;
|
|
||||||
function GetEnumerator: TCompilerMsgIDFlagsEnumerator;
|
function GetEnumerator: TCompilerMsgIDFlagsEnumerator;
|
||||||
function GetMsgIdList(Delim: char; aValue: TCompilerFlagValue): string;
|
function GetMsgIdList(Delim: char; aValue: TCompilerFlagValue): string;
|
||||||
function CreateDiff(Tool: TCompilerDiffTool; Other: TCompilerMsgIDFlags): boolean;
|
function CreateDiff(Tool: TCompilerDiffTool; Other: TCompilerMsgIDFlags): boolean;
|
||||||
@ -516,8 +509,6 @@ type
|
|||||||
FCreateMakefileOnBuild: boolean;
|
FCreateMakefileOnBuild: boolean;
|
||||||
|
|
||||||
{$IFDEF EnableNewExtTools}
|
{$IFDEF EnableNewExtTools}
|
||||||
// Turn specific types of compiler messages on or off
|
|
||||||
fMessageFlags: TCompilerMsgIDFlags;
|
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
// Compiler Messags
|
// Compiler Messags
|
||||||
fUseCustomMessages: Boolean; // use messages customization
|
fUseCustomMessages: Boolean; // use messages customization
|
||||||
@ -675,7 +666,7 @@ type
|
|||||||
|
|
||||||
// compiler message types by id
|
// compiler message types by id
|
||||||
{$IFDEF EnableNewExtTools}
|
{$IFDEF EnableNewExtTools}
|
||||||
property MessageFlags: TCompilerMsgIDFlags read fMessageFlags;
|
function IDEMessageFlags: TCompilerMsgIDFlags; inline;
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
property CompilerMessages: TCompilerMessagesList read fCompilerMessages;
|
property CompilerMessages: TCompilerMessagesList read fCompilerMessages;
|
||||||
property UseMsgFile: Boolean read fUseMsgFile write SetUseMsgFile;
|
property UseMsgFile: Boolean read fUseMsgFile write SetUseMsgFile;
|
||||||
@ -1214,6 +1205,12 @@ end;
|
|||||||
|
|
||||||
{ TBaseCompilerOptions }
|
{ TBaseCompilerOptions }
|
||||||
|
|
||||||
|
// inline
|
||||||
|
function TBaseCompilerOptions.IDEMessageFlags: TCompilerMsgIDFlags;
|
||||||
|
begin
|
||||||
|
Result:=TCompilerMsgIDFlags(MessageFlags);
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
TBaseCompilerOptions Constructor
|
TBaseCompilerOptions Constructor
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
@ -1865,7 +1862,7 @@ var
|
|||||||
var
|
var
|
||||||
Flag: PCompilerMsgIdFlag;
|
Flag: PCompilerMsgIdFlag;
|
||||||
begin
|
begin
|
||||||
for Flag in MessageFlags do
|
for Flag in IDEMessageFlags do
|
||||||
if Flag^.Flag=aValue then begin
|
if Flag^.Flag=aValue then begin
|
||||||
//debugln(['WriteListOfMessageFlags aPath=',aPath,' Flag.MsgId=',Flag^.MsgId]);
|
//debugln(['WriteListOfMessageFlags aPath=',aPath,' Flag.MsgId=',Flag^.MsgId]);
|
||||||
aXMLConfig.SetValue(aPath+'/idx'+IntToStr(Flag^.MsgId), true);
|
aXMLConfig.SetValue(aPath+'/idx'+IntToStr(Flag^.MsgId), true);
|
||||||
@ -3254,10 +3251,10 @@ begin
|
|||||||
if (WriteFPCLogo) then
|
if (WriteFPCLogo) then
|
||||||
switches := switches + ' -l';
|
switches := switches + ' -l';
|
||||||
{$IFDEF EnableNewExtTools}
|
{$IFDEF EnableNewExtTools}
|
||||||
t := MessageFlags.GetMsgIdList(',',cfvHide);
|
t := IDEMessageFlags.GetMsgIdList(',',cfvHide);
|
||||||
if t <> '' then
|
if t <> '' then
|
||||||
switches := switches + ' ' + PrepareCmdLineOption('-vm'+t);
|
switches := switches + ' ' + PrepareCmdLineOption('-vm'+t);
|
||||||
t := MessageFlags.GetMsgIdList(',',cfvShow);
|
t := IDEMessageFlags.GetMsgIdList(',',cfvShow);
|
||||||
if t <> '' then
|
if t <> '' then
|
||||||
switches := switches + ' ' + PrepareCmdLineOption('-vm-'+t);
|
switches := switches + ' ' + PrepareCmdLineOption('-vm-'+t);
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
@ -3822,7 +3819,7 @@ begin
|
|||||||
// messages
|
// messages
|
||||||
if Tool<>nil then Tool.Path:='Messages';
|
if Tool<>nil then Tool.Path:='Messages';
|
||||||
{$IFDEF EnableNewExtTools}
|
{$IFDEF EnableNewExtTools}
|
||||||
if Done(MessageFlags.CreateDiff(Tool,CompOpts.MessageFlags)) then exit;
|
if Done(IDEMessageFlags.CreateDiff(Tool,CompOpts.IDEMessageFlags)) then exit;
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
if Done(Tool.AddDiff('UseCustomMessages',fUseCustomMessages,CompOpts.fUseCustomMessages)) then exit;
|
if Done(Tool.AddDiff('UseCustomMessages',fUseCustomMessages,CompOpts.fUseCustomMessages)) then exit;
|
||||||
if Done(Tool.AddDiff('UseMsgFile',fUseMsgFile,CompOpts.fUseMsgFile)) then exit;
|
if Done(Tool.AddDiff('UseMsgFile',fUseMsgFile,CompOpts.fUseMsgFile)) then exit;
|
||||||
|
@ -2385,6 +2385,7 @@ begin
|
|||||||
FViews.Add(Result);
|
FViews.Add(Result);
|
||||||
FreeNotification(Result);
|
FreeNotification(Result);
|
||||||
Result.OnChanged:=@OnViewChanged;
|
Result.OnChanged:=@OnViewChanged;
|
||||||
|
fSomeViewsRunning:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMessagesCtrl.GetLineAt(Y: integer; out View: TLMsgWndView; out
|
function TMessagesCtrl.GetLineAt(Y: integer; out View: TLMsgWndView; out
|
||||||
@ -2706,8 +2707,8 @@ var
|
|||||||
begin
|
begin
|
||||||
View:=GetAboutView;
|
View:=GetAboutView;
|
||||||
if View=nil then exit;
|
if View=nil then exit;
|
||||||
if not (View.Tool.Data is TIDEExternalToolData) then exit;
|
|
||||||
ToolData:=TIDEExternalToolData(View.Tool.Data);
|
ToolData:=TIDEExternalToolData(View.Tool.Data);
|
||||||
|
if not (ToolData is TIDEExternalToolData) then exit;
|
||||||
if ToolData.Kind=IDEToolCompilePackage then begin
|
if ToolData.Kind=IDEToolCompilePackage then begin
|
||||||
PackageEditingInterface.DoOpenPackageFile(ToolData.Filename,
|
PackageEditingInterface.DoOpenPackageFile(ToolData.Filename,
|
||||||
[pofAddToRecent],false);
|
[pofAddToRecent],false);
|
||||||
|
@ -53,19 +53,29 @@ uses
|
|||||||
Classes, SysUtils, Menus, Dialogs, Controls, CodeToolManager, CodeCache,
|
Classes, SysUtils, Menus, Dialogs, Controls, CodeToolManager, CodeCache,
|
||||||
CodeTree, CodeAtom, BasicCodeTools, KeywordFuncLists, LazLogger, AvgLvlTree,
|
CodeTree, CodeAtom, BasicCodeTools, KeywordFuncLists, LazLogger, AvgLvlTree,
|
||||||
LazFileUtils, IDEExternToolIntf, IDEMsgIntf, LazIDEIntf, IDEDialogs, MenuIntf,
|
LazFileUtils, IDEExternToolIntf, IDEMsgIntf, LazIDEIntf, IDEDialogs, MenuIntf,
|
||||||
etFPCMsgParser, AbstractsMethodsDlg;
|
ProjectIntf, PackageIntf, CompOptsIntf, etFPCMsgParser, AbstractsMethodsDlg;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
{ TQuickFix_Hide - hide via IDE directive %H- }
|
{ TQuickFix_HideWithIDEDirective - hide with IDE directive %H- }
|
||||||
|
|
||||||
TQuickFix_Hide = class(TMsgQuickFix)
|
TQuickFix_HideWithIDEDirective = class(TMsgQuickFix)
|
||||||
public
|
public
|
||||||
function IsApplicable(Msg: TMessageLine): boolean;
|
function IsApplicable(Msg: TMessageLine): boolean;
|
||||||
procedure CreateMenuItems(Fixes: TMsgQuickFixes); override;
|
procedure CreateMenuItems(Fixes: TMsgQuickFixes); override;
|
||||||
procedure QuickFix(Fixes: TMsgQuickFixes; Msg: TMessageLine); override;
|
procedure QuickFix(Fixes: TMsgQuickFixes; Msg: TMessageLine); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TQuickFix_HideWithCompilerOption - hide with compiler option -vm<id> }
|
||||||
|
|
||||||
|
TQuickFix_HideWithCompilerOption = class(TMsgQuickFix)
|
||||||
|
public
|
||||||
|
function IsApplicable(Msg: TMessageLine; out ToolData: TIDEExternalToolData;
|
||||||
|
out IDETool: TObject): boolean;
|
||||||
|
procedure CreateMenuItems(Fixes: TMsgQuickFixes); override;
|
||||||
|
procedure QuickFix(Fixes: TMsgQuickFixes; Msg: TMessageLine); override;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TQuickFixIdentifierNotFoundAddLocal }
|
{ TQuickFixIdentifierNotFoundAddLocal }
|
||||||
|
|
||||||
TQuickFixIdentifierNotFoundAddLocal = class(TMsgQuickFix)
|
TQuickFixIdentifierNotFoundAddLocal = class(TMsgQuickFix)
|
||||||
@ -169,6 +179,75 @@ begin
|
|||||||
Result:=true;
|
Result:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TQuickFix_HideWithCompilerOption }
|
||||||
|
|
||||||
|
function TQuickFix_HideWithCompilerOption.IsApplicable(Msg: TMessageLine; out
|
||||||
|
ToolData: TIDEExternalToolData; out IDETool: TObject): boolean;
|
||||||
|
begin
|
||||||
|
Result:=false;
|
||||||
|
ToolData:=nil;
|
||||||
|
IDETool:=nil;
|
||||||
|
if (Msg.Urgency>=mluError)
|
||||||
|
or (Msg.SubTool<>SubToolFPC)
|
||||||
|
or (Msg.MsgID=0)
|
||||||
|
then exit;
|
||||||
|
ToolData:=Msg.GetToolData;
|
||||||
|
if ToolData=nil then exit;
|
||||||
|
IDETool:=ExternalToolList.GetIDEObject(ToolData);
|
||||||
|
Result:=IDETool<>nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TQuickFix_HideWithCompilerOption.CreateMenuItems(Fixes: TMsgQuickFixes
|
||||||
|
);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
Msg: TMessageLine;
|
||||||
|
IDETool: TObject;
|
||||||
|
s: String;
|
||||||
|
ToolData: TIDEExternalToolData;
|
||||||
|
CompOpts: TLazCompilerOptions;
|
||||||
|
begin
|
||||||
|
for i:=0 to Fixes.LineCount-1 do begin
|
||||||
|
Msg:=Fixes.Lines[i];
|
||||||
|
if not IsApplicable(Msg,ToolData,IDETool) then continue;
|
||||||
|
if IDETool is TLazProject then begin
|
||||||
|
CompOpts:=TLazProject(IDETool).LazCompilerOptions;
|
||||||
|
if CompOpts.MessageFlags[Msg.MsgID]=cfvHide then exit;
|
||||||
|
s:='Hide with project option (-vm'+IntToStr(Msg.MsgID)+')'
|
||||||
|
end else if IDETool is TIDEPackage then begin
|
||||||
|
CompOpts:=TIDEPackage(IDETool).LazCompilerOptions;
|
||||||
|
if CompOpts.MessageFlags[Msg.MsgID]=cfvHide then exit;
|
||||||
|
s:='Hide with package option (-vm'+IntToStr(Msg.MsgID)+')';
|
||||||
|
end;
|
||||||
|
Fixes.AddMenuItem(Self,Msg,s);
|
||||||
|
end;
|
||||||
|
inherited CreateMenuItems(Fixes);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TQuickFix_HideWithCompilerOption.QuickFix(Fixes: TMsgQuickFixes;
|
||||||
|
Msg: TMessageLine);
|
||||||
|
var
|
||||||
|
IDETool: TObject;
|
||||||
|
CompOpts: TLazCompilerOptions;
|
||||||
|
Pkg: TIDEPackage;
|
||||||
|
ToolData: TIDEExternalToolData;
|
||||||
|
begin
|
||||||
|
if not IsApplicable(Msg,ToolData,IDETool) then exit;
|
||||||
|
if IDETool is TLazProject then begin
|
||||||
|
CompOpts:=TLazProject(IDETool).LazCompilerOptions;
|
||||||
|
CompOpts.MessageFlags[Msg.MsgID]:=cfvHide;
|
||||||
|
Msg.MarkFixed;
|
||||||
|
end else if IDETool is TIDEPackage then begin
|
||||||
|
if PackageEditingInterface.DoOpenPackageFile(ToolData.Filename,
|
||||||
|
[pofAddToRecent],false)<>mrOk then exit;
|
||||||
|
Pkg:=PackageEditingInterface.FindPackageWithName(ToolData.ModuleName);
|
||||||
|
if Pkg=nil then exit;
|
||||||
|
CompOpts:=Pkg.LazCompilerOptions;
|
||||||
|
CompOpts.MessageFlags[Msg.MsgID]:=cfvHide;
|
||||||
|
Msg.MarkFixed;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TQuickFixLocalVariableNotUsed_Remove }
|
{ TQuickFixLocalVariableNotUsed_Remove }
|
||||||
|
|
||||||
function TQuickFixLocalVariableNotUsed_Remove.IsApplicable(Msg: TMessageLine;
|
function TQuickFixLocalVariableNotUsed_Remove.IsApplicable(Msg: TMessageLine;
|
||||||
@ -504,9 +583,9 @@ begin
|
|||||||
Msg.MarkFixed;
|
Msg.MarkFixed;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TQuickFix_Hide }
|
{ TQuickFix_HideWithIDEDirective }
|
||||||
|
|
||||||
procedure TQuickFix_Hide.QuickFix(Fixes: TMsgQuickFixes; Msg: TMessageLine);
|
procedure TQuickFix_HideWithIDEDirective.QuickFix(Fixes: TMsgQuickFixes; Msg: TMessageLine);
|
||||||
var
|
var
|
||||||
Code: TCodeBuffer;
|
Code: TCodeBuffer;
|
||||||
|
|
||||||
@ -575,7 +654,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TQuickFix_Hide.IsApplicable(Msg: TMessageLine): boolean;
|
function TQuickFix_HideWithIDEDirective.IsApplicable(Msg: TMessageLine): boolean;
|
||||||
begin
|
begin
|
||||||
Result:=false;
|
Result:=false;
|
||||||
if (Msg.Urgency>=mluError)
|
if (Msg.Urgency>=mluError)
|
||||||
@ -586,7 +665,7 @@ begin
|
|||||||
Result:=true;
|
Result:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TQuickFix_Hide.CreateMenuItems(Fixes: TMsgQuickFixes);
|
procedure TQuickFix_HideWithIDEDirective.CreateMenuItems(Fixes: TMsgQuickFixes);
|
||||||
var
|
var
|
||||||
Msg: TMessageLine;
|
Msg: TMessageLine;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
@ -670,11 +749,13 @@ begin
|
|||||||
fMenuItemToInfo:=TPointerToPointerTree.Create;
|
fMenuItemToInfo:=TPointerToPointerTree.Create;
|
||||||
|
|
||||||
// init standard quickfixes
|
// init standard quickfixes
|
||||||
IDEQuickFixes.RegisterQuickFix(TQuickFix_Hide.Create);
|
IDEQuickFixes.RegisterQuickFix(TQuickFix_HideWithIDEDirective.Create);
|
||||||
IDEQuickFixes.RegisterQuickFix(TQuickFixIdentifierNotFoundAddLocal.Create);
|
IDEQuickFixes.RegisterQuickFix(TQuickFixIdentifierNotFoundAddLocal.Create);
|
||||||
IDEQuickFixes.RegisterQuickFix(TQuickFixLocalVariableNotUsed_Remove.Create);
|
IDEQuickFixes.RegisterQuickFix(TQuickFixLocalVariableNotUsed_Remove.Create);
|
||||||
IDEQuickFixes.RegisterQuickFix(TQuickFixUnitNotFound_Remove.Create);
|
IDEQuickFixes.RegisterQuickFix(TQuickFixUnitNotFound_Remove.Create);
|
||||||
IDEQuickFixes.RegisterQuickFix(TQuickFixClassWithAbstractMethods.Create);
|
IDEQuickFixes.RegisterQuickFix(TQuickFixClassWithAbstractMethods.Create);
|
||||||
|
|
||||||
|
IDEQuickFixes.RegisterQuickFix(TQuickFix_HideWithCompilerOption.Create);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TIDEQuickFixes.Destroy;
|
destructor TIDEQuickFixes.Destroy;
|
||||||
|
@ -44,7 +44,7 @@ uses
|
|||||||
// IDEIntf
|
// IDEIntf
|
||||||
IDEExternToolIntf, BaseIDEIntf, MacroIntf, IDEMsgIntf,
|
IDEExternToolIntf, BaseIDEIntf, MacroIntf, IDEMsgIntf,
|
||||||
// IDE
|
// IDE
|
||||||
IDEDialogs, CompOptsIntf, TransferMacros;
|
IDEDialogs, CompOptsIntf, PackageIntf, LazIDEIntf, TransferMacros;
|
||||||
|
|
||||||
type
|
type
|
||||||
TLMVToolState = (
|
TLMVToolState = (
|
||||||
@ -189,6 +189,7 @@ type
|
|||||||
property RunningTools[Index: integer]: TExternalTool read GetRunningTools;
|
property RunningTools[Index: integer]: TExternalTool read GetRunningTools;
|
||||||
procedure EnterCriticalSection; override;
|
procedure EnterCriticalSection; override;
|
||||||
procedure LeaveCriticalSection; override;
|
procedure LeaveCriticalSection; override;
|
||||||
|
function GetIDEObject(ToolData: TIDEExternalToolData): TObject; override;
|
||||||
// parsers
|
// parsers
|
||||||
function ParserCount: integer; override;
|
function ParserCount: integer; override;
|
||||||
procedure RegisterParser(Parser: TExtToolParserClass); override;
|
procedure RegisterParser(Parser: TExtToolParserClass); override;
|
||||||
@ -1321,6 +1322,17 @@ begin
|
|||||||
System.LeaveCriticalsection(FCritSec);
|
System.LeaveCriticalsection(FCritSec);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TExternalTools.GetIDEObject(ToolData: TIDEExternalToolData): TObject;
|
||||||
|
begin
|
||||||
|
Result:=nil;
|
||||||
|
if ToolData=nil then exit;
|
||||||
|
if ToolData.Kind=IDEToolCompileProject then begin
|
||||||
|
Result:=LazarusIDE.ActiveProject;
|
||||||
|
end else if ToolData.Kind=IDEToolCompilePackage then begin
|
||||||
|
Result:=PackageEditingInterface.FindPackageWithName(ToolData.ModuleName);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TExternalTools.RegisterParser(Parser: TExtToolParserClass);
|
procedure TExternalTools.RegisterParser(Parser: TExtToolParserClass);
|
||||||
begin
|
begin
|
||||||
if fParsers.IndexOf(Parser)>=0 then exit;
|
if fParsers.IndexOf(Parser)>=0 then exit;
|
||||||
|
@ -7,7 +7,8 @@ interface
|
|||||||
uses
|
uses
|
||||||
Classes, SysUtils, FileUtil, LazFileCache, LazLoggerBase, ListFilterEdit,
|
Classes, SysUtils, FileUtil, LazFileCache, LazLoggerBase, ListFilterEdit,
|
||||||
StdCtrls, CheckLst, Dialogs, IDEOptionsIntf, IDEMsgIntf, IDEExternToolIntf,
|
StdCtrls, CheckLst, Dialogs, IDEOptionsIntf, IDEMsgIntf, IDEExternToolIntf,
|
||||||
MacroIntf, IDEDialogs, CodeToolsFPCMsgs, CompilerOptions, LazarusIDEStrConsts
|
MacroIntf, IDEDialogs, CompOptsIntf, CodeToolsFPCMsgs, CompilerOptions,
|
||||||
|
LazarusIDEStrConsts
|
||||||
{$IFDEF EnableNewExtTools}
|
{$IFDEF EnableNewExtTools}
|
||||||
,etFPCMsgParser
|
,etFPCMsgParser
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
Loading…
Reference in New Issue
Block a user