mirror of
https://github.com/yewstack/yew.git
synced 2026-01-18 16:16:48 +00:00
* Bump the website-deps group across 1 directory with 15 updates Bumps the website-deps group with 14 updates in the /website directory: | Package | From | To | | --- | --- | --- | | [@docusaurus/core](https://github.com/facebook/docusaurus/tree/HEAD/packages/docusaurus) | `3.5.2` | `3.7.0` | | [@docusaurus/plugin-client-redirects](https://github.com/facebook/docusaurus/tree/HEAD/packages/docusaurus-plugin-client-redirects) | `3.5.2` | `3.7.0` | | [@docusaurus/preset-classic](https://github.com/facebook/docusaurus/tree/HEAD/packages/docusaurus-preset-classic) | `3.5.2` | `3.7.0` | | [@mdx-js/react](https://github.com/mdx-js/mdx/tree/HEAD/packages/react) | `3.0.1` | `3.1.0` | | [docusaurus-plugin-sass](https://github.com/rlamana/docusaurus-plugin-sass) | `0.2.5` | `0.2.6` | | [react](https://github.com/facebook/react/tree/HEAD/packages/react) | `18.3.1` | `19.0.0` | | [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) | `18.3.10` | `19.0.8` | | [react-dom](https://github.com/facebook/react/tree/HEAD/packages/react-dom) | `18.3.1` | `19.0.0` | | [sass](https://github.com/sass/dart-sass) | `1.79.4` | `1.83.4` | | [@docusaurus/tsconfig](https://github.com/facebook/docusaurus/tree/HEAD/packages/docusaurus-tsconfig) | `3.5.2` | `3.7.0` | | [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) | `8.8.0` | `8.22.0` | | [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) | `8.8.0` | `8.22.0` | | [prettier](https://github.com/prettier/prettier) | `3.3.3` | `3.4.2` | | [typescript](https://github.com/microsoft/TypeScript) | `5.6.2` | `5.7.3` | Updates `@docusaurus/core` from 3.5.2 to 3.7.0 - [Release notes](https://github.com/facebook/docusaurus/releases) - [Changelog](https://github.com/facebook/docusaurus/blob/main/CHANGELOG.md) - [Commits](https://github.com/facebook/docusaurus/commits/v3.7.0/packages/docusaurus) Updates `@docusaurus/plugin-client-redirects` from 3.5.2 to 3.7.0 - [Release notes](https://github.com/facebook/docusaurus/releases) - [Changelog](https://github.com/facebook/docusaurus/blob/main/CHANGELOG.md) - [Commits](https://github.com/facebook/docusaurus/commits/v3.7.0/packages/docusaurus-plugin-client-redirects) Updates `@docusaurus/preset-classic` from 3.5.2 to 3.7.0 - [Release notes](https://github.com/facebook/docusaurus/releases) - [Changelog](https://github.com/facebook/docusaurus/blob/main/CHANGELOG.md) - [Commits](https://github.com/facebook/docusaurus/commits/v3.7.0/packages/docusaurus-preset-classic) Updates `@mdx-js/react` from 3.0.1 to 3.1.0 - [Release notes](https://github.com/mdx-js/mdx/releases) - [Changelog](https://github.com/mdx-js/mdx/blob/main/changelog.md) - [Commits](https://github.com/mdx-js/mdx/commits/3.1.0/packages/react) Updates `docusaurus-plugin-sass` from 0.2.5 to 0.2.6 - [Release notes](https://github.com/rlamana/docusaurus-plugin-sass/releases) - [Commits](https://github.com/rlamana/docusaurus-plugin-sass/compare/v0.2.5...v0.2.6) Updates `react` from 18.3.1 to 19.0.0 - [Release notes](https://github.com/facebook/react/releases) - [Changelog](https://github.com/facebook/react/blob/main/CHANGELOG.md) - [Commits](https://github.com/facebook/react/commits/v19.0.0/packages/react) Updates `@types/react` from 18.3.10 to 19.0.8 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react) Updates `react-dom` from 18.3.1 to 19.0.0 - [Release notes](https://github.com/facebook/react/releases) - [Changelog](https://github.com/facebook/react/blob/main/CHANGELOG.md) - [Commits](https://github.com/facebook/react/commits/v19.0.0/packages/react-dom) Updates `sass` from 1.79.4 to 1.83.4 - [Release notes](https://github.com/sass/dart-sass/releases) - [Changelog](https://github.com/sass/dart-sass/blob/main/CHANGELOG.md) - [Commits](https://github.com/sass/dart-sass/compare/1.79.4...1.83.4) Updates `@docusaurus/module-type-aliases` from 3.5.2 to 3.7.0 - [Release notes](https://github.com/facebook/docusaurus/releases) - [Changelog](https://github.com/facebook/docusaurus/blob/main/CHANGELOG.md) - [Commits](https://github.com/facebook/docusaurus/commits/v3.7.0/packages/docusaurus-module-type-aliases) Updates `@docusaurus/tsconfig` from 3.5.2 to 3.7.0 - [Release notes](https://github.com/facebook/docusaurus/releases) - [Changelog](https://github.com/facebook/docusaurus/blob/main/CHANGELOG.md) - [Commits](https://github.com/facebook/docusaurus/commits/v3.7.0/packages/docusaurus-tsconfig) Updates `@types/react` from 18.3.10 to 19.0.8 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react) Updates `@typescript-eslint/eslint-plugin` from 8.8.0 to 8.22.0 - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.22.0/packages/eslint-plugin) Updates `@typescript-eslint/parser` from 8.8.0 to 8.22.0 - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.22.0/packages/parser) Updates `prettier` from 3.3.3 to 3.4.2 - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/3.3.3...3.4.2) Updates `typescript` from 5.6.2 to 5.7.3 - [Release notes](https://github.com/microsoft/TypeScript/releases) - [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml) - [Commits](https://github.com/microsoft/TypeScript/compare/v5.6.2...v5.7.3) --- updated-dependencies: - dependency-name: "@docusaurus/core" dependency-type: direct:production update-type: version-update:semver-minor dependency-group: website-deps - dependency-name: "@docusaurus/plugin-client-redirects" dependency-type: direct:production update-type: version-update:semver-minor dependency-group: website-deps - dependency-name: "@docusaurus/preset-classic" dependency-type: direct:production update-type: version-update:semver-minor dependency-group: website-deps - dependency-name: "@mdx-js/react" dependency-type: direct:production update-type: version-update:semver-minor dependency-group: website-deps - dependency-name: docusaurus-plugin-sass dependency-type: direct:production update-type: version-update:semver-patch dependency-group: website-deps - dependency-name: react dependency-type: direct:production update-type: version-update:semver-major dependency-group: website-deps - dependency-name: "@types/react" dependency-type: direct:development update-type: version-update:semver-major dependency-group: website-deps - dependency-name: react-dom dependency-type: direct:production update-type: version-update:semver-major dependency-group: website-deps - dependency-name: sass dependency-type: direct:production update-type: version-update:semver-minor dependency-group: website-deps - dependency-name: "@docusaurus/module-type-aliases" dependency-type: direct:development update-type: version-update:semver-minor dependency-group: website-deps - dependency-name: "@docusaurus/tsconfig" dependency-type: direct:development update-type: version-update:semver-minor dependency-group: website-deps - dependency-name: "@types/react" dependency-type: direct:development update-type: version-update:semver-major dependency-group: website-deps - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-minor dependency-group: website-deps - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-minor dependency-group: website-deps - dependency-name: prettier dependency-type: direct:development update-type: version-update:semver-minor dependency-group: website-deps - dependency-name: typescript dependency-type: direct:development update-type: version-update:semver-minor dependency-group: website-deps ... Signed-off-by: dependabot[bot] <support@github.com> * chore: fix formatting * chore: bump prettier (can't reproduce element.mdx warning locally?) * workflow: show formatting diff for locally unproduceable errors * chore: format elements.mdx --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Matt Yan <syan4@ualberta.ca> Co-authored-by: Siyuan Yan <44753941+Madoshakalaka@users.noreply.github.com>
161 lines
4.2 KiB
Plaintext
161 lines
4.2 KiB
Plaintext
---
|
|
title: 'Editor Setup'
|
|
description: 'Setting your code editor'
|
|
---
|
|
|
|
:::important contribute
|
|
Using a different editor? Feel free to add instructions for your editor of choice.
|
|
:::
|
|
|
|
## Add a template for creating components
|
|
|
|
### JetBrains IDEs
|
|
|
|
1. Navigate to File | Settings | Editor | Live Templates.
|
|
2. Select Rust and click on the + icon to add a new Live Template.
|
|
3. Give it a name and description of your preference.
|
|
4. Paste the following snippet(s) into the Template Text section.
|
|
5. Change the applicability on the lower right, select Rust > Item > Module
|
|
|
|
For function components, use the following template.
|
|
|
|
- (Optional) Click on Edit Variable and give `tag` a reasonable default value like "div", with double quotes.
|
|
|
|
```rust ,ignore
|
|
#[derive(PartialEq, Properties)]
|
|
pub struct $Name$Props {
|
|
}
|
|
|
|
#[function_component]
|
|
pub fn $Name$(props: &$Name$Props) -> Html {
|
|
html! {
|
|
<$tag$>$END$</$tag$>
|
|
}
|
|
}
|
|
```
|
|
|
|
For struct components, you can use the following more complicated template.
|
|
|
|
```rust ,ignore
|
|
struct $NAME$;
|
|
|
|
enum $NAME$Msg {
|
|
}
|
|
|
|
impl Component for $NAME$ {
|
|
type Message = $NAME$Msg;
|
|
type Properties = ();
|
|
|
|
fn create(ctx: &Context<Self>) -> Self {
|
|
Self
|
|
}
|
|
|
|
fn view(&self, ctx: &Context<Self>) -> Html {
|
|
html! {
|
|
$HTML$
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
### VS Code
|
|
|
|
1. Navigate to File > Preferences > User Snippets.
|
|
2. Select Rust as the language.
|
|
3. Add the following snippet in the snippet JSON file:
|
|
|
|
```json
|
|
{
|
|
"New Yew function component": {
|
|
"prefix": "yewfc",
|
|
"body": [
|
|
"#[derive(PartialEq, Properties)]",
|
|
"pub struct ${1:ComponentName}Props {}",
|
|
"",
|
|
"#[function_component]",
|
|
"pub fn $1(props: &${1}Props) -> Html {",
|
|
" let ${1}Props {} = props;",
|
|
" html! {",
|
|
" <${2:div}>$0</${2}>",
|
|
" }",
|
|
"}"
|
|
],
|
|
"description": "Create a minimal Yew function component"
|
|
},
|
|
"New Yew struct component": {
|
|
"prefix": "yewsc",
|
|
"body": [
|
|
"pub struct ${1:ComponentName};",
|
|
"",
|
|
"pub enum ${1}Msg {",
|
|
"}",
|
|
"",
|
|
"impl Component for ${1} {",
|
|
" type Message = ${1}Msg;",
|
|
" type Properties = ();",
|
|
"",
|
|
" fn create(ctx: &Context<Self>) -> Self {",
|
|
" Self",
|
|
" }",
|
|
"",
|
|
" fn view(&self, ctx: &Context<Self>) -> Html {",
|
|
" html! {",
|
|
" $0",
|
|
" }",
|
|
" }",
|
|
"}"
|
|
],
|
|
"description": "Create a new Yew component with a message enum"
|
|
}
|
|
}
|
|
```
|
|
|
|
## Support for the `html!` Macro
|
|
|
|
### JetBrains IDEs
|
|
|
|
JetBrains added experimental support for proc-macro expansion in April 2021.
|
|
This feature must be enabled before it can be used.
|
|
[See the blog post here.](https://blog.jetbrains.com/rust/2021/04/08/intellij-rust-updates-for-2021-1/#proc-macros)
|
|
|
|
This still won't enable HTML autofill and formatting help, although it will enable variable resolution for
|
|
component names and attributes inside the macro.
|
|
Utilities like Rename, Go to Declaration, Find Usages will work inside the macro.
|
|
|
|
### VS Code
|
|
|
|
#### Rust-Yew extension
|
|
|
|
> This is a **work in progress**, and **community maintained** project! [Please see details and direct related bug reports / issues / questions over to the extension's repository](https://github.com/TechTheAwesome/code-yew-server)
|
|
|
|
Rust-Yew extension is [available on VSC Marketplace](https://marketplace.visualstudio.com/items?itemName=TechTheAwesome.rust-yew), providing syntax highlight, renames, hover, and more.
|
|
|
|
Emmet support should work out of the box, if not please fall back to editing the `settings.json` file:
|
|
|
|
```json
|
|
"emmet.includeLanguages": {
|
|
"rust": "html",
|
|
}
|
|
```
|
|
|
|
### Neovim
|
|
|
|
#### Lazyvim
|
|
|
|
> Below configuration works with [LazyVim](https://www.lazyvim.org) configuration and lazy.vim plugin, create a file in `lua/plugins/nvim-lspconfig.lua` (or update your `lspconfig`) with:
|
|
|
|
```json
|
|
return {
|
|
{
|
|
"neovim/nvim-lspconfig",
|
|
init_options = {
|
|
userLanguages = {
|
|
eelixir = "html-eex",
|
|
eruby = "erb",
|
|
rust = "html",
|
|
},
|
|
},
|
|
},
|
|
}
|
|
```
|