codemirror6-plugin icon indicating copy to clipboard operation
codemirror6-plugin copied to clipboard

Emmet does not use correct syntax highlighting

Open mak0226 opened this issue 2 years ago • 5 comments

I'm currently using @codemirror/theme-one-dark on Codemirror 6 alongside Emmet (implemented using the abbreviationTracker extension) and I've noticed that the syntax highlighting is incorrect. See below for images.

How it should look: Screenshot 2022-08-30 7 15 00 PM

How it looks: Screenshot 2022-08-30 7 14 36 PM

Thanks.

mak0226 avatar Aug 30 '22 23:08 mak0226

You should pass syntax highlighting as option: abbreviation({ preview: { html: yourCustomHighighter } })

sergeche avatar Aug 31 '22 08:08 sergeche

Do you have an example of how exactly that should be used?

abbreviationTracker({
  preview: {
     html: // theme or language?
  }
});

shshaw avatar Mar 08 '23 22:03 shshaw

You should pass an extension factory function, which will be invoked when preview widget is created. E.g.

import { html } from '@codemirror/lang-html';
abbreviationTracker({
  preview: {
     html: html
  }
});

sergeche avatar Mar 09 '23 07:03 sergeche

Hm. But is that the way to actually load a theme? That would just be for the language syntax

shshaw avatar Mar 09 '23 17:03 shshaw

AFAIK there’s no such thing as theme or language syntax, only extensions. From factory function, you may return an extension or array of extensions, I think you may just define which extensions (syntax highlight, theme etc) you want to use in preview.

sergeche avatar Mar 10 '23 08:03 sergeche