我为 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/