You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Shows the full macro expansion of the macro at current cursor.
180
180
@@ -862,8 +862,55 @@ The `body` field also has access to placeholders as visible in the example as `$
862
862
These placeholders take the form of `$number` or `${number:placeholder_text}` which can be traversed as tabstop in ascending order starting from 1,
863
863
with `$0` being a special case that always comes last.
864
864
865
-
There is also a special placeholder, `${receiver}`, which will be replaced by the receiver expression for postfix snippets, or nothing in case of normal snippets.
866
-
It does not act as a tabstop.
865
+
There is also a special placeholder, `${receiver}`, which will be replaced by the receiver expression for postfix snippets, or a `$0` tabstop in case of normal snippets.
866
+
This replacement for normal snippets allows you to reuse a snippet for both post- and prefix in a single definition.
867
+
868
+
For the VSCode editor, rust-analyzer also ships with a small set of defaults which can be removed
869
+
by overwriting the settings object mentioned above, the defaults are:
870
+
[source,json]
871
+
----
872
+
{
873
+
"Arc::new": {
874
+
"postfix": "arc",
875
+
"body": "Arc::new(${receiver})",
876
+
"requires": "std::sync::Arc",
877
+
"description": "Put the expression into an `Arc`",
878
+
"scope": "expr"
879
+
},
880
+
"Rc::new": {
881
+
"postfix": "rc",
882
+
"body": "Rc::new(${receiver})",
883
+
"requires": "std::rc::Rc",
884
+
"description": "Put the expression into an `Rc`",
885
+
"scope": "expr"
886
+
},
887
+
"Box::pin": {
888
+
"postfix": "pinbox",
889
+
"body": "Box::pin(${receiver})",
890
+
"requires": "std::boxed::Box",
891
+
"description": "Put the expression into a pinned `Box`",
892
+
"scope": "expr"
893
+
},
894
+
"Ok": {
895
+
"postfix": "ok",
896
+
"body": "Ok(${receiver})",
897
+
"description": "Wrap the expression in a `Result::Ok`",
898
+
"scope": "expr"
899
+
},
900
+
"Err": {
901
+
"postfix": "err",
902
+
"body": "Err(${receiver})",
903
+
"description": "Wrap the expression in a `Result::Err`",
904
+
"scope": "expr"
905
+
},
906
+
"Some": {
907
+
"postfix": "some",
908
+
"body": "Some(${receiver})",
909
+
"description": "Wrap the expression in an `Option::Some`",
However, if you are using a version of the extension with a bundled server binary and you are not running NixOS, the server binary might be instead running from: `~/.vscode/extensions/matklad.rust-analyzer-VERSION`.
78
+
77
79
Note that we only support two most recent versions of VS Code.
78
80
79
81
==== Updates
@@ -445,7 +447,7 @@ If the date is more than a week ago, it's better to update rust-analyzer version
445
447
446
448
The next thing to check would be panic messages in rust-analyzer's log.
447
449
Log messages are printed to stderr, in VS Code you can see then in the `Output > Rust Analyzer Language Server` tab of the panel.
448
-
To see more logs, set `RA_LOG=info` environmental variable.
450
+
To see more logs, set the `RA_LOG=info` environment variable, this can be done either by setting the environment variable manually or by using `rust-analyzer.server.extraEnv`, note that both of these approaches require the server to be restarted.
449
451
450
452
To fully capture LSP messages between the editor and the server, set `"rust-analyzer.trace.server": "verbose"` config and check
451
453
`Output > Rust Analyzer Language Server Trace`.
@@ -624,7 +626,7 @@ Relative paths are interpreted relative to `rust-project.json` file location or
624
626
625
627
See https://github.com/rust-analyzer/rust-project.json-example for a small example.
626
628
627
-
You can set `RA_LOG` environmental variable to `rust_analyzer=info` to inspect how rust-analyzer handles config and project loading.
629
+
You can set the `RA_LOG` environment variable to `rust_analyzer=info` to inspect how rust-analyzer handles config and project loading.
628
630
629
631
Note that calls to `cargo check` are disabled when using `rust-project.json` by default, so compilation errors and warnings will no longer be sent to your LSP client. To enable these compilation errors you will need to specify explicitly what command rust-analyzer should run to perform the checks using the `checkOnSave.overrideCommand` configuration. As an example, the following configuration explicitly sets `cargo check` as the `checkOnSave` command.
0 commit comments