I started to build an app for previewing Djot markup text while editing, the app is based on Gnome Text Editor. I’m using Djot’s javascript parser (launched within WebKitGtkWebView) to tag the text on the GtkSourceView, in order to highlight the source Djot text.
Here is the source code link, (branch appending_djot_previewer).
The problem is, when I’m trying to assign a new tag table (function defined here) to the GtkSourceView (parent instance of EditorDocument in this project), the GtkSourcebuffer is still tagging in markdown, not in Djot, and the following error apears:
Does anyone knows why and what that means? (As I understand this error apears when trying to set a new tag while there is already another tag named the same in the table, but I can’t find the place where it happens to disable it)
You will have to make sure to disable the gtksourceview own highlighting (set GtkSource.Buffer:highlight-syntax to FALSE) before applying your custom tags.
I really don’t see where that could come from… Try setting the env variable G_DEBUG=fatal-criticals and launch the app in a debugger to get a call stack.
I found that the error occurred because the EditorDocument hadn’t been initialized yet. That’s why it failed. When I moved the call to the create_tags function into the editor_document_constructed method of EditorDocument, everything worked perfectly.