logue / vue-codemirror6

⌨️ @codemirror 6 component for @vuejs. Vue2 & Vue3 both supported.
https://logue.dev/vue-codemirror6/
MIT License
123 stars 16 forks source link

[Question] Example with json lint ? #4

Closed cloudsolace closed 2 years ago

cloudsolace commented 2 years ago

Was trying to find any examples with json lint but in vain, can someone help ?

logue commented 2 years ago

There is a bug on the VueCodemirror6 side and it cannot be specified with the lint prop, but it can be avoided with the extensions prop.

For JSON, specify the extensions prop as shown below.

<code-mirror v-model="value" :extensions="cmExtensions" />
    const cmExtensions: Extension[] = [
      linter(jsonParseLinter()),
      lintGutter(),
      basicSetup,
      json(),
    ];

The point is not to use the basic prop, but to specify it directly in the extensions prop.

image

logue commented 2 years ago

Fixed in 0.5.1.