mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-03 07:04:34 +00:00
Clarify the use of file vs. directory references in library paths
This commit is contained in:
parent
167ca4bc3b
commit
97ac7138c1
1 changed files with 11 additions and 4 deletions
|
@ -123,12 +123,18 @@ components between projects without hardcoding their relative paths, use
|
||||||
the component library syntax:
|
the component library syntax:
|
||||||
|
|
||||||
```slint,ignore
|
```slint,ignore
|
||||||
import { MySwitch } from "@mylibrary";
|
import { MySwitch } from "@mylibrary/switch.slint";
|
||||||
|
import { MyButton } from "@otherlibrary";
|
||||||
```
|
```
|
||||||
|
|
||||||
In the above example, the `MySwitch` component will be imported from a component
|
In the above example, the `MySwitch` component will be imported from a component
|
||||||
library called "mylibrary". The path to this library must be defined separately at compilation time.
|
library called `mylibrary`, in which Slint looks for the `switch.slint` file. Therefore `mylibrary` must be
|
||||||
Use one of the following methods to help the Slint compiler resolve "mylibrary" to the correct
|
declared to refer to a directory, so that the subsequent search for `switch.slint`
|
||||||
|
succeeds. `MyButton` will be imported from `otherlibrary`. Therefore `otherlibrary`
|
||||||
|
must be declared to refer to a `.slint` file that exports `MyButton`.
|
||||||
|
|
||||||
|
The path to each library, as file or directory, must be defined separately at compilation time.
|
||||||
|
Use one of the following methods to help the Slint compiler resolve libraries to the correct
|
||||||
path on disk:
|
path on disk:
|
||||||
|
|
||||||
* When using Rust and `build.rs`, call [`with_library_paths`](slint-build-rust:struct.CompilerConfiguration#method.with_library_paths)
|
* When using Rust and `build.rs`, call [`with_library_paths`](slint-build-rust:struct.CompilerConfiguration#method.with_library_paths)
|
||||||
|
@ -140,7 +146,8 @@ path on disk:
|
||||||
using the `Slint: Library Paths` setting. Example below:
|
using the `Slint: Library Paths` setting. Example below:
|
||||||
```json
|
```json
|
||||||
"slint.libraryPaths": {
|
"slint.libraryPaths": {
|
||||||
"mylibrary": "/path/to/my/library"
|
"mylibrary": "/path/to/my/library",
|
||||||
|
"otherlibrary": "/path/to/otherlib/index.slint",
|
||||||
},
|
},
|
||||||
```
|
```
|
||||||
* With other editors, you can configure them to pass the `-L` argument to the `slint-lsp` just like for the slint-viewer.
|
* With other editors, you can configure them to pass the `-L` argument to the `slint-lsp` just like for the slint-viewer.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue