Commit graph

1029 commits

Author SHA1 Message Date
Tobias Hunger
fbb6d70ff9 lsp: Improve design mode handling
* Make sure design mode stays enabled when refreshing the preview. This
  stops the strange click-throughs from happening
* Keep highlighting enabled while in Design Mode
2023-11-03 22:14:20 +01:00
Tobias Hunger
d1a26fe425 lsp: Default to native style is available and nothing else is set 2023-11-03 22:14:20 +01:00
Tobias Hunger
8886d858d3 lsp: Rename StartedLoop 2023-11-03 22:14:20 +01:00
Tobias Hunger
703cc4c10f slintpad: Open preview on project change automatically 2023-11-03 22:14:20 +01:00
Tobias Hunger
8981a215ea slintpad: Do not fail to re-open a project
We do not need the modelRef dance: We use one editor that is properly
configured already.
2023-11-03 22:14:20 +01:00
Tobias Hunger
a0a4414b6b lsp: Remember that to preview in WASM mode 2023-11-03 22:14:20 +01:00
Tobias Hunger
737d09f4dd lsp: Make conversion of diagnostics more robust
... especially when in WASM.
2023-11-03 22:14:20 +01:00
Tobias Hunger
b17d566349 lsp: Derive more Debug implementations 2023-11-03 22:14:20 +01:00
Tobias Hunger
6262bd19ca vscode: Use configured style as default when opening preview UI
Ignore any later changes (till we open a the UI again), the Preview UI
style selector handles that.
2023-11-03 22:14:20 +01:00
Tobias Hunger
9093f74bef LSP: Remove compiler env var line from build.rs 2023-11-03 22:14:20 +01:00
Tobias Hunger
c3cabc8751 lsp: Build preview UI with Design Mode text and default style 2023-11-03 22:14:20 +01:00
Tobias Hunger
4246168b2a Add style combobox to preview UI
... and remove code supporting style selection from slintpad and vscode.
2023-11-03 22:14:20 +01:00
Tobias Hunger
e5bfddf73f lsp: Improve preview UI
A big thank you to @FloVanGH !
2023-11-03 22:14:20 +01:00
Tobias Hunger
cf9bbe8171 slintpad: Update dependencies
This unbreaks the typical "the lngauge server uses a different version
of vscode-jsonrpc than the languageclient", which leads to the typical
"byName" messages in the console...

Try to be strict with the versioning: We need the *exact* versions of
everything as even patch-level changes do lead to breakage: The monaco
and vscode packages are *very* tightly coupled.
2023-11-03 22:14:20 +01:00
Tobias Hunger
ada7d6179d slintpad: Remove service worker again
Now that the compiler does the resource URL mapping, we do not urgently
need the service worker anymore.

Closes: #2905
2023-11-03 22:14:20 +01:00
Tobias Hunger
d53cebd3e1 lsp: Get signalled by the preview 2023-11-03 22:14:20 +01:00
Tobias Hunger
4310969b2a wasm preview ui: Implement highlight from editor 2023-11-03 22:14:20 +01:00
Tobias Hunger
7d4a73b76c lsp: Make wasm and native previews work
Move code from the native side up into preview.rs as much as possible so
that both previews share as much code as possible.
2023-11-03 22:14:20 +01:00
Tobias Hunger
ec1698123f lsp: Extract the ServerNotifier from the previewer's ContentCache
That way I can reuse the rest of the ContentCache more easily.
2023-11-03 22:14:20 +01:00
Tobias Hunger
adb11e9866 lsp: Extract state reporting back to the LSP from native preview
Extract the code that reports back state to the LSP into stand-alone
functions for the native Preview implementation.
2023-11-03 22:14:20 +01:00
Tobias Hunger
2aac47b3c6 Change communication of slintpad with Preview
... to route it through the LSP, so that we can have a unified approach
to interact with the Preview UI.
2023-11-03 22:14:20 +01:00
Tobias Hunger
55cc1ae31f lsp: Remove the PostLoadBehavior
We always update if we have a UI and we never update if not. So this
flag does not help.
2023-11-03 22:14:20 +01:00
Tobias Hunger
df86bf67af lsp: Handle preview window getting closed in native LSP 2023-11-03 22:14:20 +01:00
Tobias Hunger
a0cc85bfb4 LSP: Remove design mode custom commands 2023-11-03 22:14:20 +01:00
Tobias Hunger
97f3046dbd LSP: Simplify the handling of ServerNotifier in the Previewer
The Preview delays starting the event loop as much as possible, simply
because our backends may panic/crash when they are not happy with the
UI configuration state they get started in.

So keep this... but use the `sender` in the Cache as an indicator of "we
have a UI". So explicitly set/reset the sender as the UI comes and goes
and do less implicit setup otherwise.
2023-11-03 22:14:20 +01:00
Tobias Hunger
55d0f5d473 lsp: Make native UI work
The UI is ugly and does not include the Design Mode button yet, but it
is a bit of progress.
2023-11-03 22:14:20 +01:00
Ken Carpenter
b20536131f
Add more easing formulas (#3812)
Closes #2655
2023-11-03 09:20:44 +01:00
Simon Hausmann
24fecd247c Fix inactive accessiblity support in slint-viewer
slint-viewer should enable accessiblity by default.
2023-11-01 17:21:50 +01:00
Olivier Goffart
4b37d9a1f1 Fix Slintpad preview in release
This should have been part of b2645dff6c
2023-10-31 16:44:34 +01:00
Olivier Goffart
b2645dff6c Wasm: use the winit spawn() api to run the event loop for the interpreter
This seems to solve the bug that the wasm interpreter (or slintpad) is
not working when compiled in release since the winit0.29 update
2023-10-30 14:17:10 +01:00
Olivier Goffart
85ca10d32e Disallow access to internal globals (NativeStyleMetrics and SlintInternal)
It only stay accessible in our builtin styles

Fixes #3793
2023-10-28 16:07:38 +02:00
Olivier Goffart
c2809cde12 wasm: Don't include all image codecs on the lsp
Saves 1M in the binary

We use the browser to render the images anyway

Note: i-slint-core still bring image with png and jpeg codecs, as well
as svg deps. We just need the image-decoders feature to load the builtin
images, of these there are only svg.
2023-10-27 10:08:42 +02:00
Olivier Goffart
560cc02d65 janitor: remove reference to non-existing feature
console_error_panic_hook is not an optional dependency in that crate, so
the #[feature] check didn't work.
2023-10-25 16:09:50 +02:00
J-P Nurmi
0d366e0087 LSP: add "Repeat element" and "Make conditional" code actions 2023-10-23 15:58:24 +02:00
J-P Nurmi
b8c3bbef74 LSP: don't insert extra braces for "Wrap in element" auto-completions 2023-10-21 07:35:32 +02:00
J-P Nurmi
c5248c005e Allow specifying paths for @library imports 2023-10-20 16:47:00 +02:00
Tobias Hunger
df544fe1c9 interpreter: Introduce internal feature
... and use it to hide internal functionality so users will notice that
they depend on fucntionality we do not provide any guarantees for.

Make the lsp and viewer request the internal feature when building the
interpreter.
2023-10-20 15:34:49 +02:00
Olivier Goffart
3ab98a7596 LSP: harmonize spaces when auto-completing element name
Fixes #3714
2023-10-20 14:35:59 +02:00
Tobias Hunger
23a9f5aeb8 LSP: Fix race condition
In rare cases I was getting a response before the request that the LSP
sent out way registered in the event queue. Insert the request earlier.
2023-10-19 20:55:09 +02:00
Olivier Goffart
5513e470d5 Fix LSP not quiting when it shows a preview
The "LanguageServer" thread (New name also given in that commit) is
blocked while waiting for the io threads because the preview keeps a
ServerNotifier in its content cache.
We first need to tell the preview to quit before waiting on these
threads.
2023-10-17 11:09:53 +02:00
Tobias Hunger
caee0b2f9d janitor: Fix a semi-random selection of clippy warnings
Nothing serious in there.
2023-10-16 13:44:37 +02:00
Tobias Hunger
b12575a4c4 janitor: Go over our spell checking setup
* Extend the cspell word list
* Remove those extensions from individual source files
* white-list licenses and such as we should not meddle with those
* Fix spelling
2023-10-16 09:01:51 +02:00
Tobias Hunger
136ded634a slintpad: Remove now unused service_worker code 2023-10-13 13:59:14 +02:00
J-P Nurmi
49c8d94f92 Janitor: add itertools as a workspace dependency 2023-10-13 13:40:27 +02:00
Tobias Hunger
283ef4b461 compiler: Implement resource URL remapping
This is used in slintpad to map relative image URLs to their real
download locations.

This has the side-effect of removing the service worker.

Fixes: #2905
2023-10-12 21:41:26 +02:00
J-P Nurmi
400404623d LSP: fix typo in "slint.includePaths" config 2023-10-12 11:10:14 +02:00
Olivier Goffart
8f51d409ec Slintpad: fix spinner being a png instead of a svg 2023-10-11 14:10:33 +02:00
Tobias Hunger
fe0f269f4a slintpad: Update README
* Update build instructions
 * Document the style parameter for URLs
2023-10-11 12:58:53 +02:00
Olivier Goffart
366187fc62 Fix slintpad startup logo
The symlink was dead
2023-10-11 11:29:34 +02:00
Tobias Hunger
0ff8e2cdb6 compiler: Rework path handling
Add some code to do platform-independent path processing.

This is necessary aas WASM does e.g. not have any absolute paths and
such and the compiler tended to produce wrong results in that case.

Side-effect: We no longer need to depend on `dunce`
2023-10-10 20:04:47 +02:00