【发布时间】:2016-04-01 22:26:47
【问题描述】:
我已经为 Sublime Text 3 安装了 TypeScript 包。我希望它仍然为代码语法着色,但不是红色下划线并抱怨错误。我似乎无法在偏好中找到任何可以为我做这件事的东西。我该怎么做?
【问题讨论】:
标签: typescript sublimetext3 sublimetext sublime-text-plugin
我已经为 Sublime Text 3 安装了 TypeScript 包。我希望它仍然为代码语法着色,但不是红色下划线并抱怨错误。我似乎无法在偏好中找到任何可以为我做这件事的东西。我该怎么做?
【问题讨论】:
标签: typescript sublimetext3 sublimetext sublime-text-plugin
临时解决方案:在.../Packges/TypeScript/typescript/commands/error_info.py 中注释第 26 - 29 行(包括)并重新启动 sublime。如果您在构建错误时遇到此问题,您可能还希望在 sublime 设置中禁用内联错误"show_errors_inline": false,
...
if len(error_text) > 0:
# if PHANTOM_SUPPORT:
# template = '<body><style>div.error {{ background-color: brown; padding: 5px; color: white }}</style><div class="error">{0}</div></body>'
# display_text = template.format(error_text)
# self.view.add_phantom("typescript_error", self.view.sel()[0], display_text, sublime.LAYOUT_BLOCK)
self.view.set_status("typescript_error", error_text)
https://github.com/Microsoft/TypeScript-Sublime-Plugin/issues/556#issuecomment-260439591
注意:这会禁用大红色块,但会留下红色下划线。如果您也不想要这些,请评论整个文件。
【讨论】:
这是一个 hack,但它会做你想做的事:
/home/jack/.config/sublime-text-3/Packages/TypeScript
从TypeScript 文件夹中打开typescript 文件夹,然后打开listeners 文件夹。
将文件error_list.py重命名为error_list_old.py
这将删除红色下划线和插件对错误的抱怨,但也会删除整个错误列表功能(因此插件将不再告诉你它认为你的 TypeScript 代码有什么问题)。
如果您只想删除红色下划线(但保留其余部分),它可能位于该文件中的某个位置。
【讨论】: