Tobias Hunger
378280e0a7
lsp: Ignore the "Window" when selecting in preview
...
The compiler automatically adds a Window on top of the actual root
element when that isn't a Window already. When selecting the added
window element would get ignored and the "real" root element would get
selected as its only child. That causes the cursor to jump to the end of
the document.
So skip auto-added Windows when selecting, starting with the "real" root
element.
2023-12-20 19:28:35 +01:00
Tobias Hunger
9436a23546
lsp: Reset selection on preview update
2023-12-20 19:28:35 +01:00
Tobias Hunger
9e5806cfe8
lsp: Use lsp_types::Range over lots of usize
2023-12-20 19:28:35 +01:00
Tobias Hunger
ca1263c3e5
lsp: Handle selections and highlighting in the LSP
...
Ask the interpreter for all the necessary information, but handle the
look and feel in the LSP preview UI.
2023-12-20 19:28:35 +01:00
Tobias Hunger
c9414d98fa
lsp: Add element tree printing functionality (unused!)
2023-12-20 19:28:35 +01:00
Olivier Goffart
7b3d96368b
LSP: Fix error when going to the definition of builtin items
...
Instead of returning an "invalid:/" URL for the builtins, we should just
return a None result from the goto definition function.
Also add a test for goto_definition
Fixes #4126
2023-12-19 16:16:19 +01:00
Tobias Hunger
d785f2d5df
compiler: Store an optional version number with the document
...
A None value means the file on disk is the golden version.
We have an editor, the LSP and the preview that all need to at least
notice when they have newer data then their peers. So IMHO it makes
sense to have an optional document version around.
The language server protocol makes use of a version number already. This
patch moves that code into the compiler so that it is stored with the
actual data getting versioned.
2023-12-18 14:21:50 +01:00
Olivier Goffart
5d4c390b0f
Compiler: Error when assigning to compile time properties
...
Some property need to be known at compile time. We already had checks
that the binding is a compile time constant, but there was no check to
prevent, say
self.row = 42;
which wouldn't work or could even cause panic or miscompilation of
generated code
Closes #4037
2023-12-12 21:51:56 +01:00
Simon Hausmann
c1841fdfbe
Add support for compiling the linuxkms backend without libseat support
2023-12-11 17:36:17 +01:00
ogoffart
b081c489d6
Bump version number to 1.4.0
2023-12-11 11:21:37 +00:00
Tobias Hunger
b12c35d877
LSP: Improve automatic insertion of import identifiers on completion
...
Insert before the last whitespace. Adding Bar into `import { Foo } from
"..."` looks like this:
```slint
import { Foo , Bar} from "..." // old
import { Foo, Bar } from "..." // new
` ``
2023-12-11 08:29:42 +01:00
Olivier Goffart
09de1dc5b5
LSP: Also close the popup on wasm
...
Move the code to close the popup in the function that is common with native and wasm.
Amend af34e4f182
2023-12-01 09:58:51 +01:00
ogoffart
b9255ab8e2
Bump version number to 1.3.2
2023-12-01 08:05:15 +00:00
Olivier Goffart
af34e4f182
LSP preview: close the popup menu before loading a new preview
...
Otherwise we get outdated popup menu, or worse: panics
Fix #4035
(Note that before we had the preview_ui, we were calling
WindowInner::set_component which do close_popup as well)
2023-11-30 11:21:16 +01:00
Tobias Hunger
547ba6d998
lsp: Make previewed component resizable
2023-11-28 10:38:46 +01:00
Olivier Goffart
065ee38373
LSP: default style to native
2023-11-24 14:08:06 +01:00
Olivier Goffart
184cb5f580
LSP: Simplify the preview config handling
...
- Put the config in a struct so its easier to pass around
- respect the command line args as default for the style
- fix compilation without the preview feature
2023-11-24 14:08:06 +01:00
Olivier Goffart
26e8d308b7
LSP: rename and fix the hide toolbar option
...
- rename the command line option to --no-toolbar
- Make it default to not hide the toolbar (so it is visible by default)
2023-11-24 14:08:06 +01:00
Tobias Hunger
01f6771693
lsp: Rename show_preview_ui argument to show_preview_toolbar
2023-11-23 20:44:06 +01:00
Tobias Hunger
fd36b17481
LSP: Switch preview-ui even when no preview is loaded
2023-11-23 20:44:06 +01:00
Tobias Hunger
e9f5964c45
lsp: Pass Cli arguments around
2023-11-23 20:44:06 +01:00
Tobias Hunger
548f10be2b
lsp: Add option to show/hide preview ui
...
... and use that option in VSCode configuration.
2023-11-23 20:44:06 +01:00
ogoffart
0a5bf6c37b
Bump version number to 1.3.1
2023-11-23 07:47:07 +00:00
Olivier Goffart
77e5c40ce2
LSP: don't expose symbols with empty names
...
Empty symbol names causes error in vscode
Fix #3979
Also fix the ranges of enums
2023-11-22 11:59:36 +01:00
Olivier Goffart
326d0b6414
LSP Preview: add a --fullscreen command arg
...
Useful to preview on devices
2023-11-10 15:43:02 +01:00
Tobias Hunger
d758735241
janitor: clippy and typo fixes in the LSP
2023-11-08 18:39:52 +01:00
Olivier Goffart
73a6ec910b
LSP: hold the recursion guard in process_preview_to_lsp_message
...
This is the only non-trivial wasm_bindgen function that doesn't have it
This would cause borrow mut panic as we re-enter while waiting on files
2023-11-08 18:32:26 +01:00
Tobias Hunger
0774d01a59
lsp: Send contents to preview for implicitly loaded slint files
...
This fixes the no preview in slintpad issue when retrieving the contents
of files is slow (e.g. when loaded from the web).
Fixes : #3855
2023-11-08 17:50:18 +01:00
Olivier Goffart
aeb512686e
LSP preview: small UI adjustments
...
- Add a title and icon to the window
- remove dead code (Spinner)
- Make the text of error align to the left and word-wrap
- With a pointer mouse cursor so the user knows they are clickable
2023-11-08 16:23:49 +01:00
Olivier Goffart
18a244bb62
LSP preview: make sure that we always update the preview with the latest state
...
If a preview command is issued while we were compiling, we need to
recompile.
2023-11-08 16:22:56 +01:00
Tobias Hunger
6206504dca
lsp: Do not use a spinner and show errors
...
... as the UI thread is blocked. Print a status text instead.
Also show errors (if any).
Fixes : #3858
2023-11-07 10:57:54 +01:00
Tobias Hunger
517d8cb58d
slintpad/vscode: Reduce interactions with canvas
...
Remove the outline and the touch action via styling.
2023-11-07 10:57:54 +01:00
Simon Hausmann
e248093236
Fix missing import in SlintPad hello World
...
Amends 49feb994bc
2023-11-06 16:17:42 +01:00
Simon Hausmann
49feb994bc
Fix hello world in slintpad with dark mode
...
Use AboutSlint, as that adapts to the theme. Discussed in coffee break :-)
Fixes #3853
2023-11-06 14:34:35 +01:00
Tobias Hunger
fa7fe55faf
lsp: Update UI for release
...
Disable the "Design Mode" button for now as selectionis not great and
add a label before the Style ComboBox.
2023-11-06 13:15:34 +01:00
Olivier Goffart
a4a1a4754e
Slintpad: fix "property" tab position
2023-11-06 10:52:03 +01:00
Tobias Hunger
ca36c1b7d5
lsp: Add native style into preview and default to it
2023-11-03 22:14:20 +01:00
Tobias Hunger
a19cfd06b2
lsp: Make preview the authorative source for style usage
2023-11-03 22:14:20 +01:00
Tobias Hunger
7c38e08347
lsp: Do not panic when showing a document to the user
2023-11-03 22:14:20 +01:00
Tobias Hunger
5bf5b7b02d
lsp: Clean up PreviewApi
...
request_state went the wrong way around wrt. communication flow, so
remove and deduplicate it.
2023-11-03 22:14:20 +01:00
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