danipen / TextMateSharp

A port of tm4e to bring TextMate grammars to dotnet ecosystem
MIT License
87 stars 15 forks source link

TextMateSharp with Wasm not working? #57

Open HendrikMennen opened 8 months ago

HendrikMennen commented 8 months ago

I saw the package TextmateSharp.Wasm. Is it possible to run with AvaloniaEdit? For me AvaloniaEdit alone works in Wasm. As soon as I add some highlighting it breaks, with or without the TextMateSharp.Wasm package. Maybe I am not doing it right, since I didn't see any demo project for this

danipen commented 8 months ago

TextMateSharp should support WASM but it's possible that the AvaloniaEdit TextMate integration may not be fully prepared to work with WASM yet.

SKProCH commented 3 months ago

Hello, @danipen

Is there any progress on this problem? Seems like TextMate.Wasm package exists, but installing it doesn't change anything - app still hangs while applying coloring to AvaloniaEdit.

danipen commented 3 months ago

It worked some time ago but I didn't try it recently. Any clue of what the issue is?

SKProCH commented 3 months ago

Actually I think this is something related to TextMate library calls or coloring the AvaloniaEdit (perhaps a multithreading or something like that). I've actually use your library for ShowMeTheXaml editor: https://github.com/AvaloniaUtils/ShowMeTheXaml.Avalonia/blob/master/ShowMeTheXaml.Avalonia.AvaloniaEdit/XamlDisplayAvaloniaEditThemeBehavior.cs

And seems like initialization was completed successfully:

https://github.com/AvaloniaUtils/ShowMeTheXaml.Avalonia/blob/53c1c0c7e3702072a2b77560a67d4cb1abab95cf/ShowMeTheXaml.Avalonia.AvaloniaEdit/XamlDisplayAvaloniaEditThemeBehavior.cs#L27-L34

But after that apps hangs out.

Actual issue is reproduceable in Material.Avalonia demo app for browser. Here is the link: https://avaloniacommunity.github.io/Material.Avalonia/ (aim on code icons on the bottom right side of controls on any page).

Also, this issue only reproduceable in browser WASM, since NAOT app on desktop works fine.

I'd be grateful for any help to diagnose this issue.

Numpsy commented 3 months ago

It worked some time ago but I didn't try it recently. Any clue of what the issue is?

I was never able to get WasmEnableTheads to work properly in Avalonia 11.0 (various problems occuring before it even got to the TextMateSharp bit), but I just had another try with the Avalonia 11.1 nightly and it seems to have worked:

image

(that's both highlighting Json and doing folding at the same time)

SKProCH commented 3 months ago

Hmm, I should give it a try.

SKProCH commented 2 months ago

Seems like my case still doesn't work properly with nightly avalonia. @Numpsy, can you, please, share your project?

Numpsy commented 2 months ago

The screen shot I posted is from a project at work that I can't post all the code for, but I'll try to extract a sample out of it