I'm trying to write a simple highlighter (which adds highlighting a certain kind of variable in a pas-file)
I used the code in http://www.delphi-central.com/syntax_highlighting.aspx
problem is that the Tokenize procedure is never called. It does get registered in the Register procedure by:
RegisterPackageWizard(TSimpleHighlight.Create);
or alternatively in the constructor by:
(BorlandIDEServices As IOTAHighlightServices).AddHighlighter(TSimpleHighlight.Create);
and GetName gets called when I launch the menu Tools.Options
code snippet:
TSimpleHighlight = class(TNotifierObject, IUnknown, IOTANotifier, IOTAHighlighter, IOTAWizard)
public
function GetIDString: string;
function GetName: string;
procedure Tokenize(StartClass: TOTALineClass; LineBuf: POTAEdChar;
LineBufLen: TOTALineSize; HighlightCodes: POTASyntaxCode);
function TokenizeLineClass(StartClass: TOTALineClass;
LineBuf: POTAEdChar; LineBufLen: TOTALineSize): TOTALineClass;
function GetState: TWizardState;
procedure Execute;
constructor Create;
end;
procedure Register;
begin
RegisterPackageWizard(TSimpleHighlight.Create);
end;
constructor TSimpleHighlight.Create;
begin
inherited;
(BorlandIDEServices as IOTAHighlightServices).AddHighlighter(Self);
end;
The tutorial mentions "Using OTA you can create highlighters for new source file types." so do I have to register this for pas-files somehow, or am I missing something else?