All files / src/cm6 spel-language.ts

100% Statements 1/1
100% Branches 0/0
100% Functions 1/1
100% Lines 1/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17                            193x    
import { LanguageSupport, syntaxHighlighting } from '@codemirror/language';
import { createSpelStreamParser } from './spel-grammar.js';
import { spelHighlightStyle } from './spel-highlight.js';
 
/**
 * SpEL language support for CodeMirror 6.
 *
 * Provides syntax highlighting via the spel-ts tokenizer and a CM6 StreamLanguage,
 * with highlights that are present as soon as this extension is used: the highlight
 * style is part of the support rather than something every consumer has to remember
 * to add. `LanguageSupport` alone installs no highlighting, so a language built
 * without this colours nothing while still assigning tags to tokens.
 */
export function spelLanguage(): LanguageSupport {
  return new LanguageSupport(createSpelStreamParser(), [syntaxHighlighting(spelHighlightStyle)]);
}