Commit graph

757 commits

Author SHA1 Message Date
Olivier Goffart
5dfa8d56dc API review of the slint interpreter Compiler api
Closes #5466
2024-07-05 17:20:08 +02:00
Olivier Goffart
f93729ffe2 Port LSP to slint_interpreter::Compiler
Add a feature to only generate a specified component.
2024-07-03 11:51:23 +02:00
Tobias Hunger
5663aa0cfd live-preview: Navigate to property
Clicking on an existing property in the PropertyEditor will ask
the editor to navigate to the right place.
2024-06-28 18:55:32 +02:00
Tobias Hunger
c9c293e3bd live-preview: Show properties of previewed element
... if no other element is selected.
2024-06-28 18:53:02 +02:00
Tobias Hunger
74a8779e9c live-preview: Add a property editor 2024-06-28 10:58:45 +02:00
Olivier Goffart
dc5a8ac0e5 fmt: Format changed callback 2024-06-28 10:45:45 +02:00
Olivier Goffart
36ccc9d658 Changed callback syntax coloration 2024-06-28 10:45:45 +02:00
Tobias Hunger
5c10e0972c janitor: Cleanup a bit
* Make some members pub so I can use them later
* Clean up some namespaces
2024-06-27 13:11:55 +02:00
Tobias Hunger
4decde2632 live-preview: Split out tool components from component-list
... so I can reuse them in a to-be-defined PropertyEditor component.
2024-06-27 13:11:42 +02:00
Tobias Hunger
2ffed918ab lsp: Include id in Element range in the Properties data
That is the more natural position to show in the UI.
2024-06-26 17:19:27 +02:00
Tobias Hunger
80bab3c04d live-preview: Pretty up the Api file
No code change, just rearrange lines and some more comments.
2024-06-26 17:19:07 +02:00
Tobias Hunger
bd32c2f143 live-preview: Use a global Api object in the UI
... to avoid going throught the root node with everything.
2024-06-26 15:14:14 +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
3d52486acb live-preview: Use production code in test
... over implementing the same fucntionality again for the tests.
2024-06-25 10:56:11 +02:00
Tobias Hunger
c335ac9202 janitor: Allow "clippy::await_holding_refcell_ref" in tools/lsp
There is no way we can avoid that RefCell being held, so quieten
the wrrning.
2024-06-24 14:59:47 +02:00
Tobias Hunger
caacd487ac live-preview: Make the component list a bit prettier 2024-06-24 14:10:16 +02:00
Tobias Hunger
a810fc1df3 live-preview: Move renaming of component fucntionality into the ComponentLabel
... remobving the functionality fronm the ComponentList again.
2024-06-24 14:10:16 +02:00
Tobias Hunger
d0d0327049 live-preview: Only pass information on the component previewed once 2024-06-24 14:10:16 +02:00
Tobias Hunger
229fdb73ec live-preview: Show the newly added component as preview 2024-06-24 14:10:16 +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
1b88f70086 live-preview: Add a "show preview" button into the component list
... It is *UGLY*, really *UGLY*. But it works ;-)
2024-06-24 14:10:16 +02:00
Tobias Hunger
35b61fa852 live-preview: Show a label of the component currently visible
* Make the location a click-target that asks the editor to navigate to that
  component
2024-06-24 14:10:16 +02:00
Tobias Hunger
37d6922983 live_preview: Wire up component renaming 2024-06-21 14:40:50 +02:00
Tobias Hunger
1cc63ea428 lsp: Borrow new_name in rename_component 2024-06-21 14:40:50 +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
9e8e0ce307 lsp: Allow for local globals when collecting all components 2024-06-19 17:52:16 +02:00
Tobias Hunger
58148b4ca7 live-preview: Add test for component renaming with relative paths
.. and fix the code to handle them.
2024-06-19 17:11:24 +02:00
Tobias Hunger
b881d24367 janitor: Fix spelling 2024-06-19 17:01:19 +02:00
Tobias Hunger
1f0262c7a7 Update tools/lsp/preview/drop_location.rs
Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>
2024-06-19 11:45:37 +02:00
Tobias Hunger
15ac565737 live_preview: Show file local components in Library 2024-06-19 11:45:37 +02:00
Tobias Hunger
49d4fc5d0f live-preview: Handle add_new_component 2024-06-19 11:45:37 +02:00
Tobias Hunger
97daf41245 live-preview: Add a button to add a new component with
... and make it trigger a function in preview.rs.
2024-06-19 11:45:37 +02:00
Tobias Hunger
eb60c26398 live-preview: Filter out artifical component the live preview adds
... that implementation detail should not leak to the users.
2024-06-17 17:39:35 +02:00
Tobias Hunger
20c6393ca3 janitor: CLippy fixes 2024-06-14 16:59:39 +02:00
Tobias Hunger
03f1e10b06 live-preview: Cache compilation results while moving elements around 2024-06-14 16:59:39 +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
f55ef8fa08 compiler: Add current document into snapshot
It went missing before as it gets added to the `TypeLoader` that gets
snapshot only after the function we snapshot in...
2024-06-14 16:59:39 +02:00
Tobias Hunger
46c3bd19b7
live-preview: Remove some dead code
... that only nightly used to find... but now that is stable and breaks CI.

I did not remove it directly as I thought I'd need it again, but I am reasonably
sure now that I will not, so get rid of it.
2024-06-14 12:07:50 +02:00
Tobias Hunger
700bf0dd12 live-preview: Extract code to generate workspace edit for moves 2024-06-12 16:10:25 +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
64d2b6117b live-preview: Use a document cache in the preview as well
It has so much better information and we do not want to go back to the LSP
side to get that!
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