mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
Revert "Move snippet body parsing to web worker"
This reverts commit 5b541ccc2b.
It caused the snippets spec to break. I'll try to achieve the same
thing without that happening.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
AtomPackage = require 'atom-package'
|
||||
fs = require 'fs'
|
||||
PEG = require 'pegjs'
|
||||
_ = require 'underscore'
|
||||
SnippetExpansion = require './src/snippet-expansion'
|
||||
Snippet = require './src/snippet'
|
||||
LoadSnippetsTask = require './src/load-snippets-task'
|
||||
@@ -8,6 +10,7 @@ module.exports =
|
||||
class Snippets extends AtomPackage
|
||||
|
||||
snippetsByExtension: {}
|
||||
parser: PEG.buildParser(fs.read(require.resolve 'snippets/snippets.pegjs'), trackLineAndColumn: true)
|
||||
loaded: false
|
||||
|
||||
activate: (@rootView) ->
|
||||
@@ -33,7 +36,8 @@ class Snippets extends AtomPackage
|
||||
for selector, snippetsByName of snippetsBySelector
|
||||
snippetsByPrefix = {}
|
||||
for name, attributes of snippetsByName
|
||||
{ prefix, body, bodyTree } = attributes
|
||||
{ prefix, body } = attributes
|
||||
bodyTree = @parser.parse(body)
|
||||
snippet = new Snippet({name, prefix, bodyTree})
|
||||
snippetsByPrefix[snippet.prefix] = snippet
|
||||
syntax.addProperties(selector, snippets: snippetsByPrefix)
|
||||
|
||||
@@ -1,17 +1,8 @@
|
||||
fs = require 'fs'
|
||||
TextMatePackage = require 'text-mate-package'
|
||||
PEG = require 'pegjs'
|
||||
|
||||
module.exports =
|
||||
|
||||
parser: PEG.buildParser(fs.read(require.resolve 'snippets/snippets.pegjs'), trackLineAndColumn: true)
|
||||
|
||||
snippetsLoaded: (snippets) ->
|
||||
for snippet in snippets
|
||||
for selector, snippetsByName of snippet
|
||||
for name, attributes of snippetsByName
|
||||
attributes.bodyTree = @parser.parse(attributes.body)
|
||||
callTaskMethod('snippetsLoaded', snippets)
|
||||
snippetsLoaded: (snippets) -> callTaskMethod('snippetsLoaded', snippets)
|
||||
|
||||
loadTextmateSnippets: (path) ->
|
||||
snippetsDirPath = fs.join(path, 'Snippets')
|
||||
|
||||
Reference in New Issue
Block a user