【问题标题】:Error trying to parse settings in Sublime Text 2.0.2尝试解析 Sublime Text 2.0.2 中的设置时出错
【发布时间】:2013-07-28 20:44:47
【问题描述】:

我是 Sublime Text 的新手,我无法在任何地方修复或找到此问题的答案。 我刚刚安装了Sublime Text,一开始它运行良好。然后我尝试在 Preferences-> Settings User 下更改一些设置,例如字体大小。当我保存时,它返回错误:

尝试解析设置时出错:C:\Users\Michael\AppData\Roaming\Sublime Text 2\Packages\User\Preferences.sublime-settings:18:1 中的预期字符串

(我的 ST 包的安装位置) 现在,每当我尝试打开 Sublime Text 2 时,它都会显示相同的错误消息,并且不会运行。 我卸载并重新安装了 ST,但问题仍然存在(在我尝试更改我的偏好之后)。 我在 Windows 7 上运行 Sublime Text 2.0.2。 任何关于如何解决这个问题(或者更好的是,为什么这个问题首先出现)的见解都将受到欢迎。

编辑:这是首选项文件的内容(我不知道如何上传文件本身,如果可能的话)

// Settings in here override those in "Default/Preferences.sublime-settings", and
// are overridden in turn by file type specific settings.
// "User/Preferences.sublime-settings", which overrides the settings in here.
//
// Settings may also be placed in file type specific options files, for
// example, in Packages/Python/Python.sublime-settings for python files.
{
    // Sets the colors used within the text area
    "color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",

    // Note that the font_face and font_size are overriden in the platform
    // specific settings file, for example, "Preferences (Linux).sublime-settings".
    // Because of this, setting them here will have no effect: you must set them
    // in your User File Preferences.
    "font_face": "",
    "font_size": 10,
}

【问题讨论】:

  • 您可以发布您的Preferences.sublime-settings 文件吗?可能是文件有错误。
  • 如您所见,preferences 文件中的内容不多,这对我来说是最烦人的部分。
  • 这是完整的文件;根据一些帖子,18:1 指的是第 18 行,第 1 列,但是,似乎没有第 18 行。
  • 我在最后添加了缺少的括号,仍然没有变化;它仍然返回错误消息。目前它只有在我删除 {} 中的所有内容时才会运行。

标签: sublimetext2


【解决方案1】:

删除最后一个逗号。变化:

"font_size": 10,

到:

"font_size": 10

【讨论】:

  • 谢谢,在删除其他所有内容并仅更改字体大小(及其后面的逗号)后,它起作用了!
【解决方案2】:

我刚刚遇到了同样的问题,我通过以下方式解决了它:

  • 验证 JSON 是否有效
  • 确保文件编码为“UTF-8”(文件 > 使用编码保存...)

【讨论】:

    猜你喜欢
    • 2012-09-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-27
    • 1970-01-01
    • 1970-01-01
    • 2022-10-01
    • 2017-09-12
    相关资源
    最近更新 更多