fisheva / Eva-Theme

A comfortable and semantic theme.
https://marketplace.visualstudio.com/items?itemName=fisheva.eva-theme
MIT License
451 stars 39 forks source link

Full code colorization support for `.dib` files #96

Closed sharpchen closed 1 year ago

sharpchen commented 1 year ago

What is a .dib file?

.dib is a format for representing notebook content, just like .ipynb for python. .dib is for some other languages for example C#, JavaScript based on .NET Interactive.

What extension I am using?

I am using Polyglot Notebook writing C# code. This extension supports both .dib and .ipynb, but the syntax highlighting is not working properly with .dib.

Screenshot

Working with .ipynb looks fine. image

Working with .dib when semantic highlighting is enabled. image

Working with .dib when semantic highlighting is disabled. image

Code Snippet

public static double Closure(((double, double)[] b, (double, double)[] f) tuple) {
        var l = tuple.b.Zip(tuple.f, (x, y) => (backward:x, forward:y));
        return l.Select(x => {
            var f = x.backward.Item1 - x.forward.Item1;
            var s = x.backward.Item1 - x.forward.Item2;
            return (f + s) / 2;
        }).Sum();
}
fisheva commented 1 year ago

Hi, @UPIMMUNITY

Sorry, I didn't write scope coloring rules specifically for .ipynb files, and I can't write scope coloring rules to support .dib files. They are not programming languages. I can't view the scope values of code blocks in .dib files.

All theme plugins add color to characters based on their scope value. All characters's scope value is given by VSCode. You can check them by pressing Ctrl+Shift+P (Windows) or Cmd+Shift+P (Mac) and selecting Inspect Editor Tokens and Scopes.

image

I have reviewed your .dib file using all the themes installed on my VSCode, and none of them have been colored for the code blocks, including the default theme for VSCode.

So you may got the logic wrong. It's not the theme that needs to support .dib files, but .dib files need to add the feature of importing code themes for display. So you may need to raise an issue under the Polyglot Notebook plugin.

sharpchen commented 1 year ago

@fisheva I see, you're right. Nothing is colorized without semantic highlighting.