IDE+codetools: using compiler mode Delphi when set in compiler options

git-svn-id: trunk@16092 -
This commit is contained in:
mattias 2008-08-17 19:45:49 +00:00
parent b53d0aeba0
commit ea23d0c086
16 changed files with 450 additions and 825 deletions

View File

@ -1318,7 +1318,7 @@ begin
Result:=cmFPC;
Evaluator:=DefineTree.GetDefinesForDirectory(Directory,true);
if Evaluator=nil then exit;
for cm:=Low(TCompilerMode) to High(TCompilerMode) do
for cm:=Succ(Low(TCompilerMode)) to High(TCompilerMode) do
if Evaluator.IsDefined(CompilerModeVars[cm]) then
Result:=cm;
end;

View File

@ -237,6 +237,7 @@ ResourceString
ctsDefineMacroName = 'Define Macro %s';
ctsNamedProject = '%s Project';
ctsDefine = 'Define ';
ctsUndefine = 'Undefine ';
ctsCommandLineParameters = 'Command line parameters';
// eventcodetool

View File

@ -4749,7 +4749,7 @@ end;
function TDefinePool.CreateFPCCommandLineDefines(const Name, CmdLine: string;
RecursiveDefines: boolean; Owner: TObject; AlwaysCreate: boolean): TDefineTemplate;
function ReadNextParam(LastEndPos: integer;
var StartPos, EndPos: integer): boolean;
begin
@ -4781,15 +4781,51 @@ function TDefinePool.CreateFPCCommandLineDefines(const Name, CmdLine: string;
Result.AddChild(NewTempl);
end;
procedure AddDefine(const AName, ADescription, AVariable, AValue: string);
var
NewAction: TDefineAction;
begin
if RecursiveDefines then
NewAction:=da_DefineRecurse
else
NewAction:=da_Define;
AddDefine(AName,ADescription,AVariable,AValue,NewAction);
end;
procedure AddDefine(const AName: string; const AValue: string = '');
begin
AddDefine('Define '+AName,ctsDefine+AName,AName,AValue);
end;
procedure AddUndefine(const AName: string);
var
NewAction: TDefineAction;
begin
if RecursiveDefines then
NewAction:=da_UndefineRecurse
else
NewAction:=da_Undefine;
AddDefine('Undefine '+AName,ctsUndefine+AName,AName,'',NewAction);
end;
procedure AddDefineUndefine(const AName: string; Define: boolean);
begin
if Define then
AddDefine(AName)
else
AddUndefine(AName);
end;
var
StartPos, EndPos: Integer;
s: string;
NewAction: TDefineAction;
CompilerMode: String;
begin
Result:=nil;
if AlwaysCreate then
CreateMainTemplate;
EndPos:=1;
CompilerMode:='';
while ReadNextParam(EndPos,StartPos,EndPos) do begin
if (StartPos<length(CmdLine)) and (CmdLine[StartPos]='-') then begin
// a parameter
@ -4799,16 +4835,42 @@ begin
begin
// define
s:=copy(CmdLine,StartPos+2,EndPos-StartPos-2);
if RecursiveDefines then
NewAction:=da_DefineRecurse
else
NewAction:=da_Define;
AddDefine('Define '+s,ctsDefine+s,s,'',NewAction);
AddDefine(s);
end;
'u':
begin
// undefine
s:=copy(CmdLine,StartPos+2,EndPos-StartPos-2);
AddUndefine(s);
end;
'S':
begin
// syntax
inc(StartPos,2);
while StartPos<EndPos do begin
case CmdLine[StartPos] of
'2': CompilerMode:='ObjFPC';
'd': CompilerMode:='Delphi';
'o': CompilerMode:='TP';
'p': CompilerMode:='GPC';
end;
inc(StartPos);
end;
end;
end;
end;
end;
if CompilerMode<>'' then begin
AddDefineUndefine('FPC_ObjFPC',SysUtils.CompareText(CompilerMode,'ObjFPC')=0);
AddDefineUndefine('FPC_Delphi',SysUtils.CompareText(CompilerMode,'Delphi')=0);
AddDefineUndefine('FPC_TP',SysUtils.CompareText(CompilerMode,'TP')=0);
AddDefineUndefine('FPC_GPC',SysUtils.CompareText(CompilerMode,'GPC')=0);
AddDefineUndefine('FPC_MACPAS',SysUtils.CompareText(CompilerMode,'MACPAS')=0);
end;
Result.SetDefineOwner(Owner,true);
end;

View File

@ -322,6 +322,7 @@ type
function MakeOptionsString(const MainSourceFileName: string;
Globals: TGlobalCompilerOptions;
Flags: TCompilerCmdLineOptions): String; virtual;
function GetSyntaxOptionsString: string; virtual;
function GetXMLConfigPath: String; virtual;
function CreateTargetFilename(const MainSourceFileName: string): string; virtual;
function GetTargetFileExt: string; virtual;
@ -371,6 +372,7 @@ type
function ShortenPath(const SearchPath: string;
MakeAlwaysRelative: boolean): string;
function GetCustomOptions(Parsed: TCompilerOptionsParseType = coptParsed): string;
function GetOptionsForCTDefines: string;
function GetEffectiveLCLWidgetType: string;
public
// Properties
@ -1703,6 +1705,20 @@ begin
Result:=SpecialCharsToSpaces(Result);
end;
function TBaseCompilerOptions.GetOptionsForCTDefines: string;
procedure Add(s: string);
begin
if Result<>'' then
Result:=Result+' ';
Result:=Result+s;
end;
begin
Result:=GetCustomOptions(coptParsed);
Add(GetSyntaxOptionsString);
end;
function TBaseCompilerOptions.GetEffectiveLCLWidgetType: string;
begin
Result:=LCLWidgetType;
@ -1961,6 +1977,7 @@ Processor specific options:
tempsw := '-S' + tempsw;
switches := switches + ' ' + tempsw;
end;
tempsw:=GetSyntaxOptionsString;
{ TODO: Implement the following switches. They need to be added
to the dialog. }
@ -2299,6 +2316,67 @@ Processor specific options:
Result := fOptionsString;
end;
function TBaseCompilerOptions.GetSyntaxOptionsString: string;
var
tempsw: String;
begin
{ Syntax Options
-S<x> Syntax options:
-S2 Same as -Mobjfpc
-Sc Support operators like C (*=,+=,/= and -=)
-Sa Turn on assertions
-Sd Same as -Mdelphi
-Se<x> Error options. <x> is a combination of the following:
<n> : Compiler halts after the <n> errors (default is 1)
w : Compiler also halts after warnings
n : Compiler also halts after notes
h : Compiler also halts after hints
-Sg Enable LABEL and GOTO (default in -Mtp and -Mdelphi)
-Sh Use ansistrings by default instead of shortstrings
-Si Turn on inlining of procedures/functions declared as "inline"
-Sk Load fpcylix unit
-SI<x> Set interface style to <x>
-SIcom COM compatible interface (default)
-SIcorba CORBA compatible interface
-Sm Support macros like C (global)
-So Same as -Mtp
-Ss Constructor name must be init (destructor must be done)
-St Allow static keyword in objects
-Sx Enable exception keywords (default in Delphi/ObjFPC modes)
}
tempsw := '';
if (Delphi2Extensions) then
tempsw := tempsw + '2';
if (CStyleOperators) then
tempsw := tempsw + 'c';
if (IncludeAssertionCode) then
tempsw := tempsw + 'a';
if (DelphiCompat) then
tempsw := tempsw + 'd';
if (AllowLabel) then
tempsw := tempsw + 'g';
if (UseAnsiStrings) then
tempsw := tempsw + 'h';
if (CPPInline) then
tempsw := tempsw + 'i';
if (CStyleMacros) then
tempsw := tempsw + 'm';
if (TPCompatible) then
tempsw := tempsw + 'o';
if (GPCCompat) then
tempsw := tempsw + 'p';
if (InitConstructor) then
tempsw := tempsw + 's';
if (StaticKeyword) then
tempsw := tempsw + 't';
if (tempsw <> '') then
Result := '-S' + tempsw
else
Result:='';
end;
{------------------------------------------------------------------------------
TBaseCompilerOptions GetXMLConfigPath
------------------------------------------------------------------------------}

View File

@ -20,7 +20,7 @@ object frmCompilerOptions: TfrmCompilerOptions
Width = 669
Align = alTop
Anchors = [akTop, akLeft, akRight, akBottom]
PageIndex = 2
PageIndex = 1
TabOrder = 0
object PathPage: TPage
Caption = 'PathPage'
@ -280,6 +280,7 @@ object frmCompilerOptions: TfrmCompilerOptions
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
OnItemClick = grpSyntaxOptionsItemClick
TabOrder = 1
end
end

File diff suppressed because it is too large Load Diff

View File

@ -225,6 +225,7 @@ type
procedure ButtonShowOptionsClicked(Sender: TObject);
procedure FileBrowseBtnClick(Sender: TObject);
procedure FormResize(Sender: TObject);
procedure grpSyntaxOptionsItemClick(Sender: TObject; Index: integer);
procedure HelpButtonClick(Sender: TObject);
procedure InhTreeViewSelectionChanged(Sender: TObject);
procedure chkCustomConfigFileClick(Sender: TObject);
@ -428,6 +429,20 @@ procedure TfrmCompilerOptions.FormResize(Sender: TObject);
begin
end;
procedure TfrmCompilerOptions.grpSyntaxOptionsItemClick(Sender: TObject;
Index: integer);
begin
case Index of
0,6,9,11:
if grpSyntaxOptions.Checked[Index] then begin
grpSyntaxOptions.Checked[0]:=Index=0; // objfpc mode
grpSyntaxOptions.Checked[6]:=Index=6; // tp mode
grpSyntaxOptions.Checked[9]:=Index=9; // delphi mode
grpSyntaxOptions.Checked[11]:=Index=11;// gpc mode
end;
end;
end;
procedure TfrmCompilerOptions.HelpButtonClick(Sender: TObject);
begin
ShowContextHelpForIDE(Self);

View File

@ -47,7 +47,7 @@ uses
SynHighlighterPython, SynHighlighterUNIXShellScript, SynHighlighterXML,
SynHighlighterJScript, SynEditMiscClasses,
// codetools
Laz_XMLCfg,
LinkScanner, CodeToolManager, Laz_XMLCfg,
// IDEIntf
IDECommands, IDEWindowIntf, SrcEditorIntf,
// IDE
@ -780,6 +780,7 @@ var
function ShowEditorOptionsDialog: TModalResult;
function StrToLazSyntaxHighlighter(const s: String): TLazSyntaxHighlighter;
function ExtensionToLazSyntaxHighlighter(Ext: String): TLazSyntaxHighlighter;
function FilenameToLazSyntaxHighlighter(Filename: String): TLazSyntaxHighlighter;
function BuildBorlandDCIFile(
ACustomSynAutoComplete: TCustomSynAutoComplete): Boolean;
@ -881,6 +882,21 @@ begin
end;
end;
function FilenameToLazSyntaxHighlighter(Filename: String
): TLazSyntaxHighlighter;
var
CompilerMode: TCompilerMode;
begin
Result:=ExtensionToLazSyntaxHighlighter(ExtractFileExt(Filename));
if Result in [lshFreePascal,lshDelphi] then begin
CompilerMode:=CodeToolBoss.GetCompilerModeForDirectory(ExtractFilePath(Filename));
if CompilerMode in [cmDELPHI,cmTP] then
Result:=lshDelphi
else
Result:=lshFreePascal;
end;
end;
const
EditOptsConfFileName = 'editoroptions.xml';

View File

@ -77,7 +77,7 @@ uses
LResources, StdCtrls, Forms, Buttons, Menus, FileUtil, Controls, GraphType,
Graphics, ExtCtrls, Dialogs, InterfaceBase, LDockCtrl,
// codetools
BasicCodeTools, AVL_Tree, Laz_XMLCfg,
LinkScanner, BasicCodeTools, AVL_Tree, Laz_XMLCfg,
CodeToolsStructs, CodeToolManager, CodeCache, DefineTemplates,
// synedit
SynEditKeyCmds,
@ -3566,6 +3566,7 @@ begin
MainBuildBoss.RescanCompilerDefines(true,true);
Project1.DefineTemplates.AllChanged;
IncreaseCompilerParseStamp;
UpdateHighlighters;
end;
finally
frmCompilerOptions.Free;
@ -3593,6 +3594,7 @@ begin
MainBuildBoss.RescanCompilerDefines(true,true);
Project1.DefineTemplates.AllChanged;
IncreaseCompilerParseStamp;
UpdateHighlighters;
end;
finally
frmCompilerOptions.Free;
@ -4125,9 +4127,9 @@ var EditorOptionsForm: TEditorOptionsForm;
Begin
EditorOptionsForm:=TEditorOptionsForm.Create(nil);
try
Project1.UpdateCustomHighlighter;
Project1.UpdateAllCustomHighlighter;
if EditorOptionsForm.ShowModal=mrOk then begin
Project1.UpdateSyntaxHighlighter;
Project1.UpdateAllSyntaxHighlighter;
SourceNotebook.ReloadEditorOptions;
ReloadMenuShortCuts;
end;
@ -5080,8 +5082,7 @@ begin
// change syntax highlighter
if not AnUnitInfo.CustomHighlighter then begin
NewHighlighter:=
ExtensionToLazSyntaxHighlighter(ExtractFileExt(NewFilename));
NewHighlighter:=FilenameToLazSyntaxHighlighter(NewFilename);
if NewHighlighter<>AnUnitInfo.SyntaxHighlighter then begin
AnUnitInfo.SyntaxHighlighter:=NewHighlighter;
if SrcEdit<>nil then
@ -6815,8 +6816,7 @@ begin
// get syntax highlighter type
if not AnUnitInfo.CustomHighlighter then
AnUnitInfo.SyntaxHighlighter:=
ExtensionToLazSyntaxHighlighter(ExtractFileExt(AFilename));
AnUnitInfo.SyntaxHighlighter:=FilenameToLazSyntaxHighlighter(AFilename);
NewSrcEditorCreated:=false;
//DebugLn(['TMainIDE.DoOpenFileInSourceEditor Revert=',ofRevert in Flags,' ',AnUnitInfo.Filename,' PageIndex=',PageIndex]);
@ -6976,8 +6976,7 @@ begin
end;
// syntax highlighter type
NewUnitInfo.SyntaxHighlighter:=
ExtensionToLazSyntaxHighlighter(ExtractFileExt(NewFilename));
NewUnitInfo.SyntaxHighlighter:=FilenameToLazSyntaxHighlighter(NewFilename);
// required packages
if NewUnitInfo.IsPartOfProject and (NewFileDescriptor.RequiredPackages<>'')
@ -13658,6 +13657,8 @@ var
AnIDesigner: TIDesigner;
begin
UpdateWindowMenu;
if FNeedUpdateHighlighters then
UpdateHighlighters(true);
GetDefaultProcessList.FreeStoppedProcesses;
EnvironmentOptions.ExternalTools.FreeStoppedProcesses;
if (SplashForm<>nil) then FreeThenNil(SplashForm);

View File

@ -56,12 +56,13 @@ uses
{$IFDEF IDE_MEM_CHECK}
MemCheck,
{$ENDIF}
Classes, LCLType, LCLIntf, StdCtrls, Buttons, Menus, ComCtrls, SysUtils,
Controls, Graphics, ExtCtrls, Dialogs, FileUtil, Forms, CodeToolManager,
CodeCache, AVL_Tree, SynEditKeyCmds,
// IDE
Classes, LCLType, LCLProc, LCLIntf, StdCtrls, Buttons, Menus, ComCtrls,
SysUtils, Controls, Graphics, ExtCtrls, Dialogs, FileUtil, Forms,
CodeToolManager, CodeCache, AVL_Tree, SynEditKeyCmds,
// IDEIntf
LazConf, LazarusIDEStrConsts, SrcEditorIntf, LazIDEIntf, MenuIntf,
IDECommands, IDEMsgIntf,
// IDE
ProjectDefs, Project, PublishModule, BuildLazDialog, Compiler,
ComponentReg, OutputFilter,
TransferMacros, ObjectInspector, PropEdits, IDEDefs, MsgView,
@ -77,6 +78,7 @@ type
private
FToolStatus: TIDEToolStatus;
protected
FNeedUpdateHighlighters: boolean;
function GetMainBar: TComponent; override;
function CreateMenuSeparator : TMenuItem;
@ -151,6 +153,7 @@ type
procedure UpdateWindowMenu; override;
procedure SetRecentSubMenu(Section: TIDEMenuSection; FileList: TStringList;
OnClickEvent: TNotifyEvent); override;
procedure UpdateHighlighters(Immediately: boolean = false); override;
function DoJumpToCodePosition(
ActiveSrcEdit: TSourceEditorInterface;
@ -1093,6 +1096,17 @@ begin
end;
end;
procedure TMainIDEBase.UpdateHighlighters(Immediately: boolean = false);
begin
if Immediately then begin
FNeedUpdateHighlighters:=false;
Project1.UpdateAllSyntaxHighlighter;
SourceNotebook.ReloadHighlighters;
end else begin
FNeedUpdateHighlighters:=true;
end;
end;
function TMainIDEBase.DoJumpToCodePosition(
ActiveSrcEdit: TSourceEditorInterface; ActiveUnitInfo: TUnitInfo;
NewSource: TCodeBuffer; NewX, NewY, NewTopLine: integer; AddJumpPoint: boolean

View File

@ -162,6 +162,7 @@ type
procedure UpdateWindowMenu; virtual; abstract;
procedure SaveEnvironment; virtual; abstract;
procedure UpdateHighlighters(Immediately: boolean = false); virtual; abstract;
procedure SetRecentSubMenu(Section: TIDEMenuSection; FileList: TStringList;
OnClickEvent: TNotifyEvent); virtual; abstract;
function DoJumpToSourcePosition(const Filename: string;

View File

@ -808,8 +808,8 @@ type
): TModalResult;
// source editor
procedure UpdateCustomHighlighter;
procedure UpdateSyntaxHighlighter;
procedure UpdateAllCustomHighlighter;
procedure UpdateAllSyntaxHighlighter;
// i18n
function GetPOOutDirectory: string;
@ -2699,8 +2699,7 @@ var
begin
NewBuf:=CodeToolBoss.CreateFile(Filename);
AnUnitInfo:=TUnitInfo.Create(NewBuf);
AnUnitInfo.SyntaxHighlighter:=
ExtensionToLazSyntaxHighlighter(ExtractFileExt(NewBuf.Filename));
AnUnitInfo.SyntaxHighlighter:=FilenameToLazSyntaxHighlighter(NewBuf.Filename);
Result:=AnUnitInfo;
end;
@ -4097,7 +4096,7 @@ begin
Result:=mrOk;
end;
procedure TProject.UpdateCustomHighlighter;
procedure TProject.UpdateAllCustomHighlighter;
var
i: Integer;
AnUnitInfo: TUnitInfo;
@ -4105,11 +4104,11 @@ begin
for i:=0 to UnitCount-1 do begin
AnUnitInfo:=Units[i];
AnUnitInfo.CustomHighlighter:=AnUnitInfo.SyntaxHighlighter
<>ExtensionToLazSyntaxHighlighter(ExtractFileExt(AnUnitInfo.Filename));
<>FilenameToLazSyntaxHighlighter(AnUnitInfo.Filename);
end;
end;
procedure TProject.UpdateSyntaxHighlighter;
procedure TProject.UpdateAllSyntaxHighlighter;
var
AnUnitInfo: TUnitInfo;
i: Integer;
@ -4118,7 +4117,7 @@ begin
AnUnitInfo:=Units[i];
if not AnUnitInfo.CustomHighlighter then
AnUnitInfo.SyntaxHighlighter:=
ExtensionToLazSyntaxHighlighter(ExtractFileExt(AnUnitInfo.Filename));
FilenameToLazSyntaxHighlighter(AnUnitInfo.Filename);
end;
end;
@ -5042,7 +5041,7 @@ begin
if (not Project.NeedsDefineTemplates) or (not Active) then exit;
// check if something has changed
NewCustomOptions:=Project.CompilerOptions.GetCustomOptions;
NewCustomOptions:=Project.CompilerOptions.GetOptionsForCTDefines;
if (FLastCustomOptions=NewCustomOptions) then exit;
FLastCustomOptions:=NewCustomOptions;

View File

@ -727,6 +727,7 @@ type
procedure GotoBookmark(Value: Integer);
procedure ReloadEditorOptions;
procedure ReloadHighlighters;
procedure CheckFont;
procedure GetSynEditPreviewSettings(APreviewEditor: TObject);
function GetEditorControlSettings(EditControl: TControl): boolean; override;
@ -2130,7 +2131,8 @@ begin
end;
end;
procedure TSourceEditor.SetSyntaxHighlighterType(ASyntaxHighlighterType: TLazSyntaxHighlighter);
procedure TSourceEditor.SetSyntaxHighlighterType(
ASyntaxHighlighterType: TLazSyntaxHighlighter);
begin
if (ASyntaxHighlighterType=fSyntaxHighlighterType)
and ((FEditor.Highlighter<>nil) = EditorOpts.UseSyntaxHighlight) then exit;
@ -6082,20 +6084,14 @@ Procedure TSourceNotebook.ReloadEditorOptions;
var
I: integer;
h: TLazSyntaxHighlighter;
ASrcEdit: TSourceEditor;
AnUnitInfo: TUnitInfo;
Begin
// this reloads the colors for the highlighter and other editor settings.
for h:=Low(TLazSyntaxHighlighter) to High(TLazSyntaxHighlighter) do
if Highlighters[h]<>nil then
EditorOpts.GetHighlighterSettings(Highlighters[h]);
for i := 0 to EditorCount-1 do begin
ASrcEdit:=Editors[i];
AnUnitInfo:=Project1.UnitWithEditorIndex(i);
if AnUnitInfo<>nil then
ASrcEdit.SyntaxHighlighterType:=AnUnitInfo.SyntaxHighlighter;
ASrcEdit.RefreshEditorSettings;
end;
ReloadHighlighters;
for i := 0 to EditorCount-1 do
Editors[i].RefreshEditorSettings;
// reload code templates
with CodeTemplateModul do begin
@ -6121,6 +6117,20 @@ Begin
CheckFont;
end;
procedure TSourceNotebook.ReloadHighlighters;
var
i: Integer;
ASrcEdit: TSourceEditor;
AnUnitInfo: TUnitInfo;
begin
for i := 0 to EditorCount-1 do begin
ASrcEdit:=Editors[i];
AnUnitInfo:=Project1.UnitWithEditorIndex(i);
if AnUnitInfo<>nil then
ASrcEdit.SyntaxHighlighterType:=AnUnitInfo.SyntaxHighlighter;
end;
end;
procedure TSourceNotebook.CheckFont;
var
SrcEdit: TSourceEditor;

View File

@ -524,9 +524,9 @@ type
procedure BeginUpdate;
procedure EndUpdate;
procedure PackageIDChanged;
procedure SourceDirectoriesChanged;
procedure OutputDirectoryChanged;
procedure CustomDefinesChanged;
procedure SourceDirectoriesChanged;// a source directory was added/deleted
procedure OutputDirectoryChanged;// the path or the defines of the output dir changed
procedure CustomDefinesChanged;// the defines of the source dirs changed
procedure AllChanged;
public
property LazPackage: TLazPackage read FLazPackage;
@ -4152,7 +4152,7 @@ begin
if (not LazPackage.NeedsDefineTemplates) or (not Active) then exit;
// check if something has changed
NewCustomOptions:=LazPackage.CompilerOptions.GetCustomOptions;
NewCustomOptions:=LazPackage.CompilerOptions.GetOptionsForCTDefines;
if FLastCustomOptions=NewCustomOptions then exit;
FLastCustomOptions:=NewCustomOptions;

View File

@ -37,10 +37,13 @@ unit PackageEditor;
interface
uses
// LCL FCL
Classes, SysUtils, Forms, Controls, StdCtrls, ComCtrls, Buttons, LResources,
Graphics, LCLType, LCLProc, Menus, Dialogs, FileUtil,
HelpIntfs, AVL_Tree, Laz_XMLCfg, LazIDEIntf, ProjectIntf, FormEditingIntf,
IDEProcs, LazConf, LazarusIDEStrConsts, IDEOptionDefs, IDEDefs,
Graphics, LCLType, LCLProc, Menus, Dialogs, FileUtil, AVL_Tree,
// IDEIntf CodeTools
HelpIntfs, LazIDEIntf, ProjectIntf, FormEditingIntf, Laz_XMLCfg,
// IDE
MainIntf, IDEProcs, LazConf, LazarusIDEStrConsts, IDEOptionDefs, IDEDefs,
IDEContextHelpEdit, CompilerOptions, CompilerOptionsDlg, ComponentReg,
PackageDefs, PkgOptionsDlg, AddToPackageDlg, PkgVirtualUnitEditor,
PackageSystem;
@ -1266,8 +1269,10 @@ begin
GetCompilerOptions;
Caption:=Format(lisPckEditCompilerOptionsForPackage,[LazPackage.IDAsString]);
ReadOnly:=LazPackage.ReadOnly;
if ShowModal=mrOk then
if ShowModal=mrOk then begin
LazPackage.DefineTemplates.AllChanged;
MainIDEInterface.UpdateHighlighters;// highlighting depends on compiler mode
end;
Free;
end;
UpdateTitle;

View File

@ -2452,6 +2452,9 @@ begin
Result:=mrOk;
PkgLinks.SaveUserLinks;
// the source editor highlighting depends on the compiler mode
MainIDEInterface.UpdateHighlighters;
end;
function TPkgManager.DoSavePackage(APackage: TLazPackage;