code-snippets - atom.io 片段不起作用

标签 code-snippets atom-editor

我为 ReactJS 编写了一个简单的 Atom.io 片段:

'.text.js':
'React Component':
'prefix': 'rrc'
'body': 'var Component = React.createClass({ 
                render: function(){
                    return { 
                        ; 
                    }  
                } 
            })'

我将其保存到

atom/resources/app/dot-atom/snippets.cson

文件片段所在的位置,通过输入 'rrc' 并按 Tab 键进行尝试后,我只得到一个空格

我用谷歌搜索了一下,其他人也遇到了类似的问题,但我没有找到适合我的解决方案。

最佳答案

根据 Atom 的 snippet documentation看来源选择器应该是“.source.js”而不是“.text.js”

此外,您还需要将其设为多行代码段:

'.source.js':
  'React Component':
  'prefix': 'rrc'
  'body': """
     var Component = React.createClass({ 
        render: function(){
          return { 
              ; 
          }  
        } 
      })
   """

关于code-snippets - atom.io 片段不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28146126/

相关文章:

javascript - ES6 : What does "import $ from ' jquery'"really means?

view - Atom 编辑器 - 如何修复 : Only one tab open at a time

clojure - 如何使用 Figwheel 设置 Atom 编辑器以进行 clojurescript 开发?

c# - 如何自动生成必须为每个方法编写的代码?

xml - 我可以在 VS 2010 HTML 片段中包含 CDATA 部分吗?

python - 故意错误的代码(Python)

groovy - 我们可以让这个片段更精彩吗?

sass - 为什么SCSS会在atom中编译错误?

html - 是否可以将带有 html 的 Markdown 文件转换为 pdf?