原子 - 片段不起作用



以下是我在smippets.cson文件中脚本的两个摘要:

'.source.python':
  'print statement':
    'prefix': 'pr'
    'body' : 'print "${1:Hello world}"'

'.source.python':
  'Argument variables import':
    'prefix' : 'argv'
    'body' : 'from sys import argv'

第一个不起作用,但是第二个是不起作用的。请帮助。

ps。

当我第一次在计算机上安装原子时,摘要文件是空白的。我使用Ubuntu 16.04。那是正常的吗?

我相信您的问题的根源是您的范围.source.python被声明了两次。

首先回答您的第二个问题,不,我的smippets.cson文件在我第一次打开时并不空白。相反,它包含以下内容:

# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#
# '.source.coffee':
#   'Console log':
#     'prefix': 'log'
#     'body': 'console.log $1'
#
# Each scope (e.g. '.source.coffee' above) can only be declared once.
#
# This file uses CoffeeScript Object Notation (CSON).
# If you are unfamiliar with CSON, you can read more about it in the
# Atom Flight Manual:
# http://flight-manual.atom.io/using-atom/sections/basic-customization/#_cson

(虽然这是在MacOS上(。

请注意,它如何指示您每个范围只能声明一次。我认为,如果您修改两个片段以包含在同一范围中,它们将按预期工作。

snippets.cson更改为以下似乎对我有用:

'.source.python':
  'print statement':
    'prefix': 'pr'
    'body' : 'print "${1:Hello world}"'
  'Argument variables import':
    'prefix' : 'argv'
    'body' : 'from sys import argv'

我可以从摘要导入菜单中访问两个摘要,一旦我使.source.python范围独特。

ubuntu上的原子1.53.0 x64 20.10('groovy gorilla"

我必须禁用"建筑"设置"中的片段在核心包装中,"语言 - html"(0.53.1(。从那里,我将片段复制为前缀,将其粘贴到我自己的本地片段中。

我还必须重新启动原子才能使编辑器显示我的自定义片段用于使用。

原始片段。没有提示,没有例子。纯vi -Feeling: - (

最新更新