Snippets : "unexpected :"


#1

Hi,
I can’t create snippets, an error “unexpected :” is returned.
My snippet code is :

'text.plain':
	'HTML Bootstrap':
		'prefix': 'bs'
			'body': 'test'

image

Can you help please ?


#2

Hello.

Try this:
FILE := snippets.cson

'.plain.text':
  'HTML Bootstrap':
    'prefix': 'bs'
    'body': 'test'

Note the . before plain and also the indentation.


Bonus:
FILE := keymap.cson

# MAIN TEXT EDITOR
'atom-text-editor:not(.mini)':
  'alt-x': 'snippets:available'

I have the above keybinding active when trying out new snippets. alt-x in this case will bring up all possible snippets so I may review them. Now I know if the snippet is even available for the language/grammar.

Helpful?


#3

Thanks it works ! =)
I thought this would be the scope as indicated in snippets settings :
image

And I don’t know why there has to be this bizarre indention : “0 space + 2 spaces + 1 tab + 1 tab”, but eh, your code works.


#4

That is the scope name, but snippets and keymaps use keys written as CSS selectors, so each segment of the scope needs a period before it.