diff --git a/src/gui/gui.qrc b/src/gui/gui.qrc index 09b71730..09134548 100644 --- a/src/gui/gui.qrc +++ b/src/gui/gui.qrc @@ -29,5 +29,6 @@ gui/rc.xml gui/slint.xml + gui/treesitter-query.xml diff --git a/src/gui/gui/treesitter-query.xml b/src/gui/gui/treesitter-query.xml new file mode 100644 index 00000000..9153c52f --- /dev/null +++ b/src/gui/gui/treesitter-query.xml @@ -0,0 +1,139 @@ + +]++|"[^"]*+")*+"> + + + + + + + + + +]> + + + + + ! + _ + . + * + ? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/gui/treesitterinspector.cpp b/src/gui/treesitterinspector.cpp index 4391a6f3..b4a943a1 100644 --- a/src/gui/treesitterinspector.cpp +++ b/src/gui/treesitterinspector.cpp @@ -96,6 +96,7 @@ TreeSitterInspector::TreeSitterInspector(QWidget *parent) setAttribute(Qt::WA_DeleteOnClose); ui->setupUi(this); + m_errorHighlighter = new QueryErrorHighlighter(ui->query->document()); auto theme = GuiSettings::instance()->theme(); if (theme.isEmpty()) @@ -104,7 +105,11 @@ TreeSitterInspector::TreeSitterInspector(QWidget *parent) m_errorHighlighter->setTheme(repository.theme(theme)); // For now we simply use the highlighting for "scheme", which is close enough in many cases. // However, we could consider implementing our own highlighting in the future. - m_errorHighlighter->setDefinition(repository.definitionForMimeType("text/x-scheme")); + auto definition = repository.definitionForMimeType("text/x-treesitter-query"); + if (!definition.isValid()) { + spdlog::warn("Could not find definition for treesitter-query"); + } + m_errorHighlighter->setDefinition(definition); connect(Core::Project::instance(), &Core::Project::currentDocumentChanged, this, &TreeSitterInspector::changeCurrentDocument);