Commit graph

62 commits

Author SHA1 Message Date
Tasuku Suzuki
83db461f63
Transition: Introduce in-out to allow writing symmetry animation (#8509) 2025-05-26 09:17:22 +02:00
U. Bruhin
a5ec77ac99
Allow trailing comma in import statements (#8223)
Adding support for (optional) trailing commas like this:

    import {
        Foo,
        Bar,
    } from "foobar.slint";

This way it's more convenient to keep component imports sorted and
leads to smaller diffs when adding more components to the end of the
import statement.

ChangeLog: Allow trailing comma in import statements

Closes #4922
2025-04-21 17:24:18 +02:00
Olivier Goffart
b77368f1b6
diagnostic: try to detect use of range expression and recommand to use number
Several users have been asking if it is possible to use range
expression.
Detect this and have a meaningful error message
2025-04-19 22:47:45 +02:00
Olivier Goffart
76332c5e16 Improve a bit the error when the base of an element is missing 2025-01-06 10:47:05 +01:00
Olivier Goffart
6c81d5069e Fix parsing of unfinished import statement
Fix #6588

Note for the test: parse error at the end of the file are actually
reported at offset 0. Use a trick to add more `^` at the beginning to
mean that.
(Offset 0 is actually offset 1 as the column starts at 1)
2024-10-22 09:35:46 +02:00
Olivier Goffart
4718d5b050
Fix invalid node generated while parsing invalid @tr (#6560)
Fixes #6512

The TrPlural must always have an expression otherwise it panics later.
(Also adjust the panic message when nodes are missing)
2024-10-15 10:23:56 +02:00
Olivier Goffart
cfa115affa LSP: changed callbacks auto-completion
ChangeLog: LSP: auto-completion of changed callbacks
2024-09-26 18:20:03 +02:00
Olivier Goffart
3a59950751 Experimental support for named callback parameters
And use that in the lsp/ui implementation instead of comments.

This is only a parser support for now, the name is otherwise unused.
Hence I rather keep that experimental.
2024-08-19 14:10:01 +02:00
Olivier Goffart
66370b6bda
Add export { ... } from "....slint"; syntax. (#5533) 2024-07-03 12:50:40 +02:00
Tobias Hunger
f8e4072d0c janitor: Fix clippy "unneeded return" 2024-06-24 14:59:47 +02:00
Aurindam Jana
3523e86359
Simplify commercial license (#3063)
Base the commercial license on the Royalty-free license adding clauses pertaining to the fees.
2024-05-31 14:06:17 +02:00
Aurindam Jana
9a3aa265d5
Update Royalty-free license (#5257)
Add clarification that Application may not expose Slint APIs.
2024-05-31 10:53:19 +02:00
Tobias Hunger
d852e42431 compiler: Add ConditionalElement as a possible child of Element
It's not critical, but nice to have this option documnted (and the code
to find all `ConditionalElement`s generated).
2024-05-27 16:53:22 +02:00
Olivier Goffart
32bf6608e9 Parse changed callbacks 2024-05-02 22:25:53 +02:00
Aurindam Jana
0cfeec1a31
Update Slint Community License (#4994)
Updated the version from 1.1 to 1.2 
Renamed the header to "Slint Royalty-free Desktop, Mobile, and Web Applications License"
Added definition of "Mobile Application" and grant of right
Moved "Limitations" to 3rd section and "License Conditions - Attributions" to 2nd section
Added flexibility to choose between showing "MadeWithSlint" as a dialog/splash screen or on a public webpage
Moved the para on copyright notices to section under "Limitations"
2024-04-15 15:18:55 +02:00
Olivier Goffart
8628624296 fmt: Fix formatting of function argument declaration
Fix #4892
2024-03-20 22:35:53 +01:00
Olivier Goffart
c3a2ad1c45 fmt: format two way bindings 2024-03-11 10:39:55 +01:00
Olivier Goffart
255dc59ef4 Rename @image-url(..., 9slice(...)) to @image-url(..., nine-slice(...))
As per API review:
 - In the Rust and C++ API we use `set_nine_slice_edges` because the getter couldn't start with 9
 - in english we spell number less than 10 with letters and this is a name
2024-03-07 17:01:57 +01:00
Olivier Goffart
6e2280ece3 Parse 9slice in @image-url 2024-02-13 14:46:27 +01:00
1plus
367b5c5a76
Make the parentheses optional in if else statement (#4417)
* remove expect of parents in if else

* fix parser for parentless if

* add test for non-parentheses if
2024-01-24 20:07:33 +01:00
Olivier Goffart
2ce161ced8 Parser: Hint for the mod function when parsing %
Was reported several times:
 - https://github.com/slint-ui/slint/discussions/4190
 - https://github.com/slint-ui/slint/issues/3980
2023-12-19 17:23:30 +01:00
Olivier Goffart
8f001ac490 Add support for protected functions
Protected function can only be called from the direct base

Issue #3636
2023-10-11 10:50:50 +02:00
Olivier Goffart
37f11e566b Better error when using ';' instead of ',' when declaring struct 2023-07-24 12:31:41 +02:00
Aurindam Jana
5a4a7fee63
Update royalty free license to 1.1 (#2994) 2023-07-10 10:12:11 +02:00
Tobias Hunger
e02c360000 Clippy polish 2023-06-28 14:22:30 +02:00
Olivier Goffart
fdec5960bd Support for @rust-attr on enums 2023-06-19 22:40:49 +02:00
Olivier Goffart
11dea135f7 Domain: slint-ui.com -> slint.dev 2023-06-16 10:55:08 +02:00
Aurindam Jana
039e54a5de
Add royalty free license to files except examples and docs (#2888) 2023-06-15 11:20:50 +02:00
Olivier Goffart
ac6f473a64 WIP: support for enum in slint
Parser and interpreter part
2023-06-12 13:02:14 +02:00
Olivier Goffart
12e6b34e2d Translations: support for plurals 2023-06-07 10:34:34 +02:00
Olivier Goffart
e97a2e8229 Translations: support context 2023-06-06 14:48:48 +02:00
Olivier Goffart
dcd8450dfa WIP: start working on translations: @tr()
This commit just do the parsing of the @tr macro.
2023-06-05 16:34:59 +02:00
Amirhossein Akhlaghpour
3a4f3c61d5
Add @rust-attr on scturct (#2785)
Fixes: #2660
2023-06-05 16:29:55 +02:00
Olivier Goffart
875a7ea179 Parser: Nicer error when extra top-level semicolon
Recover from extra semicolon
2023-04-17 15:13:20 +02:00
Olivier Goffart
a7b8bafdf9 Ensure completion in the document in case of parse error or empty document
Every token must be part of a document, including the EOF,
otherwise completion don't work at the end of the document.
2023-04-17 07:58:18 +02:00
Olivier Goffart
ee9f730a6d Parser: Don't parse everything as a component
The old parser always try first to find `Foo :=` from the old syntax so it
would error saying it expect an identifier or `:=`
But if we don't find a component, don't try to parse it as a component too early
This way we get better error and better auto-completions
2023-04-17 07:58:18 +02:00
Olivier Goffart
40922874fa parser: don't parse error on empty import statement
Report the error later when loading the import.
That way, we get a more complete AST for auto-completion
2023-04-17 07:58:18 +02:00
Olivier Goffart
82ae83ce8c Parser: don't have the whitespace as part of an expression
That way the error for an expression is at a better location, and
this also prevent the formater that removes space in expressions to
remove the spaces before the expression that shouldn't be removed
2023-04-14 17:46:19 +02:00
Olivier Goffart
4f00f268a5 Make the old syntax a warning 2023-02-14 12:38:39 +01:00
Olivier Goffart
a0d057b8b8 Enable the new syntax by default 2023-01-07 14:18:10 +01:00
Olivier Goffart
1cbd61145e WIP: pure qualifier for callback and functions 2022-12-22 00:26:27 -08:00
Olivier Goffart
aeed3b48fc Parser: fix parsing of "public function" in release mode
`consume()` does not advance whitespace, while `peek()` does.  And the
`peek()` in the debug_assert meant that the behavior was different in
release and debug mode.
Use `expect` instead of consume as it skip over white space
2022-12-15 12:52:21 +01:00
Simon Hausmann
8faf57fa40 Minor fix to export * from "blah" parsing
Use the star token directly.
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
ed07cd825d Make functions private by default unless annotated with 'public' 2022-12-06 14:56:25 +01:00
Olivier Goffart
851a910e41 Parser: Parse functions 2022-12-06 14:56:25 +01:00
Olivier Goffart
51933b99bb New syntax for transitions, within the state 2022-11-22 15:16:54 +01:00
Olivier Goffart
c1c52a2b86 Make the test pass without defining the SLINT_EXPERIMENTAL_SYNTAX env variable 2022-11-21 22:01:52 +01:00
Olivier Goffart
d2ade4fd98
Document and enable the in / out keywords with the old component syntax (#1879)
But it still defaults to `in-out`
2022-11-21 18:41:35 +01:00
Simon Hausmann
59d3a69688
Fix support for multiple import statements from the same path (#1868)
Importing multiple types from the same file with multiple import statements would produce an error.
2022-11-21 15:37:38 +01:00