Commit graph

111 commits

Author SHA1 Message Date
Olivier Goffart
489e0b8729 Live-preview: Outline 2025-08-01 18:25:40 +02:00
Tobias Hunger
c3d4d5e0e2 live-preview: Pop up error in editor when live preview crashes
Some checks are pending
CI / node_test (ubuntu-22.04) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, beta) (push) Blocked by required conditions
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, stable) (push) Blocked by required conditions
CI / build_and_test (ubuntu-22.04, nightly) (push) Blocked by required conditions
CI / node_test (macos-14) (push) Blocked by required conditions
CI / node_test (windows-2022) (push) Blocked by required conditions
CI / python_test (macos-14) (push) Blocked by required conditions
CI / cpp_test_driver (windows-2022) (push) Blocked by required conditions
CI / python_test (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_test_driver (macos-13) (push) Blocked by required conditions
CI / cpp_test_driver (ubuntu-22.04) (push) Blocked by required conditions
CI / cpp_cmake (ubuntu-22.04, stable) (push) Blocked by required conditions
CI / cpp_cmake (windows-2022, nightly) (push) Blocked by required conditions
CI / mcu-embassy (push) Blocked by required conditions
CI / ffi_32bit_build (push) Blocked by required conditions
CI / fmt_test (push) Blocked by required conditions
CI / esp-idf-quick (push) Blocked by required conditions
CI / android (push) Blocked by required conditions
CI / miri (push) Blocked by required conditions
CI / cpp_cmake (macos-14, 1.85) (push) Blocked by required conditions
CI / cpp_package_test (push) Blocked by required conditions
CI / vsce_build_test (push) Blocked by required conditions
CI / mcu (pico2-st7789, thumbv8m.main-none-eabihf) (push) Blocked by required conditions
CI / mcu (stm32h735g, thumbv7em-none-eabihf) (push) Blocked by required conditions
CI / docs (push) Blocked by required conditions
CI / wasm (push) Blocked by required conditions
CI / wasm_demo (push) Blocked by required conditions
CI / tree-sitter (push) Blocked by required conditions
CI / updater_test (0.3.0) (push) Blocked by required conditions
CI / test-figma-inspector (push) Blocked by required conditions
Technically it pops up a message if the live preview does not end in
a success, even though the message says "crashed"... I think that is
fine: We also want reports on the live preview going into an error mode.
2025-07-29 17:30:43 +02:00
Tobias Hunger
bf66b8694d live-preview: Simplify style handling
Simplify style selection, now that we are "always up": All we need to do
is change the style when the configuration changes. That is a part
of the initial state request we send when the preview starts up, so we set
the style properly and then we do not need to do anything anymore till
somebody configures a new style.
2025-07-28 17:13:15 +02:00
Tobias Hunger
5dc9ce5204 LSP: Start external process for live preview
Start the live preview in a separate process. This simplifies
a couple of things:

* Starting the UI
* UI state handling
* Threading setup
* "Quitting" the preview on Mac

... and many more :-)
2025-07-28 17:13:15 +02:00
Tobias Hunger
ed9056de1f lsp: Extract the fuzzy matching code into common
... so it is easier to reuse
2025-06-06 18:45:20 +02:00
Tobias Hunger
bd0ba0cd44 lsp: Move poll_once into common
.. to clean up `preview.rs` a bit.

The functionality is generic and could be used in both LSP
and preview, so common with the other helper code seems
appropriate.
2025-05-22 14:03:52 +02:00
Tobias Hunger
24e24df737 live-preview: Send telemetry to VSCode
Send telemetry data from the live-preview to vscode.

It will process that data according to telemetry settings in VScode
2025-05-09 19:18:27 +02:00
Tobias Hunger
a7b6d3a13b lsp: Update ElementRcNode to return the full debug info 2025-04-01 16:10:10 +02:00
Tobias Hunger
a2701927ba lsp: Fix comparision of ElementRcNodes
This should address a panic in drop_location, where we do
not find ourselves in our parent.
2025-02-17 18:29:48 +01:00
Tobias Hunger
33928e4958 lsp: Do not send status nmessages
Nigel says those are annoying as they tend to overstay
their welcome.
2025-02-11 11:29:01 +01:00
Yuri Astrakhan
bcb2953f00 Auto-fixed clippy::unnecessary_map_or
This is a hacky approach, but does help a lot with the tedious fixes.

