Keymap.cson says it fails to load


#1

This error keeps popping up in the upper right corner saying it failed to load keymap.cson:

Syntax error on line 33, column 2: One top level value expected

Lines 33 and 34 look like this:

'atom-text-editor':
  'f5': 'tabletopsimulator-lua:saveAndPlay'

Strangely, the F5 functionality still works despite the error.

Can anyone explain what the problem is and how to fix it? Thanks in advance!


#2

Hey, can you share your entire keymap.cson file?


#3

Okay, I discovered that the problem goes away if I delete the block comment at the end. Is there something wrong with the block comment?

# Your keymap
#
# Atom keymaps work similarly to style sheets. Just as style sheets use
# selectors to apply styles to elements, Atom keymaps use selectors to associate
# keystrokes with events in specific contexts. Unlike style sheets however,
# each selector can only be declared once.
#
# You can create a new keybinding in this file by typing "key" and then hitting
# tab.
#
# Here's an example taken from Atom's built-in keymap:
#
# 'atom-text-editor':
#   'enter': 'editor:newline'
#
# 'atom-workspace':
#   'ctrl-shift-p': 'core:move-up'
#   'ctrl-p': 'core:move-down'
#
# You can find more information about keymaps in these guides:
# * http://flight-manual.atom.io/using-atom/sections/basic-customization/#_customizing_keybindings
# * http://flight-manual.atom.io/behind-atom/sections/keymaps-in-depth/
#
# If you're having trouble with your keybindings not working, try the
# Keybinding Resolver: `Cmd+.` on macOS and `Ctrl+.` on other platforms. See the
# Debugging Guide for more information:
# * http://flight-manual.atom.io/hacking-atom/sections/debugging/#check-the-keybindings
#
# 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
'atom-text-editor':
  'f5': 'tabletopsimulator-lua:saveAndPlay'

###
'body':
  'enter': ''
'atom-text-editor:not([mini])':
  'enter': ''
'.select-list atom-text-editor[mini]':
  'enter': ''
'body .native-key-bindings':
  'enter': ''
'.go-to-line atom-text-editor[mini]':
  'enter': ''
'.corrections atom-text-editor[mini]':
  'enter': ''
'.tree-view':
  'enter': ''
'.tree-view-dialog atom-text-editor[mini]':
  'enter': ''
###

#4

The implementation of CSON we use does not appear to support block comments. If you comment the rest of the file using single-line comments, Atom does not complain.

# Your keymap
#
# Atom keymaps work similarly to style sheets. Just as style sheets use
# selectors to apply styles to elements, Atom keymaps use selectors to associate
# keystrokes with events in specific contexts. Unlike style sheets however,
# each selector can only be declared once.
#
# You can create a new keybinding in this file by typing "key" and then hitting
# tab.
#
# Here's an example taken from Atom's built-in keymap:
#
# 'atom-text-editor':
#   'enter': 'editor:newline'
#
# 'atom-workspace':
#   'ctrl-shift-p': 'core:move-up'
#   'ctrl-p': 'core:move-down'
#
# You can find more information about keymaps in these guides:
# * http://flight-manual.atom.io/using-atom/sections/basic-customization/#_customizing_keybindings
# * http://flight-manual.atom.io/behind-atom/sections/keymaps-in-depth/
#
# If you're having trouble with your keybindings not working, try the
# Keybinding Resolver: `Cmd+.` on macOS and `Ctrl+.` on other platforms. See the
# Debugging Guide for more information:
# * http://flight-manual.atom.io/hacking-atom/sections/debugging/#check-the-keybindings
#
# 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
'atom-text-editor':
  'f5': 'tabletopsimulator-lua:saveAndPlay'

# 'body':
#   'enter': ''
# 'atom-text-editor:not([mini])':
#   'enter': ''
# '.select-list atom-text-editor[mini]':
#   'enter': ''
# 'body .native-key-bindings':
#   'enter': ''
# '.go-to-line atom-text-editor[mini]':
#   'enter': ''
# '.corrections atom-text-editor[mini]':
#   'enter': ''
# '.tree-view':
#   'enter': ''
# '.tree-view-dialog atom-text-editor[mini]':
#   'enter': ''

#5

Okay, thanks!