File tree 1 file changed +11
-3
lines changed
1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 1
1
import type { StateStackImpl } from '../vendor/vscode-textmate/src/grammar'
2
2
import { ShikiError } from './error'
3
3
import type { StateStack } from './textmate'
4
+ import { INITIAL } from './textmate'
4
5
5
6
/**
6
7
* GrammarState is a special reference object that holds the state of a grammar.
7
8
*
8
9
* It's used to highlight code snippets that are part of the target language.
9
10
*/
10
11
export class GrammarState {
12
+ /**
13
+ * Static method to create a initial grammar state.
14
+ */
15
+ static initial ( lang : string , theme : string ) {
16
+ return new GrammarState ( INITIAL , lang , theme )
17
+ }
18
+
11
19
constructor (
12
- private _stack : StateStack ,
13
- public lang : string ,
14
- public theme : string ,
20
+ private readonly _stack : StateStack ,
21
+ public readonly lang : string ,
22
+ public readonly theme : string ,
15
23
) { }
16
24
17
25
get scopes ( ) {
You can’t perform that action at this time.
0 commit comments