Load nvatom grammar on atom

This commit is contained in:
Seongjae Lee
2015-09-28 21:42:23 -07:00
parent 51f769a017
commit 6ae37437be
2 changed files with 8 additions and 1 deletions
+7
View File
@@ -1,10 +1,12 @@
fs = require 'fs-plus'
path = require 'path'
{CompositeDisposable} = require 'atom'
Utility = require './utility'
module.exports =
class Interlink
constructor: ->
Interlink.loadGrammarSync()
@subscriptions = new CompositeDisposable
@subscriptions.add atom.commands.add 'atom-workspace', 'nvatom:openInterlink': => Interlink.openInterlink()
@subscriptions.add atom.workspace.observeTextEditors (editor) ->
@@ -14,6 +16,11 @@ class Interlink
destroy: ->
@subscriptions.dispose()
@loadGrammarSync: ->
unless atom.grammars.grammarForScopeName('source.gfm.nvatom')
grammarPath = path.join(atom.packages.resolvePackagePath('nvatom'), 'grammars', 'nvatom.cson')
atom.grammars.loadGrammarSync(grammarPath)
@openInterlink: ->
editor = atom.workspace.getActiveTextEditor()
return unless editor?
+1 -1
View File
@@ -19,7 +19,7 @@ describe 'Interlink', ->
afterEach ->
atom.config.set('nvatom.directory', defaultDirectory)
describe 'when getInerlinkUnderCursor is called', ->
describe 'when getInterlinkUnderCursor is called', ->
editor = null
describe 'under the note directory', ->