Sublime Text 3 线条周围的白框

Sublime Text 3 white boxes around lines

注意:刚开始使用 Sublime Text 3 在 Python 中编程。我不确定为什么每一行都变成白色 dots/mark,请参见下图。我想学习以下内容。

  1. 是不是出错了?
  2. 是因为包还是命令?
  3. 我尝试了 CTRL+Space、CTRL+G 和 CTRL+K,但我仍然得到白色标记,我需要担心吗?

这是由于 SublimeLinter 安装配置不正确造成的。您可以阅读 here 如何配置这个相当复杂的插件,以及您安装的任何相关 Python linter。或者,您可以通过选择 Preferences → Package Control → Package Control: Disable Package 然后输入 sublimelinter 并点击 来完全禁用插件输入.

如果您有兴趣,您会收到错误,因为您的代码不符合 PEP8 并且包含一些其他错误。你需要更多地使用空格:

listone = [1, 2, 3]
listtwo = [1, 2, 3]
matrix_one = [listone, listtwo]
matrix_one = [row[0] for row in matrix_one] # are you sure you really want
                                            # to overwrite your original matrix?

print matrix_one # you had matrix_ones in your original code

我还 强烈 鼓励您使用 Python 3 如果您刚刚开始学习该语言。 Stack Overflow Python community overwhelmingly recommends starting with Python 3, as does python.org itself。版本 3 是语言的现在和未来,而版本 2 是过去。在先学习 2 的过程中,你会养成许多需要在学习 3 时改正的坏习惯(你最终需要这样做),所以最好先从 3 开始,然后再学习 2 的差异稍后。

您可能安装了 Anaconda 软件包。如果是这样,您需要转到首选项 → 包设置 → Anaconda → Settings-User。然后粘贴以下代码并保存。那些箱子应该不见了。

{
    "anaconda_linting": false,
}

前往:Preferences -> Package Settings -> SublimeLinter -> Settings

styles -> mark_style

上将值更改为 none

我在sublime上安装anacoda包后遇到了这个问题

所以去,

Preferences -> Package Settings -> choose package(Anacoda) -> Settings-User

不存在则改为false。否则按照@James Xingjian Zhang的建议复制粘贴到其中。

您可以通过将其更改为真实状态来恢复它。

{
    "anaconda_linting": false,
}

我知道这是一个旧线程,但我没有看到任何好的答案。 linter 导致框的原因是因为糟糕的编程风格。 示例: -- 在列表或元组 linter 中的逗号之后在第 1、2 和 3 行中查找 'space'。 示例第 6 行: Python 正在寻找要按下的 return 键以在脚本末尾创建一个新行或白色 space . 示例第 6 行: 您需要将 python 3.

的打印输出括起来
'listone = [1, 2, 3]'
'listtwo = [1, 2, 3]'
'matrix_one = [listone, listtwo]'
'matrix_one = [row[0] for row in matrix_one]'

'print(matrix_one)'

如果您安装了 anaconda 软件包,这将解决问题。

{
    "anaconda_linting": false,
}

对于 Anaconda,考虑保留错误通知,但让它们更容易被人看到。从 Sublime Text > preferences > Package Settings > Anaconda > Settings - Default

编辑

"anaconda_linter_mark_style": "none"

选项如下:

/*
    If 'outline' (default), anaconda will outline error lines.
    If 'fill', anaconda will fill the lines.
    If 'solid_underline', anaconda will draw a solid underline below regions.
    If 'stippled_underline', anaconda will draw a stippled underline below regions.
    If 'squiggly_underline', anaconda will draw a squiggly underline below regions.
    If 'none', anaconda will not draw anything on error lines.
*/