See https://rust-lang.github.io/rust-clippy/master/index.html#/unnecessary_map_or

```
__CARGO_FIX_YOLO=1 cargo clippy --fix  --all-targets --workspace --exclude gstreamer-player --exclude i-slint-backend-linuxkms --exclude uefi-demo --exclude ffmpeg -- -A clippy::all -W clippy::unnecessary_map_or

cargo fmt --all
```
2025-02-07 09:02:31 +01:00
Yuri Astrakhan
61de4d56b0 Fix all format arg inlining
Ran this command:

```shell
cargo clippy --fix -- -A clippy::all -W clippy::uninlined_format_args
```
2025-02-06 10:16:20 +01:00
Tobias Hunger
0a648dfa41 lsp: Move token_info.rs from language to common 2025-01-17 10:27:12 +01:00
Tobias Hunger
b7e1fb9d18
lsp: Offer to populate empty documents (#4767) 2024-12-11 19:33:24 +01:00
Tobias Hunger
b0fe8d6cfb live-preview: Handle document deletion better 2024-11-27 18:04:54 +01:00
Tobias Hunger
51d8205e08 live-preview: Use another seelction color for interactive building blocks
... like TouchArea and such. This might help a bit with what
you are actually selecting.
2024-11-14 14:07:37 +01:00
Tobias Hunger
3d3bf9f01b lsp: Pass invalidation of files on to live-preview 2024-10-10 09:31:11 +02:00
Tobias Hunger
2c9e79613e lsp: Ignore optimized out elements when looking for parent
Ignore elements that were optimized out when looking for a
`ElementRcNode`s parent.
2024-09-27 15:23:13 +02:00
Tobias Hunger
41bdadd960 live-preview: Add a CodeButton component
... and use it in places
2024-09-17 18:39:37 +02:00
Olivier Goffart
10e7c83020 live-preview: don't set x and y When dropping an element
This means that, when the parent is not a layout, the widgets are
always dropped in the middle of the parent, and then one can place
place it to the right position.

In particular, for widget that expaneds to the size of their parent by
default, this does the right thing

Fixes #6098
2024-09-13 10:06:40 +02:00
Tobias Hunger
cab41c3d0c lsp: Use more TextSize
I got carried away, I replaced `u32` with `TextSize` in one place
because that's what I got and I did not want to convert... and
then I fixed the fallout.

No functional change is intended in any of this.

FIXUP
2024-09-10 13:31:52 +02:00
Tobias Hunger
1c447db8ca lsp: Build without SourceFileInner::version()
... in preparation to removing that functionality.
2024-08-21 16:55:13 +02:00
Tobias Hunger
74338fcee5 lsp: Move DocumentCache into extra file
It gets too big :-)
2024-08-21 16:55:13 +02:00
Tobias Hunger
cc9d9af7a7 lsp: Use a LSP-specific SourceFileVersion 2024-08-21 16:55:13 +02:00
Tobias Hunger
c8952cc20f live-preview: Report document version number with diagnostics
... in the hope that VSCode will invalidate the diagnostics when they
apply to outdated versions:-)
2024-08-21 16:55:13 +02:00
Tobias Hunger
013c687296 lsp: Replace common::UrlVersion with SourceFileVersion
The compiler defines `SourceFileVersion`, let's use that consistently.
2024-08-14 10:49:37 +02:00
Tobias Hunger
8c8719e79d live-preview: Simplify code setting properties
Now that the properties are only used in the live preview,
we can simplify the code a bit.

This gets rid of some sanity checks in the code path as well,
which in turn should fix #5696.

Fixes: #5696
2024-08-09 10:44:44 +02:00
Tobias Hunger
4e68aa1510 lsp: Remove custom commands for property handling
These commands are not needed anymore since we integrated
the property editor into the live preview.

Move the properties code out of `common` and into `preview`
for good measure.
2024-08-08 16:39:37 +02:00
Olivier Goffart
21e67e27a7 LSP: Report error through the LSP when the preview can't open
Instead of panicking the whole server

