如何使用 Open Tools API 折叠插入的区域?
我想在编辑视图中插入一个区域,然后折叠该区域。
// fEditView: IOTAEditView;
var
writer: IOTAEditWriter;
begin
writer := fEditView.Buffer.CreateUndoableWriter;
//...
writer.Insert('{$REGION ''Documentation''}'#13#10'{$ENDREGION}');
writer := nil; // Flush the buffer
fEditView.Position.GotoLine(lineNo); // go to the line number of the region
fEditView.Paint;
end;
此代码片段将在代码编辑器中插入一个区域。但是 IDE 需要执行一些操作才能在代码编辑器中生成这样的区域。
有没有办法强制 IDE 执行此操作,然后我可以使用它
(fEditView as IOTAElideActions).ElideNearestBlock;
来折叠它?
I wanna insert a region in an edit view and then fold this region.
// fEditView: IOTAEditView;
var
writer: IOTAEditWriter;
begin
writer := fEditView.Buffer.CreateUndoableWriter;
//...
writer.Insert('{$REGION ''Documentation''}'#13#10'{$ENDREGION}');
writer := nil; // Flush the buffer
fEditView.Position.GotoLine(lineNo); // go to the line number of the region
fEditView.Paint;
end;
This code snippet will insert a region in the code editor. But the IDE needs some action to generate such a region in the code editor.
Is there any way to force the IDE do this action and then I can use
(fEditView as IOTAElideActions).ElideNearestBlock;
to fold it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由 grubby 反复试验发现:-)
EnableElisions() 似乎实际上切换省略功能。
关闭并重新打开省略似乎达到了预期的效果。正在进行一些不太漂亮的屏幕更新。能不能压制住我就不知道了。
Found by grubby trial-and-error :-)
EnableElisions() appears to actually toggle the elisions feature.
Turning elisions off and back on again seems to have the desired effect. There is some not very pretty screen updating going on. Whether it is possible to suppress that I don't know.