我正在尝试编写一个简单的荧光笔(它会在pas文件中突出显示某种变量)
我使用了http://www.delphi-central.com/syntax_highlighting.aspx
中的代码问题是从不调用Tokenize过程。 它确实通过以下方式在“注册”过程中注册:
RegisterPackageWizard(TSimpleHighlight.Create);
或通过以下方式在构造函数中:
(BorlandIDEServices As IOTAHighlightServices).AddHighlighter(TSimpleHighlight.Create);
当我启动菜单Tools.Options
时,GetName被调用代码段:
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;
本教程提到“使用OTA,您可以为新的源文件类型创建荧光笔”。所以我必须以某种方式为pas文件注册它,还是我遗漏了其他东西?