我该如何:Visual Studio 语法突出显示扩展
我想为 VS2010 开发一个扩展,它允许我为语法突出显示添加一些附加功能。
我安装了SDK,如何开始?
请提供一个小片段(或代码链接),我可以在其中看到如何开始。
注意:我是否必须检查整个代码块,或者 SDK 告诉我每个单词它是什么、如何声明等?
I want to develop an extension for VS2010 that will allow me make some additional features to syntax-highlighting.
I installed the SDK, how do I start from?
Please give a little snippet (or a link to code) where I can see how to start.
Note: do I have to check the whole block of code, or the SDK tells me on each word what it is, how it's declared etc.?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有很多关于编写分类器的信息。我写了一篇关于不久前。
至于示例/代码,有:
关于 SDK 是否告诉您每个单词是什么的问题的另一部分的答案是“否”,但有一些“有点”的警告。一般来说,底层语言模型不会公开,尽管您可以执行诸如使用来自其他分类器的分类信息之类的操作,希望它们能够为您提供足够的信息;有些(例如 C#)往往会提供大量信息,这些信息在默认字体和颜色设置中可能不会显示在 IDE 中(检查“工具”->“选项”->“环境”->“字体和颜色”设置以查看是否你想要改变的可能已经存在了),而其他的,比如 VB,往往不会。您还可以使用 DTE 的 CodeModel,但我从未听说过有人对此有过很好的体验。
如果您想要使用分类信息的示例,您可以查看此 CommentTextTagger.cs(拼写检查器扩展的一部分)可以做到这一点。
There's a decent bit of information out there for writing classifiers. I wrote a blog article about it awhile back.
As for samples/code, there's:
The answer to the other part of your question about if the SDK tells you what each word is, the answer is "no", with a few "kinda" caveats. In general, the underlying language models are not exposed, though you can do things like consume the classification information from other classifiers in the hope that they give you enough information; some, like C#, tend to give a good deal of information that may not show up in the IDE in the default fonts and colors settings (check the Tools->Options->Environment->Fonts and Colors settings to see if you want to change may already be there), and others, like VB, tend not to. You can also use things like DTE's CodeModel, but I've never heard of someone having really good experiences with it.
If you want an example of consuming classification information, you can see how this CommentTextTagger.cs (part of a spellchecker extension) does it.
您可以查看
http://code.msdn.microsoft.com/ookLanguage
,其中有C# 示例中“OokTokenTag.cs”中的语法突出显示。当然,您确实必须解析整个文本块,但这并不太难。
(发现该链接来自 http ://social.msdn.microsoft.com/Forums/en-US/vsx/thread/657212c1-1685-4ed6-be2f-cbf34fcc5b20)
You might check out
http://code.msdn.microsoft.com/ookLanguage
which has a syntax highlighter in "OokTokenTag.cs" in the C# sample. You do have to parse a whole block of text, of course, but this is not too hard.
(Found that link from http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/657212c1-1685-4ed6-be2f-cbf34fcc5b20 )