Commit graph

6496 commits

Author SHA1 Message Date
Olivier Goffart
c5ea3e842d LSP: do not auto-complete globals in place of elements 2022-06-01 14:55:38 +02:00
Olivier Goffart
42c7b8819d LSP: Auto-complete types that are not yet imported, and add the import 2022-06-01 14:55:38 +02:00
Tobias Hunger
29c1086050 Online editor: Add link to Slint language reference
This link works on the slint web site, but not when run locally. We do
not expect this to have users outside of the Slint site, so we are
willing to accept this limitation.

Please open a bug report if you indeed use the online editor elsewhere
and are bothered by the link.
2022-06-01 10:14:43 +02:00
Simon Hausmann
8413480228 Install wasm-pack for the vs code extension 2022-05-31 17:44:56 +02:00
Simon Hausmann
f2d3b280b7 Prospective fix for vsce package build
Build regular and web extension in one go
2022-05-31 17:44:56 +02:00
Olivier Goffart
9c315747dd vscode extension: Make sure to compile the web extension before publishing 2022-05-31 17:44:56 +02:00
Olivier Goffart
b1c11eb19b Fix error reporting: wasm always uses url which are always "relative" path 2022-05-31 17:44:56 +02:00
Olivier Goffart
c969eaf59c vscode web extension: make send_notification work 2022-05-31 17:44:56 +02:00
Olivier Goffart
07ba0f8458 vscode: Some progress on the web extension
Now it calls in the wasm properly.
But i get borrowmut error because the wasm re-enter from send_notification into the request
2022-05-31 17:44:56 +02:00
Olivier Goffart
9dbe6814f8 LSP: Some progress on the vscode browser extension
we need to use commonjs for the extension

If we start the client before the server has loaded the wasm, we don't
listen yet to the init message, so make sure not to start the client
before we sent the "OK" message back.

But it's still not working, the wasm code is called, but the parameter are
not properly passed
2022-05-31 17:44:56 +02:00
Simon Hausmann
1437648df1 WIP: bundle the lsp wasm inside browserServerMain.js
* Use wasm-pack's web mode to create a .wasm file and an ESM module for the
  glue code
* Import the .wasm file directly in browserServerMain.ts
* And process it all with esbuild, which succeeds in seeing the .wasm import in
  browserServerMain.ts and then bundles it inline.
2022-05-31 17:44:56 +02:00
Olivier Goffart
8f03e2cff1 WIP: make the vscode extension work as web extension
This refactor the LSP to be possible to compile for wasm.
When using wasm we can't use the lsp-server crate because that one use the
stdin/stdout to communicate.
Instead, we need will do the communication in TypeScript using the vscode
language server protocol library, and serialize the types to wasm. Fortunately
that's easy because the lsp-types crate contains all the serialized types.

This also "duplicate" the extension as a web extension that do not use process
to start the LSP, but use a web worker. Some of the extension code could
be refactored to avoid some duplication (like the status bar handling and such).
And add a "browser" entry point in the package.json

Finally, add a browserServerMain.ts entry point for our worker, it will try to load
the wasm code.

Currently this doesn't wirk: the browserServerMain.ts can't load the wasm.

Also todo is to write the code so that the wasm code can send the response and
notifications.

To debug, I type these commands in editor/vscode directory

    npm run compile-web
    code --extensionDevelopmentKind=web --extensionDevelopmentPath=$PWD   ../..
2022-05-31 17:44:56 +02:00
Olivier Goffart
f9f842400c Small improvement to the debug function
- Fix a warning in the mcu build
 - Do print something for MCU and wasm using our debug_log!
 - Use Display instead of Debug to avoid useless quotes
2022-05-31 16:24:39 +02:00
Olivier Goffart
a20d08b45f deduplicate_property_read: bail out if there is a write
Fixes #1271
2022-05-31 14:55:09 +02:00
Olivier Goffart
fa6be65a04 Revert "Rename the free_graphics_resources to component_destroyed"
This reverts commit 1b9fee96c16f7a660ed2c14bb3287fceedc72ba7.

