Skip to content
Open
Show file tree
Hide file tree
Changes from 47 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
cd9338d
WIP: Add Span-Inspector
Mar 27, 2025
413c826
added expansion of input-code
QuentinLeeWeber Apr 15, 2025
00455e4
added span highlighting
QuentinLeeWeber Apr 24, 2025
f412e4c
Add highlighting at cursor position
QuentinLeeWeber May 15, 2025
386c5fb
Improved errorhandling: show expansion errors in textfield
QuentinLeeWeber May 20, 2025
20787bc
Fix target-span determination and incorrect highlighting
QuentinLeeWeber Jun 3, 2025
89e8125
Sanitize expanded code in build_html
QuentinLeeWeber Jun 5, 2025
1e54b35
refactor: replaced get_span_data() with map
QuentinLeeWeber Jun 5, 2025
4b4a197
add loading indicator to span inspector
QuentinLeeWeber Jun 10, 2025
fd1c551
Add "{" and "}" to parsing filter
QuentinLeeWeber Jun 12, 2025
8b86bb5
span-inspector: make output scrollable, improve theme support, fix re…
QuentinLeeWeber Jun 19, 2025
eb779ba
span_inspector: add indication for synthesized tokens
QuentinLeeWeber Jun 24, 2025
027ec18
chore: add license headers and fix rustfmt formatting
QuentinLeeWeber Jun 24, 2025
3e1cd66
fix: update Cargo.lock to fix test failure with --locked
QuentinLeeWeber Jun 24, 2025
4d2d09d
Merge branch 'main' into span-inspector
QuentinLeeWeber Jun 24, 2025
382d5b0
fix: update Cargo.lock to fix test failure with --locked
QuentinLeeWeber Jun 24, 2025
61f40bd
fix: cargo test for span-inspector
QuentinLeeWeber Jun 26, 2025
1f9acfd
chore(clippy): apply Clippy suggestions to improve code quality
QuentinLeeWeber Jun 26, 2025
c9e5422
fix: update Cargo.lock
QuentinLeeWeber Jul 1, 2025
791cb56
fix: update Cargo.lock
QuentinLeeWeber Jul 1, 2025
98bab78
chore(span-inspector): optimize crate features of cxx-qt-lib
QuentinLeeWeber Sep 9, 2025
4276efe
chore: reorder line in Cargo.toml for clarity
QuentinLeeWeber Sep 9, 2025
3e7f103
chore(span_inspector): changed uri of qml_module
QuentinLeeWeber Sep 9, 2025
f8321b7
chore(span-inspector): removed unnecessary threadspawn
QuentinLeeWeber Sep 9, 2025
b9022e6
chore(span-inspector): removed unnecessary mutex for cursor_position
QuentinLeeWeber Sep 9, 2025
25e61d7
refactor(span-inspector): moved pretty-please filter into a universal…
QuentinLeeWeber Sep 9, 2025
7e562f8
refactor(span-inspector): replaced vec<(bool, bool)> with TokenFlag s…
QuentinLeeWeber Sep 9, 2025
b9ea593
feat(span-inspector): ensure only the last spawned thread can write t…
QuentinLeeWeber Sep 9, 2025
44995f0
feat(span-inspector): add minimal syntax-highlighting
QuentinLeeWeber Sep 18, 2025
508bd36
feat(span-inspector): add minimal Rust Playground-like syntax highlig…
QuentinLeeWeber Sep 18, 2025
30346c7
refactor(span-inspector): refactor syntax highlighting to use a state…
QuentinLeeWeber Sep 19, 2025
cbeeee4
fix(span-inspector): syntaxhighting for multiline marcos
QuentinLeeWeber Sep 29, 2025
4954c38
refactor(span-inspector): making use of QTextCursor to highlight spans
QuentinLeeWeber Nov 12, 2025
1336a6f
Merge branch 'main' into span-inspector-qsyntax-highlighter
QuentinLeeWeber Nov 12, 2025
e064f15
chore(span-inspector): remove compiler warnings
QuentinLeeWeber Nov 12, 2025
908a24d
fix(span-inspector): SyntaxHighlighter does not higlight error messag…
QuentinLeeWeber Nov 12, 2025
eb509a0
chore(span-inspector): make use of make_unique in cxx-qt-lib/common.h
QuentinLeeWeber Nov 19, 2025
6725695
fix(span-inspector): make TextEdit input scrollable
QuentinLeeWeber Nov 19, 2025
6b4a0ec
refactor(syntax-highlighter): rewrite of syntaxhighlighter inr rust
QuentinLeeWeber Dec 3, 2025
cae488a
refactor(span-inspector): rename TokenFlag::Default to TokenFlag::Gen…
QuentinLeeWeber Dec 3, 2025
2e6f50d
style(syntax-highglighter): change background colors
QuentinLeeWeber Dec 3, 2025
e606ec6
feat(span-inspector): add caching of expansion results
QuentinLeeWeber Dec 10, 2025
548c72f
refactor(syntax-highlighter): improve match statements in state maschine
QuentinLeeWeber Dec 10, 2025
d83243f
refactor(syntax-highlighter): move and rename function `rule` into im…
QuentinLeeWeber Dec 10, 2025
389b1b0
refactor(highlighting): finalFormats / PendingHighlights
QuentinLeeWeber Dec 10, 2025
2672393
update Cargo.lock
QuentinLeeWeber Dec 10, 2025
992f735
cargo clippy
QuentinLeeWeber Dec 10, 2025
320b9b8
chore(span-inspector): fix typo
QuentinLeeWeber Dec 22, 2025
66cf42d
chore(span-inspector): remove duplicate boilerplate
QuentinLeeWeber Dec 22, 2025
96cfc2e
chore(span-inspector): rename end to len in set_background / set_fore…
QuentinLeeWeber Dec 22, 2025
11b98f5
chore(syntax-highlighter): remove pending_highlights as member of Syn…
QuentinLeeWeber Dec 22, 2025
d1421f5
refactor(syntax-highlighter): impl From<i32> for State
QuentinLeeWeber Dec 22, 2025
90edbda
fix(syntax-highlighter): add #![ to multi-lane filter
QuentinLeeWeber Dec 22, 2025
0a48be6
color change
QuentinLeeWeber Dec 22, 2025
f00ea0b
Merge branch 'KDAB:main' into span-inspector-qsyntax-highlighter
QuentinLeeWeber Dec 22, 2025
d2931f1
fix(syntax-highlighter): update to cxx-qt version 0.8
QuentinLeeWeber Dec 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/span-inspector/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ cxx-qt-gen = { workspace = true }
proc-macro2.workspace = true
prettyplease = { version = "0.2", features = ["verbatim"] }
syn.workspace = true
fancy-regex = "0.16.2"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason you used fancy-regex and not regex?

