【发布时间】:2021-12-30 15:20:34
【问题描述】:
为了更好地与同事相处,我为 atom 配置了 2 个空格的制表符,但在某些文件中,我更喜欢 4 个。我正在尝试确定另一种文件类型,在这种情况下,我的 Foo.pro 文件使用 Qt Creator 创建。
我已经尝试了几十种方法,但似乎没有任何效果。我正在编辑我的~/.atom/config.cson,然后重新启动atom,没有任何变化。
这是我最近的尝试:
"*":
core:
customFileTypes:
"source.pro": [
"pro"
]
disabledPackages: [
"autocomplete-plus"
"markdown-preview"
"markdown-preview-plus"
"spell-check"
]
telemetryConsent: "limited"
themes: [
"atom-light-ui"
"one-light-syntax"
]
editor: {}
"exception-reporting":
userId: "283f523f-3348-4956-97f6-a73675e6e9c6"
"tree-view":
hideVcsIgnoredFiles: true
welcome:
showOnStartup: false
".basic.html.text":
editor:
tabLength: 4
".html.source":
editor:
tabLength: 4
".source.pro":
editor:
tabLength: 4
".shell.source":
editor:
tabLength: 4
".shtml.source":
editor:
tabLength: 4
我很确定其中一些也不起作用。在 Atom 中,如果我打开我的 .pro 文件并执行 Alt-Cmnd-P,它会显示文件类型为 text.plain.null-grammar。制表符宽度仍然是 2 个字符。很明显我做错了什么。
您会注意到我正在尝试定义自定义文件类型(位于顶部),然后定义制表符长度(靠近底部)。
【问题讨论】:
-
Alt-Cmnd-P是什么?editor:log-cursor-scope? -
您是否为
source.pro安装了语法? -
@wjandrea 在 Mac 上,它会告诉您它认为您的文件是什么语言。不,我没有特定的语法。虽然有一个 language-qtpro 包。我会尝试安装它,看看会发生什么。
-
@wjandrea 安装该语言包似乎改善了行为。我什至没有想到我应该去看看。现在我必须意识到这一点。 Alt-cmnd-p 现在报告
source.pro和keyword.operator.qtpro。我不确定第二个是什么,但事情正在按我想要的方式进行。 -
我认为您看到的是
keyword.operator.qtpro,因为 Alt-Cmd-P 运行editor:log-cursor-scope,并且您的光标位于语言运算符的中间。
标签: atom-editor