Socket
Book a DemoInstallSign in
Socket

first-mate-select-grammar

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

first-mate-select-grammar

provides `registry.selectGrammar` for dependants that need it like highlghts.

latest
Source
npmnpm
Version
1.0.3
Version published
Weekly downloads
899
112.03%
Maintainers
1
Weekly downloads
 
Created
Source

first-mate-select-grammar

provides selectGrammar searching functionality for dependants that used the 3.x api feature removed from highlights

var pickGrammar = require('first-mate-select-grammar')()
var GrammarRegistry = require('first-mate').GrammarRegistry

var registry = new GrammarRegistry({maxTokens:Infinity})
// you would probably.. registry.loadGrammarSync('path to grammar.cson')

var grammar = pickGrammar.selectGrammar(GrammarRegistry,'test.js',' var a = 1\n var b =2\n')
// yay! grammar is always defined!!

API

  • module.exports()

    • returns new instance of grammarSelector
  • grammarSelector.selectGrammar(firstMate.GrammarRegistry, [fileName,[fileContents]])

    • returns an instance of firstMate.Grammar

override API

this is provided because its useful to implement a grammar cache.

  • grammarSelector.setGrammarOverrideForPath(path)

    • sets an override
    • returns undefined
  • grammarSelector.grammarOverrideForPath(path)

    • returns a set grammar override
  • grammarSelector.clearGrammarOverrideForPath(path)

    • deletes an override
    • returns undefined
  • grammarSelector.clearGrammarOverrides(path)

  • deletes all overrides

Keywords

first-mate

FAQs

Package last updated on 26 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts