Commit graph

819 commits

Author SHA1 Message Date
Tobias Hunger
423a3b2619 vscode: Add removal of properties 2022-12-09 17:38:04 +01:00
Tobias Hunger
6b143644d8 online editor: Add remove button to properties editor 2022-12-09 17:38:04 +01:00
Tobias Hunger
524e6ed2cf tools: Extract some small helper funtion into shared/utils 2022-12-09 11:19:48 +01:00
Simon Hausmann
b38fe7c5f0 Clean up internal Exports struct
- Use deref instead of `.0` tuple access (looks neater)
- Provide a convenience find() function that also makes use of the sorting
2022-12-09 11:05:08 +01:00
Simon Hausmann
03fe599890 Add support for re-exporting modules
Use `export * from "somewhere.slint"` to avoid having to repeat all the
types of an existing module in order to re-export all of the types.
2022-12-09 11:05:08 +01:00
Olivier Goffart
c05e63f9da Auto-completion of the new property keywords and functions 2022-12-08 10:14:54 +01:00
Olivier Goffart
c2895a44af Update syntax highlight for Functions and in-out things 2022-12-08 10:14:54 +01:00
Tobias Hunger
8fe09ca17a lsp: Fix LSP blocking when run from VSCode
GDB claims ther lsp is blocked on the mutex on stdout. So remove the
println! statement that caused this -- it should not be there in the
first place!
2022-12-07 16:42:33 +01:00
Olivier Goffart
dfdbc942f6 Split Expression::CallbackReference and Expresison::FunctionReference 2022-12-06 14:56:25 +01:00
Olivier Goffart
851a910e41 Parser: Parse functions 2022-12-06 14:56:25 +01:00
Tobias Hunger
71199fbb16 online editor: Have LSP trigger updates in the Properties View
We still get some updates from the editor that we do not really need
anymore, but we also get updtaes from the LSP now.

This fixes e.g. the property value being out of sync right after you
changed it in the property editor.
2022-12-05 15:13:14 +01:00
Tobias Hunger
9cd6c60000 lsp: simplify registration on LSP with properties_widget 2022-12-05 15:13:14 +01:00
Tobias Hunger
6d3506d2d4 online editor: Make the language client handle progress reports 2022-12-05 15:13:14 +01:00
Tobias Hunger
ea24548ee2 lsp: Report progress on file load in WASM, too 2022-12-05 15:13:14 +01:00
Tobias Hunger
59380e8a25 lsp: Improve ProgressReporter API
Make finish() consume self.
2022-12-05 15:13:14 +01:00
Tobias Hunger
2c472a34ab lsp: Reset token on call to finish in ProgressReporter
We would send the end token twice otherwise as the Drop trait will send
an end report if none was sent before.
2022-12-05 15:13:14 +01:00
Tobias Hunger
3c05dfe029 lsp: Report that we send progress information 2022-12-05 15:13:14 +01:00
Simon Hausmann
78d070c713 online editor: Fix preview not being visible with Safari
A value of "1" for the style property turns into "none" in the computed style, for the canvas element.

Fixes #1945
2022-12-05 14:49:20 +01:00
Simon Hausmann
11f46906a2 Centralize rust-version in Cargo.toml
Require 1.64 in the workspace and inherit the setting in package
Cargo.toml files.
2022-12-05 12:39:14 +01:00
Tobias Hunger
24500fbf6b online editor: Explain how preview scaling works 2022-12-02 17:14:05 +01:00
Tobias Hunger
f069d066bd online editor: Add zoom level to preview widget
Add a set of widgets to control the zoom level to the preview widget.
2022-12-02 17:14:05 +01:00
Tobias Hunger
a30c921983 online editor: Add zoom level to preview 2022-12-02 17:14:05 +01:00
Tobias Hunger
765b59ec48 online editor: Fix icons 2022-12-02 17:14:05 +01:00
Tobias Hunger
4d88e59675 online editor: Improve positioning of preview area
Work around the scrollbar not reaching the entire preview canvas when it
is overflowing.

References #1762
2022-12-01 16:56:40 +01:00
Tobias Hunger
b6f36e7ce1 lsp: Add removeBinding command
Add a command to remove a proerty binding from an element.
2022-12-01 14:04:30 +01:00
Tobias Hunger
3a601ba6ef lsp: Add function to right extend around a token
... collecting white-space and comments and associating that with the
token.
2022-12-01 14:04:30 +01:00
Tobias Hunger
8adf03945c lsp: Look for comments to remove together with a property
Look for leading comments that probably go with a property and add those to
the deletion range.
2022-12-01 14:04:30 +01:00
Tobias Hunger
11150d93ed lsp: Add a delete_range to property information
Add a field to report the range covered by an expression so that it can
get deleted.
2022-12-01 14:04:30 +01:00
Tobias Hunger
0dee4fa486 lsp: Add option to report progress information 2022-12-01 11:15:57 +01:00
Simon Hausmann
ace4f92aad online editor: fix hello world re-appearing unexpectedly
After checking if the instance field is null, we await the promise that
would guarantee DOM attachment.  While we await, the browser processes
other microtasks, and we might end up in render() again. This time the
instance field is also null, but the ensure_attached_to_dom promise is
already resolved, so we would create the first slint component and the
associated window. Later we would return from the first await. At this
point the instance field is already set, so we should re-use the
existing window, but since we're not checking anymore, we'll go ahead
and create a second window on the same canvas element.

Fixes #1926
2022-11-29 17:18:16 +01:00
Tobias Hunger
01a9309895 lsp: Do not error out on requests returning an empty response
It is perfectly valid for Requests to return `()`.
2022-11-29 10:54:59 +01:00
Olivier Goffart
017e203653 LSP: don't query configuration if the client don't advertize we can do it 2022-11-28 15:59:53 +01:00
Olivier Goffart
261e612555 Janitor: dependencies update 2022-11-28 15:59:45 +01:00
ogoffart
fb02b4118b Bump version number to 0.3.3 2022-11-28 13:11:11 +00:00
Tobias Hunger
e9d28f00e3 tools: Unshare some code
Do not interact with the language server directly in vscode, but use
vscode.commands.executeCommand(...) instead. The online_editor will of
course need to continue to interact with the language server directy, so
this unshares a bit of code. It is not too much and straight forward
code, so that is not too bad.
2022-11-26 18:26:37 +01:00
Tobias Hunger
b949689e35 Revert "tools: Put code shared between online editor and vscode in NPM package"
This caused trouble with both the online editor as well as the VSCode
extension when built in CI.

This reverts commit c8b434021e.
2022-11-25 17:34:32 +01:00
Tobias Hunger
0672e02115
Tools: Retry getting properties on error (#1907)
* Tools: trigger updates for properties view more often

So far you had to move the cursor to refresh the properties view after
start-up. This is no longer necessary.
2022-11-24 19:40:19 +01:00
Tobias Hunger
83b64eaecb
vscode: Have welcome pages in property view
Add a way to have welcome pages to the properties view. Make the
properties view reflect changes in the IDE better.
2022-11-24 16:49:54 +01:00
Tobias Hunger
c8b434021e tools: Put code shared between online editor and vscode in NPM package
Put the shared code into an NPM package. This makes especially vscode
much happier as it does not need to build code outside its project root
anymore:-)
2022-11-24 12:57:47 +01:00
Simon Hausmann
f0d7009133 Fix C++ Ninja build on Windows
For Ninja builds we instruct the compiler to generate a dependency file.
This would include paths like builtin:/native/../common/slint-logo-light.svg,
which my version of Ninja on Windows doesn't like at all and just flat out aborts on.

It doesn't make sense for us to emit those as dependencies, so this patch excludes
builtin paths.
2022-11-23 17:18:52 +01:00
Tobias Hunger
784ea30bc7
Revert "build fix: Undo spelling fix, typo is upstream"
This reverts commit 2d8fa43c74.
2022-11-23 16:03:14 +01:00
Tobias Hunger
2d8fa43c74
build fix: Undo spelling fix, typo is upstream 2022-11-23 15:32:22 +01:00
Tobias Hunger
f8a0cf6d81 tools: Use setBinding in the LSP to set bindings 2022-11-23 14:03:44 +01:00
Tobias Hunger
bf340f62c1 tools: Make properties view use document version 2022-11-23 14:03:44 +01:00
Tobias Hunger
9321b2acc0 online editor: Update Properties on position change
... which includes the document service for a couple of commits now.

This improves the update, decouples the properties from the editor
widget and makes the proerties widget more similar to the outline
widget.
2022-11-23 14:03:44 +01:00
Tobias Hunger
2837e6f971 online editor: Make the outline widget look at document version
Make the outline widget look at the version information and update as
necessary instead of every couple of seconds.
2022-11-23 14:03:44 +01:00
Tobias Hunger
e3f70cf714 online editor: Make the editor report document versions
This can be used to detect whether or not the data is outdated later.
2022-11-23 14:03:44 +01:00
Tobias Hunger
f54c2d188b LSP: Cleanup error handling 2022-11-23 13:19:07 +01:00
Tobias Hunger
86f6636815 LSP: Drop document_cache handle before sending more requests
This works around the setBinding calling back into the client, which
would cause the LSP to panic as there already was a mutable reference to
the document cahce held.
2022-11-23 13:19:07 +01:00
Tobias Hunger
47e58e3f48 online editor: Use LspPosition/Range consistently
I was using the editor positions/ranges before, but converting between
LSP and editor values requires having the text at hand as we need to map
from utf-8 to utf-16 based numbering.

This forced all the LSP operations to happen in the editor itself, and
the editor exposing interfaces for the other parts of the online editor
to use. I plan to de-emphasize the editor for the LSP going forward, so I
need to switch out the addressing being used.
2022-11-23 08:44:04 +01:00