使用SublimeREPL时如何摆脱Sublime Text的错误突出显示错误?

时间:2019-02-10 00:02:16

标签: python python-3.x sublimetext3 sublimerepl

当使用'字符作为撇号时,使用SublimeREPL构建python代码会导致sublime文本将撇号误认为是单引号,并产生烦人的红色突出显示。

例如,此代码:

    hnumber = int(input("How many players are there? "))
           h_inc = 0
    while h_inc < hnumber:
        print(f"\n Player {h_inc + 1}'s hand:")
        print(deck1.draw())
        h_inc += 1

产生以下不愉快的结果: enter image description here

我想摆脱这些红色的条。在不完全禁用语法突出显示功能的情况下该怎么做?还是我最好的做法是为红色条创建切换热键?

1 个答案:

答案 0 :(得分:0)

我在this thread中找到了Aqueum的答案

转到 Sublime Text>首选项>程序包设置> SublimeREPL>设置-用户

(如果您的“设置-用户”为空,请首先复制“设置-默认”的内容)

在“ repl_view_settings”下:添加:

,
    "syntax": "Packages/Text/Plain text.tmLanguage"

所以我现在是:

// standard sublime view settings that will be overwritten on each repl view
// this has to be customized as a whole dictionary
"repl_view_settings": {
    "translate_tabs_to_spaces": false,
    "auto_indent": false,
    "smart_indent": false,
    "spell_check": false,
    "indent_subsequent_lines": false,
    "detect_indentation": false,
    "auto_complete": true,
    "line_numbers": false,
    "gutter": false,
    "syntax": "Packages/Text/Plain text.tmLanguage"
},