Skip to content

Commit

Permalink
Editing fixes on Editor Setup page (#2397)
Browse files Browse the repository at this point in the history
* Editing fixes on Editor Setup page

- "Jetbrains" fixed to "Jetbrains"
- fixed some typos and grammatical errors
- improved sentence flow

* Space before ignore attribute
  • Loading branch information
allan2 authored Jan 24, 2022
1 parent 38021e3 commit 31afa9d
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions website/docs/getting-started/editor-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,17 @@ description: "Setting your code editor"
---

:::important contribute
This document only contains information for adding supporting in Jetbrains IDEs and VS Code.
Feel free to contribute to add instructions for your editor of choice.
Using a different editor? Feel free to add instructions for your editor of choice.
:::

## Add a template for creating components

### Jetbrains IDEs
### JetBrains IDEs

1. Navigate to File | Settings | Editor | Live Templates.
2. Select Rust and click on + icon to add a new Live Template.
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 in Template Text section
4. Paste the following snippet in Template Text section.
5. Change the applicability on the lower right, select Rust > Item > Module
```rust ,ignore
use yew::prelude::*;
Expand All @@ -41,7 +40,7 @@ impl Component for $NAME$ {
}
```

For functional components, use the template below. Additionaly:
For function components, use the template below. Additionally:

1. Click on Edit Variable
2. In the `func_name` row, set the Expression column to `snakeCase(NAME)` so that `ComponentName` will be automatically
Expand All @@ -57,16 +56,12 @@ pub struct $Name$Props {

#[function_component($Name$)]
pub fn $func_name$(props: &$Name$Props) -> Html {


html! {
<$tag$>$END$</$tag$>
}
}
```



### VS Code

1. Navigate to File > Preferences > User Snippets.
Expand Down Expand Up @@ -100,27 +95,27 @@ pub fn $func_name$(props: &$Name$Props) -> Html {
" }",
"}"
],
"description": "Create a new Yew component without properties but with a message enum"
"description": "Create a new Yew component with a message enum"
}
}

```

## Support for the `html!` Macro

### Jetbrains IDEs
### JetBrains IDEs

Since April 2021, Jetbrains has started to support proc-macro expansion as an experimental feature.
The user has to manually enable it.
[See the post here.](https://blog.jetbrains.com/rust/2021/04/08/intellij-rust-updates-for-2021-1/#proc-macros)
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, but will enable variable resolution for
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

There's no support for specialized syntax of `html!` but you can use the default HTML IntelliSense by adding the following snippet in your VS Code's `settings.json` file:
There isn't support for the specialized syntax of `html!`. However, the default HTML IntelliSense can be used by adding this to your `settings.json` file:

```json
"emmet.includeLanguages": {
Expand Down

1 comment on commit 31afa9d

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yew master branch benchmarks (Lower is better)

Benchmark suite Current: 31afa9d Previous: 38021e3 Ratio
yew-struct-keyed 01_run1k 269.2845 234.656 1.15
yew-struct-keyed 02_replace1k 255.614 237.4175 1.08
yew-struct-keyed 03_update10th1k_x16 444.468 394.1925 1.13
yew-struct-keyed 04_select1k 86.78399999999999 75.9405 1.14
yew-struct-keyed 05_swap1k 101.038 107.9565 0.94
yew-struct-keyed 06_remove-one-1k 34.5415 34.7085 1.00
yew-struct-keyed 07_create10k 2831.4849999999997 2313.8295 1.22
yew-struct-keyed 08_create1k-after1k_x2 586.5625 447.7525 1.31
yew-struct-keyed 09_clear1k_x8 260.2425 217.9425 1.19
yew-struct-keyed 21_ready-memory 0.9634513854980468 0.9634513854980468 1
yew-struct-keyed 22_run-memory 1.5034751892089844 1.4999732971191406 1.00
yew-struct-keyed 23_update5-memory 1.5043830871582031 1.5032615661621094 1.00
yew-struct-keyed 24_run5-memory 1.5091552734375 1.510845184326172 1.00
yew-struct-keyed 25_run-clear-memory 1.1287879943847656 1.1258888244628906 1.00
yew-struct-keyed 31_startup-ci 1733.726 1886.865 0.92
yew-struct-keyed 32_startup-bt 39.80199999999999 39.49799999999999 1.01
yew-struct-keyed 34_startup-totalbytes 365.9482421875 365.94140625 1.00

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.