The MCU backend still need the array of item, so it's too realy for this change
2022-05-31 10:48:24 +02:00
Olivier Goffart
ad2d19165a Rename the free_graphics_resources to component_destroyed
And do not iterate over the items anymore
2022-05-31 10:48:24 +02:00
Olivier Goffart
6cbf2c0609 Put the new cache in corelib and use it in the GL backend 2022-05-31 10:48:24 +02:00
Olivier Goffart
615c7635ee Qt: use a HashMap for the cache
And not the cache dirrectly within the item, because it is already in use
for the partial rendering
2022-05-31 10:48:24 +02:00
Olivier Goffart
d2186593c0 Pass the ItemRc to each draw_function
So that it can be used as a key to the cache
2022-05-31 10:48:24 +02:00
Olivier Goffart
48f818df62 C++ VBox: make the destructor delete the content in C++ 2022-05-30 13:54:35 +02:00
Olivier Goffart
91acbeed92 VTable: use NonNull as internal data.
That way, `Option<VBox<X>>` has the same layout as `VBox<X>`
2022-05-30 13:54:35 +02:00
Olivier Goffart
3a6f6d25e6 Fix wasm compilation
For some reason when compiling slint-lsp for wasm, rustc cannot infer this type
2022-05-30 11:07:29 +02:00
Lukas Jung
2c416670e5
Add support for the log crate (#1283) 2022-05-27 13:30:11 +02:00
Olivier Goffart
80830bbece MCU: Refactor the renderer in a LineRenderer
The LineRenderer is going to be a public type which can be used
by the MCU board support to draw.
Right now, it is used by the old code
2022-05-23 16:40:34 +02:00
Simon Hausmann
cf47d3919c Replace femtovg patch with new release 2022-05-23 09:32:25 +02:00
Tobias Hunger
96b6ca8830 janitor: Remove unnecessary references 2022-05-22 11:59:00 +02:00
Tobias Hunger
55249c90de janitor: fix redundant clones 2022-05-22 11:59:00 +02:00
Tobias Hunger
9b535e8ee8 janitor: use matches! 2022-05-22 11:59:00 +02:00
Tobias Hunger
7bf5c7e28e janitor: Use is_empty over comparison with len 2022-05-22 11:59:00 +02:00
Tobias Hunger
a71848fd2c janitor: Avoid some allocations warned about by clippy 2022-05-22 11:59:00 +02:00
Tobias Hunger
18cbda0269 janitor: Run cargo clippy --fix 2022-05-22 11:59:00 +02:00
Olivier Goffart
9fc838206a Fix gradient interpolation
When the percentage is missing, we should interpolate between the
last valid entry to the first valid entry after that, not always the
last valid entry in the whole gradient
2022-05-21 12:00:20 +02:00
Olivier Goffart
9ae6d71619 Qt: fix gradient that have stop at the same position
Qt implementation only keep one stop if two are at the same location.
So mangle the stop position to be sure they are all at sligntly different position
2022-05-21 11:43:53 +02:00
Olivier Goffart
856a7d7f0a figma import: use the clip property instead of the Clip element
Fixes #1288
2022-05-20 16:24:55 +02:00
Olivier Goffart
6ba76d1708 Fix interpolation between gradiants of different size
The loop was skipping one of the stop to interpolate
because when one iterator was returning None, the other
one had also advenced and its result discared.
We can just unwrap the value instead from the longer chain.

For the radial gradiant, we need to interpolate the last
colors to avoid a flash at the beginning for all the area
"outside" the circle.
2022-05-20 09:06:55 +02:00
Olivier Goffart
66c443c90c Add the rust-version field to make the MRSV explicit
We changed the MSRV in the last release because some dependency depended on
Rust 1.59. But that did not concern the C++ build, for example.
Now that we rely on rust 1.59 in our own code, we should make it explicit
so that the compilation error show the proper error
2022-05-20 08:18:11 +02:00
Olivier Goffart
f611651bb7 LSP: Fix auto-completion of @-macros 2022-05-19 19:22:56 +02:00
Simon Hausmann
fd195904a1 Allow for the use of cache-rendering-hint in separate components
The `lower_property_to_element` pass usually disallows that because it
injects the Layer element and we can't do that for components. But we
can handle this like with opacity and inline.
2022-05-19 18:50:45 +02:00
Simon Hausmann
9fe2bfe8b9 Fix typo 2022-05-19 16:53:06 +02:00
Simon Hausmann
2f5c0cbfd3 Speed up the GL backend on older GPUs
femtovg's large fragment shader with much code and many branches (on
uniforms though) is paying a hefty price on GPUs like the GC7000UL.

This brings in an open merge request to femotvg that splits up the
fragment shader into smaller programs, giving a speed bump of ~15FPS on
a moderately complex scene.
2022-05-19 16:53:06 +02:00
Olivier Goffart
a42b8df1f0 Changelog entry for PR #1263 2022-05-19 16:48:34 +02:00
Levin Rickert
1640f117a7 add test case 2022-05-19 16:45:29 +02:00
Levin Rickert
e7aef68d1f accept wheel event from flickable 2022-05-19 16:45:29 +02:00
Levin Rickert
8a3b24868b add docs comment 2022-05-19 16:45:29 +02:00
Levin Rickert
5094a59f82 convert scroll to move event for flickable children 2022-05-19 16:45:29 +02:00
Levin Rickert
cdc9ea0e94 WIP 2022-05-19 16:45:29 +02:00
Lukas Jung
7d5998cb81
Add 7GUIs Readme (#1266) 2022-05-19 14:27:52 +02:00
Olivier Goffart
b4ebd88d35 Implements @radial-gradient(circle, ...)
Only the circle is implemented so far.

Part of #263
2022-05-19 14:07:20 +02:00
Olivier Goffart
7a1e5bef93 crater: add more URLS found on github 2022-05-19 08:51:19 +02:00
Simon Hausmann
8866e85898 Enable the simple env logger on slint-viewer
This makes it possible to see the output from the log facade in any
crates that Slint uses, using the RUST_LOG environment variable..
2022-05-17 16:58:50 +02:00