Visual C++ 2008 语法高亮
我正在 VS 2008 中编写一个 C++-CLI 库,它仅突出显示关键字。我希望突出显示 CLR 类型和我定义的类型。尝试过“工具”->“选项”->“环境”->“字体和颜色”似乎不起作用。有人可以告诉我如何在 VS 中做到这一点而不使用任何插件(如果插件是免费的,我很乐意使用)。
I am writing a C++-CLI library in VS 2008, it highlights only the keywords. I would like to have highlighting for CLR types and the types that I define as well. Tried Tools->Options->Environment->Fonts and Colors doesnt seem to work. Can someone let me know how to do it in VS without using any plugin (happy to use if the plugin is free).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您无法从 Visual Studio 中获取此内容。它的语法高亮是基于词法分析的。它检测简单的编程元素、关键字、标识符、注释、数字、字符串文字、预处理器指令等。有选择地突出显示标识符是一个更难的问题,它需要解析文本。
这不仅很慢,影响文本渲染速度,而且也很难做到,因为在编辑代码时文本几乎总是处于不可解析的状态。 C++ IDE 的通用插件是 Whole Tomato 的 Visual Assist。但它肯定不是免费的,这些附加组件从来都不是免费的。不知道他们对 C++/CLI 的支持程度,您必须尝试下载试用版。
You cannot get this out of Visual Studio. Its syntax highlighting is based on lexical analysis. Which detects simple programming elements, keyword, identifier, comment, number, string literal, preprocessor directive, etc. Selectively highlighting identifiers is a much harder problem, it requires parsing the text.
Not only is that slow, affecting the text rendering speed, it is also very difficult to do since the text is almost always in an un-parsable state as you're editing the code. The universal plug-in for the C++ IDE is Visual Assist from Whole Tomato. But it certainly isn't free, these kind of add-ons never are. No idea to what degree they support C++/CLI, you'd have to try with the trial download.