first-mate-select-grammar

WebJar for first-mate-select-grammar

License

License

ISC
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

first-mate-select-grammar
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

first-mate-select-grammar
WebJar for first-mate-select-grammar
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/soldair/first-mate-select-grammar

Download first-mate-select-grammar

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/first-mate-select-grammar/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>first-mate-select-grammar</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/first-mate-select-grammar/
implementation 'org.webjars.npm:first-mate-select-grammar:1.0.1'
// https://jarcasting.com/artifacts/org.webjars.npm/first-mate-select-grammar/
implementation ("org.webjars.npm:first-mate-select-grammar:1.0.1")
'org.webjars.npm:first-mate-select-grammar:jar:1.0.1'
<dependency org="org.webjars.npm" name="first-mate-select-grammar" rev="1.0.1">
  <artifact name="first-mate-select-grammar" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='first-mate-select-grammar', version='1.0.1')
)
libraryDependencies += "org.webjars.npm" % "first-mate-select-grammar" % "1.0.1"
[org.webjars.npm/first-mate-select-grammar "1.0.1"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.npm : lodash jar [3.10.1,4)

Project Modules

There are no modules declared in this project.

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

Versions

Version
1.0.1