Kingwl / monaco-volar

https://kingwl.github.io/monaco-volar/
MIT License
176 stars 25 forks source link

Code not working properly #17

Closed a145789 closed 1 year ago

a145789 commented 1 year ago

I tried to use the code from the test directory in my project.

When I replace the local reference with monaco-volar, in there

https://github.com/Kingwl/monaco-volar/blob/e6e9c3cf82cb6fb3cd94e834a3b82555ad532a27/tests/index.ts#L3

import { loadGrammars, loadTheme } from "monaco-volar";

Browser console reports an error.

image
Uncaught Error: Cannot read properties of undefined (reading 'OnigString')

TypeError: Cannot read properties of undefined (reading 'OnigString')
    at Object.createOnigString (rule.js:214:27)
    at Grammar2._tokenize (grammar.js:348:35)
    at Grammar2.tokenizeLine (grammar.js:314:22)
    at Object.tokenize (index.js:41:37)
    at TokenizationSupportAdapter.tokenizeEncoded (standaloneLanguages.js:180:43)
    at safeTokenize (textModelTokens.js:383:37)
    at TextModelTokenization._heuristicallyTokenizeViewport (textModelTokens.js:321:23)
    at TextModelTokenization.tokenizeViewport (textModelTokens.js:226:14)
    at TokenizationTextModelPart.tokenizeViewport (tokenizationTextModelPart.js:138:28)
    at ViewModel.tokenizeViewport (viewModelImpl.js:119:37)
    at errors.js:15:27

I don't know why this error is happening, is it a problem with my usage.