Issue #204
2024-08-08 12:05:52 +02:00
Olivier Goffart
4c0bfa269d LSP: refactor send_notification to use the Notification trait
This ensure there is no typo in the method name
2024-07-23 14:18:39 +02:00
Tobias Hunger
63e0a9cc2a live-preview: Allow for dropping library components 2024-07-19 12:25:10 +02:00
Tobias Hunger
7bbe2a949a live-preview: Recognize GridLayouts as layouts and find layouts in components
... when deciding whether or not we are dropping into a layout or not.
Components that take @children (like a GroupBox) were misrecognized before.

This is a bit tricky as the optimized Elements do not allow to find out whether
something had a child insertion point. So I need to convert over to the
unoptimized Element found in my `document_cache`.

Unfortunately there the lowering pass for the layouts has not been done yet,
so my "normal" approach to figuring out whether something is a layout or not
does not work anymore:-/

I ended up duplicating the logic of the layout lowering step: Match specific
type names for Builtin types. That's not nice and should be cleaned up at
some point.
2024-07-19 11:48:28 +02:00
Tobias Hunger
edea933b91 live-preview: Do not focus VSCode all the time
This makes is more convenient to work with the UI to me.
2024-07-12 15:46:06 +02:00
Olivier Goffart
5dfa8d56dc API review of the slint interpreter Compiler api
Closes #5466
2024-07-05 17:20:08 +02:00
Tobias Hunger
74a8779e9c live-preview: Add a property editor 2024-06-28 10:58:45 +02:00
Tobias Hunger
bc35d49328 lsp: Remove UpdateElement Preview-to-LS-message
We can do that inside the Live preview now and just return the
WorkspaceEdit.
2024-06-25 19:51:59 +02:00
Tobias Hunger
9afb3812bf lsp: Move properties.rs into common 2024-06-25 19:51:59 +02:00
Tobias Hunger
3e117c1910 lsp: Modernize properties.rs
... to prepare moving it into common.
2024-06-25 19:51:59 +02:00
Tobias Hunger
127535b0e1 live-preview: Keep a stack of components previewed
... and add back/forward buttons to navigate between them.
2024-06-24 14:10:16 +02:00
Tobias Hunger
1b3765e53c lsp: Move node ignore code into the common section
... it is conceptually meant to be used by the language server and the
live-preview.
2024-06-21 14:40:50 +02:00
Olivier Goffart
408637a677 Remove the is_root_component within the component
There will be serveral roots, so this makes no sense.
2024-06-21 11:58:09 +02:00
Tobias Hunger
8d9ea63284 live-preview: Keep a document cache handy 2024-06-14 16:59:39 +02:00
Tobias Hunger
f358454638 janitor: live-preview: Save a few copies of vecs
... does not make things noticably faster though.
2024-06-14 16:59:39 +02:00
Tobias Hunger
67200c81ff live-preview: Compile-test element moves in can_move function
Compile test the result of an element move in the `can_move` function
to catch all cases where the move would be problematic.

Shuffle some test code around to allow for testing this new
functionality.
2024-06-14 16:59:39 +02:00
Tobias Hunger
c55f0a9b0e compiler: Add a snapshotter to help create snapshots of compiler state
Use this snapshot to keep a unoptimized typeloader around, so that the preview
does not need to do another parsing run.

Move the document cache in the preview over to use the snapshot.
2024-06-12 10:15:29 +02:00
Tobias Hunger
d657ee65af live-preview: Handle known components using our local DocumentCache 2024-06-12 10:15:29 +02:00
Tobias Hunger
6c034372a1 lsp: Encapsulate DocumentCache better
The Document cache is a specialized typeloader now, make it provide the
necessary APIs directly, so that we can be sure nobody will do anything
that breaks the data:-)
2024-06-12 10:15:29 +02:00
Tobias Hunger
fccb4de8a0 lsp: Move PreviewConfig out of DocumentCache 2024-06-12 10:15:29 +02:00
Tobias Hunger
a759fa72d2 lsp: Move DocumentCache into common 2024-06-12 10:15:29 +02:00
Olivier Goffart
8add2e4ebd element_ids: Can't return a SharedString by value from the vtable
also compile the LSP
2024-06-05 01:29:58 -07:00