mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-09 08:29:06 +02:00
started custom highlighters
git-svn-id: trunk@8843 -
This commit is contained in:
parent
73d8121123
commit
615b02380e
@ -3399,9 +3399,9 @@ begin
|
||||
ctsNestedCommentsOn,ExternalMacroStart+'NestedComments','',da_DefineRecurse);
|
||||
MainDir.AddChild(DefTempl);
|
||||
// enable FPDocSystem to find compiler functions like writeln and readln
|
||||
DefTempl:=TDefineTemplate.Create('FPDocSystem',
|
||||
{DefTempl:=TDefineTemplate.Create('FPDocSystem',
|
||||
ctsFPDocSystemOn,'FPDocSystem','',da_DefineRecurse);
|
||||
MainDir.AddChild(DefTempl);
|
||||
MainDir.AddChild(DefTempl);}
|
||||
|
||||
// compiler
|
||||
CompilerDir:=TDefineTemplate.Create('Compiler',ctsCompiler,'','compiler',
|
||||
|
@ -841,7 +841,7 @@ begin
|
||||
nil,
|
||||
nil,
|
||||
ctnProcedure);
|
||||
NewItem.ParamList:='various';
|
||||
NewItem.ParamList:='Args : Arguments';
|
||||
CurrentIdentifierList.Add(NewItem);
|
||||
|
||||
// begin..end -> add 'writeln'
|
||||
@ -854,7 +854,31 @@ begin
|
||||
nil,
|
||||
nil,
|
||||
ctnProcedure);
|
||||
NewItem.ParamList:='various';
|
||||
NewItem.ParamList:='Args : Arguments';
|
||||
CurrentIdentifierList.Add(NewItem);
|
||||
|
||||
// begin..end -> add 'read'
|
||||
NewItem:=TIdentifierListItem.Create(
|
||||
icompUnknown,
|
||||
false,
|
||||
3,
|
||||
'Read',
|
||||
StatementLevel,
|
||||
nil,
|
||||
nil,
|
||||
ctnProcedure);
|
||||
CurrentIdentifierList.Add(NewItem);
|
||||
|
||||
// begin..end -> add 'readln'
|
||||
NewItem:=TIdentifierListItem.Create(
|
||||
icompUnknown,
|
||||
false,
|
||||
3,
|
||||
'ReadLn',
|
||||
StatementLevel,
|
||||
nil,
|
||||
nil,
|
||||
ctnProcedure);
|
||||
CurrentIdentifierList.Add(NewItem);
|
||||
|
||||
if Context.Tool.NodeIsInAMethod(Context.Node)
|
||||
|
13
ide/main.pp
13
ide/main.pp
@ -3653,7 +3653,7 @@ begin
|
||||
SaveAsFileExt:=PascalExtension[EnvironmentOptions.PascalFileExtension]
|
||||
else
|
||||
SaveAsFileExt:=EditorOpts.HighlighterList.GetDefaultFilextension(
|
||||
SrcEdit.SyntaxHighlighterType);
|
||||
SrcEdit.SyntaxHighlighterType);
|
||||
end;
|
||||
AnUnitInfo.ReadUnitNameFromSource(true);
|
||||
SaveAsFilename:=AnUnitInfo.UnitName;
|
||||
@ -4267,14 +4267,11 @@ begin
|
||||
|
||||
// change syntax highlighter
|
||||
if not AnUnitInfo.CustomHighlighter then begin
|
||||
NewHighlighter:=
|
||||
ExtensionToLazSyntaxHighlighter(ExtractFileExt(NewFilename));
|
||||
if NewHighlighter<>AnUnitInfo.SyntaxHighlighter then begin
|
||||
AnUnitInfo.SyntaxHighlighter:=NewHighlighter;
|
||||
if SrcEdit<>nil then
|
||||
SrcEdit.SyntaxHighlighterType:=AnUnitInfo.SyntaxHighlighter;
|
||||
end;
|
||||
AnUnitInfo.SyntaxHighlighter:=
|
||||
ExtensionToLazSyntaxHighlighter(ExtractFileExt(NewFilename));
|
||||
end;
|
||||
if (SrcEdit<>nil) then
|
||||
SrcEdit.SyntaxHighlighterType:=AnUnitInfo.SyntaxHighlighter;
|
||||
|
||||
// save file
|
||||
Result:=DoSaveCodeBufferToFile(NewSource,NewSource.Filename,
|
||||
|
@ -182,7 +182,7 @@ type
|
||||
var Special: boolean; var FG, BG: TColor);
|
||||
Function RefreshEditorSettings: Boolean;
|
||||
procedure SetSyntaxHighlighterType(
|
||||
ASyntaxHighlighterType: TLazSyntaxHighlighter);
|
||||
ASyntaxHighlighterType: TLazSyntaxHighlighter);
|
||||
procedure SetErrorLine(NewLine: integer);
|
||||
procedure SetExecutionLine(NewLine: integer);
|
||||
procedure OnCodeBufferChanged(Sender: TSourceLog;
|
||||
@ -469,6 +469,7 @@ type
|
||||
|
||||
// PopupMenu
|
||||
procedure BuildPopupMenu;
|
||||
procedure UpdateHighlightMenuItems;
|
||||
procedure RemoveUserDefinedMenuItems;
|
||||
function AddUserDefinedPopupMenuItem(const NewCaption: string;
|
||||
const NewEnabled: boolean;
|
||||
@ -886,6 +887,7 @@ begin
|
||||
uemShowUnitInfo);
|
||||
SrcEditMenuEditorProperties:=RegisterIDEMenuCommand(SubPath,
|
||||
'EditorProperties',uemEditorProperties);
|
||||
SrcEditMenuSectionHighlighter:=RegisterIDEMenuSection(SubPath,'Highlighter');
|
||||
end;
|
||||
|
||||
{ TSourceEditor }
|
||||
@ -1836,7 +1838,6 @@ end;
|
||||
|
||||
procedure TSourceEditor.SetErrorLine(NewLine: integer);
|
||||
begin
|
||||
//writeln('[TSourceEditor.SetErrorLine] ',NewLine,',',fErrorLine);
|
||||
if fErrorLine=NewLine then exit;
|
||||
fErrorLine:=NewLine;
|
||||
fErrorColumn:=EditorComponent.CaretX;
|
||||
@ -3436,9 +3437,10 @@ begin
|
||||
if ASrcEdit=nil then exit;
|
||||
EditorComp:=ASrcEdit.EditorComponent;
|
||||
|
||||
// readonly
|
||||
// Readonly, ShowLineNumbers
|
||||
SrcEditMenuReadOnly.MenuItem.Checked:=ASrcEdit.ReadOnly;
|
||||
SrcEditMenuShowLineNumbers.MenuItem.Checked:=EditorComp.Gutter.ShowLineNumbers;
|
||||
UpdateHighlightMenuItems;
|
||||
|
||||
// bookmarks
|
||||
for BookMarkID:=0 to 9 do begin
|
||||
@ -3615,6 +3617,18 @@ begin
|
||||
SrcEditMenuEditorProperties.OnClick:=@EditorPropertiesClicked;
|
||||
end;
|
||||
|
||||
procedure TSourceNotebook.UpdateHighlightMenuItems;
|
||||
var
|
||||
h: TLazSyntaxHighlighter;
|
||||
i: Integer;
|
||||
begin
|
||||
i:=0;
|
||||
for h:=Low(TLazSyntaxHighlighter) to High(TLazSyntaxHighlighter) do begin
|
||||
|
||||
inc(i);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TSourceNotebook.RemoveUserDefinedMenuItems;
|
||||
begin
|
||||
SrcEditMenuSectionFirstDynamic.Clear;
|
||||
|
@ -364,8 +364,10 @@ var
|
||||
SrcEditSubMenuGotoBookmarks: TIDEMenuSection;
|
||||
// Source Editor: Set Bookmarks Submenu
|
||||
SrcEditSubMenuSetBookmarks: TIDEMenuSection;
|
||||
// Source Editor: Flags section
|
||||
// Source Editor: Flags and options section
|
||||
SrcEditMenuSectionFlags: TIDEMenuSection;
|
||||
// Source Editor: Highlighter section
|
||||
SrcEditMenuSectionHighlighter: TIDEMenuSection;
|
||||
// Source Editor: Debug submenu
|
||||
SrcEditSubMenuDebug: TIDEMenuSection;
|
||||
// Source Editor: Move Page section
|
||||
|
Loading…
Reference in New Issue
Block a user