Copy link
Contributor Author

@QuentinLeeWeber QuentinLeeWeber Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that the regex crate does not support lookahead or lookbehind.


[build-dependencies]
cxx-qt-build = { workspace = true, features = ["link_qt_object_files"] }
Expand Down
3 changes: 3 additions & 0 deletions examples/span-inspector/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// SPDX-FileCopyrightText: 2025 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
// SPDX-FileContributor: Leon Matthes <leon.matthes@kdab.com>
// SPDX-FileContributor: Quentin Weber <quentin.weber@kdab.com>
//
// SPDX-License-Identifier: MIT OR Apache-2.0

Expand All @@ -16,5 +17,7 @@ fn main() {
.qt_module("Network")
.qt_module("Quick")
.file("src/inspector.rs")
.qobject_header("include/helper.h")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need to use ccp_file now that 0.8 is out :) (needs rebasing/merging of main)

.build();
println!("cargo:rerun-if-changed=include/helper.h");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed, cpp_file will do this automatically :)

}
25 changes: 25 additions & 0 deletions examples/span-inspector/include/helper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// clang-format off
// SPDX-FileCopyrightText: 2025 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
// clang-format on
// SPDX-FileContributor: Quentin Weber <quentin.weber@kdab.com>
//
// SPDX-License-Identifier: MIT OR Apache-2.0

#pragma once
#include <QSyntaxHighlighter>

class QSyntaxHighlighterCXX : public QSyntaxHighlighter
{
Q_OBJECT
public:
explicit QSyntaxHighlighterCXX(QTextDocument* doc)
: QSyntaxHighlighter(doc)
{
}

protected:
std::unique_ptr<QTextBlock> currentBlockCXX()
{
return std::unique_ptr<QTextBlock>(new QTextBlock(currentBlock()));
}
};
9 changes: 3 additions & 6 deletions examples/span-inspector/qml/main.qml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// SPDX-FileCopyrightText: 2025 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
// SPDX-FileContributor: Leon Matthes <leon.matthes@kdab.com>
// SPDX-FileContributor: Quentin Weber <quentin.weber@kdab.com>
//
// SPDX-License-Identifier: MIT OR Apache-2.0

Expand All @@ -25,13 +26,9 @@ ApplicationWindow {

SplitView {
anchors.fill: parent
Item {
ScrollView {
SplitView.preferredWidth: parent.width / 2
TextArea {
id: inputEdit
SplitView.preferredWidth: parent.width / 2
wrapMode: TextArea.Wrap
anchors.fill: parent
clip: true
color: appWindow.textColor
Component.onCompleted: {
Expand All @@ -40,7 +37,7 @@ ApplicationWindow {
}

onCursorPositionChanged: {
inspector.rebuildOutput(cursorPosition);
inspector.updateCursor(cursorPosition);
}

onTextChanged: {
Expand Down
Loading
Loading