Unnamed repository; edit this file 'description' to name the repository.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
//! Code common to structs, unions, and enum variants.

use crate::context::CompletionContext;
use hir::{db::HirDatabase, sym, HasAttrs, HasCrate, HasVisibility, HirDisplay, StructKind};
use ide_db::SnippetCap;
use itertools::Itertools;
use syntax::{Edition, SmolStr};

/// A rendered struct, union, or enum variant, split into fields for actual
/// auto-completion (`literal`, using `field: ()`) and display in the
/// completions menu (`detail`, using `field: type`).
pub(crate) struct RenderedLiteral {
    pub(crate) literal: String,
    pub(crate) detail: String,
}

/// Render a record type (or sub-type) to a `RenderedCompound`. Use `None` for
/// the `name` argument for an anonymous type.
pub(crate) fn render_record_lit(
    db: &dyn HirDatabase,
    snippet_cap: Option<SnippetCap>,
    fields: &[hir::Field],
    path: &str,
    edition: Edition,
) -> RenderedLiteral {
    if snippet_cap.is_none() {
        return RenderedLiteral { literal: path.to_owned(), detail: path.to_owned() };
    }
    let completions = fields.iter().enumerate().format_with(", ", |(idx, field), f| {
        if snippet_cap.is_some() {
            f(&format_args!(
                "{}: ${{{}:()}}",
                field.name(db).display(db.upcast(), edition),
                idx + 1
            ))
        } else {
            f(&format_args!("{}: ()", field.name(db).display(db.upcast(), edition)))
        }
    });

    let types = fields.iter().format_with(", ", |field, f| {
        f(&format_args!(
            "{}: {}",
            field.name(db).display(db.upcast(), edition),
            field.ty(db).display(db, edition)
        ))
    });

    RenderedLiteral {
        literal: format!("{path} {{ {completions} }}"),
        detail: format!("{path} {{ {types} }}"),
    }
}

/// Render a tuple type (or sub-type) to a `RenderedCompound`. Use `None` for
/// the `name` argument for an anonymous type.
pub(crate) fn render_tuple_lit(
    db: &dyn HirDatabase,
    snippet_cap: Option<SnippetCap>,
    fields: &[hir::Field],
    path: &str,
    edition: Edition,
) -> RenderedLiteral {
    if snippet_cap.is_none() {
        return RenderedLiteral { literal: path.to_owned(), detail: path.to_owned() };
    }
    let completions = fields.iter().enumerate().format_with(", ", |(idx, _), f| {
        if snippet_cap.is_some() {
            f(&format_args!("${{{}:()}}", idx + 1))
        } else {
            f(&format_args!("()"))
        }
    });

    let types = fields.iter().format_with(", ", |field, f| f(&field.ty(db).display(db, edition)));

    RenderedLiteral {
        literal: format!("{path}({completions})"),
        detail: format!("{path}({types})"),
    }
}

/// Find all the visible fields in a given list. Returns the list of visible
/// fields, plus a boolean for whether the list is comprehensive (contains no
/// private fields and its item is not marked `#[non_exhaustive]`).
pub(crate) fn visible_fields(
    ctx: &CompletionContext<'_>,
    fields: &[hir::Field],
    item: impl HasAttrs + HasCrate + Copy,
) -> Option<(Vec<hir::Field>, bool)> {
    let module = ctx.module;
    let n_fields = fields.len();
    let fields = fields
        .iter()
        .filter(|field| field.is_visible_from(ctx.db, module))
        .copied()
        .collect::<Vec<_>>();
    let has_invisible_field = n_fields - fields.len() > 0;
    let is_foreign_non_exhaustive = item.attrs(ctx.db).by_key(&sym::non_exhaustive).exists()
        && item.krate(ctx.db) != module.krate();
    let fields_omitted = has_invisible_field || is_foreign_non_exhaustive;
    Some((fields, fields_omitted))
}

/// Format a struct, etc. literal option for display in the completions menu.
pub(crate) fn format_literal_label(
    name: &str,
    kind: StructKind,
    snippet_cap: Option<SnippetCap>,
) -> SmolStr {
    if snippet_cap.is_none() {
        return name.into();
    }
    match kind {
        StructKind::Tuple => SmolStr::from_iter([name, "(…)"]),
        StructKind::Record => SmolStr::from_iter([name, " {…}"]),
        StructKind::Unit => name.into(),
    }
}

/// Format a struct, etc. literal option for lookup used in completions filtering.
pub(crate) fn format_literal_lookup(name: &str, kind: StructKind) -> SmolStr {
    match kind {
        StructKind::Tuple => SmolStr::from_iter([name, "()"]),
        StructKind::Record => SmolStr::from_iter([name, "{}"]),
        StructKind::Unit => name.into(),
    }
}
a id='n308' href='#n308'>308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645
## rust-analyzer.assist.emitMustUse {#assist.emitMustUse}

Default: `false`

Insert #[must_use] when generating `as_` methods for enum variants.


## rust-analyzer.assist.expressionFillDefault {#assist.expressionFillDefault}

Default: `"todo"`

Placeholder expression to use for missing expressions in assists.


## rust-analyzer.assist.preferSelf {#assist.preferSelf}

Default: `false`

Prefer to use `Self` over the type name when inserting a type (e.g. in "fill match arms" assist).


## rust-analyzer.assist.termSearch.borrowcheck {#assist.termSearch.borrowcheck}

Default: `true`

Enable borrow checking for term search code assists. If set to false, also there will be
more suggestions, but some of them may not borrow-check.


## rust-analyzer.assist.termSearch.fuel {#assist.termSearch.fuel}

Default: `1800`

Term search fuel in "units of work" for assists (Defaults to 1800).


## rust-analyzer.cachePriming.enable {#cachePriming.enable}

Default: `true`

Warm up caches on project load.


## rust-analyzer.cachePriming.numThreads {#cachePriming.numThreads}

Default: `"physical"`

How many worker threads to handle priming caches. The default `0` means to pick
automatically.


## rust-analyzer.cargo.allTargets {#cargo.allTargets}

Default: `true`

Pass `--all-targets` to cargo invocation.


## rust-analyzer.cargo.autoreload {#cargo.autoreload}

Default: `true`

Automatically refresh project info via `cargo metadata` on
`Cargo.toml` or `.cargo/config.toml` changes.


## rust-analyzer.cargo.buildScripts.enable {#cargo.buildScripts.enable}

Default: `true`

Run build scripts (`build.rs`) for more precise code analysis.


## rust-analyzer.cargo.buildScripts.invocationStrategy {#cargo.buildScripts.invocationStrategy}

Default: `"per_workspace"`

Specifies the invocation strategy to use when running the build scripts command.
If `per_workspace` is set, the command will be executed for each Rust workspace with the
workspace as the working directory.
If `once` is set, the command will be executed once with the opened project as the
working directory.
This config only has an effect when `#rust-analyzer.cargo.buildScripts.overrideCommand#`
is set.


## rust-analyzer.cargo.buildScripts.overrideCommand {#cargo.buildScripts.overrideCommand}

Default: `null`

Override the command rust-analyzer uses to run build scripts and
build procedural macros. The command is required to output json
and should therefore include `--message-format=json` or a similar
option.

If there are multiple linked projects/workspaces, this command is invoked for
each of them, with the working directory being the workspace root
(i.e., the folder containing the `Cargo.toml`). This can be overwritten
by changing `#rust-analyzer.cargo.buildScripts.invocationStrategy#`.

By default, a cargo invocation will be constructed for the configured
targets and features, with the following base command line:

```bash
cargo check --quiet --workspace --message-format=json --all-targets --keep-going
```

Note: The option must be specified as an array of command line arguments, with
the first argument being the name of the command to run.


## rust-analyzer.cargo.buildScripts.rebuildOnSave {#cargo.buildScripts.rebuildOnSave}

Default: `true`

Rerun proc-macros building/build-scripts running when proc-macro
or build-script sources change and are saved.


## rust-analyzer.cargo.buildScripts.useRustcWrapper {#cargo.buildScripts.useRustcWrapper}

Default: `true`

Use `RUSTC_WRAPPER=rust-analyzer` when running build scripts to
avoid checking unnecessary things.


## rust-analyzer.cargo.cfgs {#cargo.cfgs}

Default:
```json
[
  "debug_assertions",
  "miri"
]
```

List of cfg options to enable with the given values.

To enable a name without a value, use `"key"`.
To enable a name with a value, use `"key=value"`.
To disable, prefix the entry with a `!`.


## rust-analyzer.cargo.extraArgs {#cargo.extraArgs}

Default: `[]`

Extra arguments that are passed to every cargo invocation.


## rust-analyzer.cargo.extraEnv {#cargo.extraEnv}

Default: `{}`

Extra environment variables that will be set when running cargo, rustc
or other commands within the workspace. Useful for setting RUSTFLAGS.


## rust-analyzer.cargo.features {#cargo.features}

Default: `[]`

List of features to activate.

Set this to `"all"` to pass `--all-features` to cargo.


## rust-analyzer.cargo.noDefaultFeatures {#cargo.noDefaultFeatures}

Default: `false`

Whether to pass `--no-default-features` to cargo.


## rust-analyzer.cargo.noDeps {#cargo.noDeps}

Default: `false`

Whether to skip fetching dependencies. If set to "true", the analysis is performed
entirely offline, and Cargo metadata for dependencies is not fetched.


## rust-analyzer.cargo.sysroot {#cargo.sysroot}

Default: `"discover"`

Relative path to the sysroot, or "discover" to try to automatically find it via
"rustc --print sysroot".

Unsetting this disables sysroot loading.

This option does not take effect until rust-analyzer is restarted.


## rust-analyzer.cargo.sysrootSrc {#cargo.sysrootSrc}

Default: `null`

Relative path to the sysroot library sources. If left unset, this will default to
`{cargo.sysroot}/lib/rustlib/src/rust/library`.

This option does not take effect until rust-analyzer is restarted.


## rust-analyzer.cargo.target {#cargo.target}

Default: `null`

Compilation target override (target tuple).


## rust-analyzer.cargo.targetDir {#cargo.targetDir}

Default: `null`

Optional path to a rust-analyzer specific target directory.
This prevents rust-analyzer's `cargo check` and initial build-script and proc-macro
building from locking the `Cargo.lock` at the expense of duplicating build artifacts.

Set to `true` to use a subdirectory of the existing target directory or
set to a path relative to the workspace to use that path.


## rust-analyzer.cfg.setTest {#cfg.setTest}

Default: `true`

Set `cfg(test)` for local crates. Defaults to true.


## rust-analyzer.checkOnSave {#checkOnSave}

Default: `true`

Run the check command for diagnostics on save.


## rust-analyzer.check.allTargets {#check.allTargets}

Default: `null`

Check all targets and tests (`--all-targets`). Defaults to
`#rust-analyzer.cargo.allTargets#`.


## rust-analyzer.check.command {#check.command}

Default: `"check"`

Cargo command to use for `cargo check`.


## rust-analyzer.check.extraArgs {#check.extraArgs}

Default: `[]`

Extra arguments for `cargo check`.


## rust-analyzer.check.extraEnv {#check.extraEnv}

Default: `{}`

Extra environment variables that will be set when running `cargo check`.
Extends `#rust-analyzer.cargo.extraEnv#`.


## rust-analyzer.check.features {#check.features}

Default: `null`

List of features to activate. Defaults to
`#rust-analyzer.cargo.features#`.

Set to `"all"` to pass `--all-features` to Cargo.


## rust-analyzer.check.ignore {#check.ignore}

Default: `[]`

List of `cargo check` (or other command specified in `check.command`) diagnostics to ignore.

For example for `cargo check`: `dead_code`, `unused_imports`, `unused_variables`,...


## rust-analyzer.check.invocationStrategy {#check.invocationStrategy}

Default: `"per_workspace"`

Specifies the invocation strategy to use when running the check command.
If `per_workspace` is set, the command will be executed for each workspace.
If `once` is set, the command will be executed once.
This config only has an effect when `#rust-analyzer.check.overrideCommand#`
is set.


## rust-analyzer.check.noDefaultFeatures {#check.noDefaultFeatures}

Default: `null`

Whether to pass `--no-default-features` to Cargo. Defaults to
`#rust-analyzer.cargo.noDefaultFeatures#`.


## rust-analyzer.check.overrideCommand {#check.overrideCommand}

Default: `null`

Override the command rust-analyzer uses instead of `cargo check` for
diagnostics on save. The command is required to output json and
should therefore include `--message-format=json` or a similar option
(if your client supports the `colorDiagnosticOutput` experimental
capability, you can use `--message-format=json-diagnostic-rendered-ansi`).

If you're changing this because you're using some tool wrapping
Cargo, you might also want to change
`#rust-analyzer.cargo.buildScripts.overrideCommand#`.

If there are multiple linked projects/workspaces, this command is invoked for
each of them, with the working directory being the workspace root
(i.e., the folder containing the `Cargo.toml`). This can be overwritten
by changing `#rust-analyzer.check.invocationStrategy#`.

If `$saved_file` is part of the command, rust-analyzer will pass
the absolute path of the saved file to the provided command. This is
intended to be used with non-Cargo build systems.
Note that `$saved_file` is experimental and may be removed in the future.

An example command would be:

```bash
cargo check --workspace --message-format=json --all-targets
```

Note: The option must be specified as an array of command line arguments, with
the first argument being the name of the command to run.


## rust-analyzer.check.targets {#check.targets}

Default: `null`

Check for specific targets. Defaults to `#rust-analyzer.cargo.target#` if empty.

Can be a single target, e.g. `"x86_64-unknown-linux-gnu"` or a list of targets, e.g.
`["aarch64-apple-darwin", "x86_64-apple-darwin"]`.

Aliased as `"checkOnSave.targets"`.


## rust-analyzer.check.workspace {#check.workspace}

Default: `true`

Whether `--workspace` should be passed to `cargo check`.
If false, `-p <package>` will be passed instead if applicable. In case it is not, no
check will be performed.


## rust-analyzer.completion.addSemicolonToUnit {#completion.addSemicolonToUnit}

Default: `true`

Automatically add a semicolon when completing unit-returning functions.

In `match` arms it completes a comma instead.


## rust-analyzer.completion.autoAwait.enable {#completion.autoAwait.enable}

Default: `true`

Show method calls and field accesses completions with `await` prefixed to them when
completing on a future.


## rust-analyzer.completion.autoIter.enable {#completion.autoIter.enable}

Default: `true`

Show method call completions with `iter()` or `into_iter()` prefixed to them when
completing on a type that has them.


## rust-analyzer.completion.autoimport.enable {#completion.autoimport.enable}

Default: `true`

Show completions that automatically add imports when completed.

Note that your client must specify the `additionalTextEdits` LSP client capability to
truly have this feature enabled.


## rust-analyzer.completion.autoimport.exclude {#completion.autoimport.exclude}

Default:
```json
[
  {
    "path": "core::borrow::Borrow",
    "type": "methods"
  },
  {
    "path": "core::borrow::BorrowMut",
    "type": "methods"
  }
]
```

A list of full paths to items to exclude from auto-importing completions.

Traits in this list won't have their methods suggested in completions unless the trait
is in scope.

You can either specify a string path which defaults to type "always" or use the more
verbose form `{ "path": "path::to::item", type: "always" }`.

For traits the type "methods" can be used to only exclude the methods but not the trait
itself.

This setting also inherits `#rust-analyzer.completion.excludeTraits#`.


## rust-analyzer.completion.autoself.enable {#completion.autoself.enable}

Default: `true`

Show method calls and field access completions with `self` prefixed to them when
inside a method.


## rust-analyzer.completion.callable.snippets {#completion.callable.snippets}

Default: `"fill_arguments"`

Add parenthesis and argument snippets when completing function.


## rust-analyzer.completion.excludeTraits {#completion.excludeTraits}

Default: `[]`

A list of full paths to traits whose methods to exclude from completion.

Methods from these traits won't be completed, even if the trait is in scope. However,
they will still be suggested on expressions whose type is `dyn Trait`, `impl Trait` or
`T where T: Trait`.

Note that the trait themselves can still be completed.


## rust-analyzer.completion.fullFunctionSignatures.enable {#completion.fullFunctionSignatures.enable}

Default: `false`

Show full function / method signatures in completion docs.


## rust-analyzer.completion.hideDeprecated {#completion.hideDeprecated}

Default: `false`

Omit deprecated items from completions. By default they are marked as deprecated but not
hidden.


## rust-analyzer.completion.limit {#completion.limit}

Default: `null`

Maximum number of completions to return. If `None`, the limit is infinite.


## rust-analyzer.completion.postfix.enable {#completion.postfix.enable}

Default: `true`

Show postfix snippets like `dbg`, `if`, `not`, etc.


## rust-analyzer.completion.privateEditable.enable {#completion.privateEditable.enable}

Default: `false`

Show completions of private items and fields that are defined in the current workspace
even if they are not visible at the current position.


## rust-analyzer.completion.snippets.custom {#completion.snippets.custom}

Default:
```json
{
  "Ok": {
    "postfix": "ok",
    "body": "Ok(${receiver})",
    "description": "Wrap the expression in a `Result::Ok`",
    "scope": "expr"
  },
  "Box::pin": {
    "postfix": "pinbox",
    "body": "Box::pin(${receiver})",
    "requires": "std::boxed::Box",
    "description": "Put the expression into a pinned `Box`",
    "scope": "expr"
  },
  "Arc::new": {
    "postfix": "arc",
    "body": "Arc::new(${receiver})",
    "requires": "std::sync::Arc",
    "description": "Put the expression into an `Arc`",
    "scope": "expr"
  },
  "Some": {
    "postfix": "some",
    "body": "Some(${receiver})",
    "description": "Wrap the expression in an `Option::Some`",
    "scope": "expr"
  },
  "Err": {
    "postfix": "err",
    "body": "Err(${receiver})",
    "description": "Wrap the expression in a `Result::Err`",
    "scope": "expr"
  },
  "Rc::new": {
    "postfix": "rc",
    "body": "Rc::new(${receiver})",
    "requires": "std::rc::Rc",
    "description": "Put the expression into an `Rc`",
    "scope": "expr"
  }
}
```

Custom completion snippets.


## rust-analyzer.completion.termSearch.enable {#completion.termSearch.enable}

Default: `false`

Enable term search based snippets like `Some(foo.bar().baz())`.


## rust-analyzer.completion.termSearch.fuel {#completion.termSearch.fuel}

Default: `1000`

Term search fuel in "units of work" for autocompletion (Defaults to 1000).


## rust-analyzer.diagnostics.disabled {#diagnostics.disabled}

Default: `[]`

List of rust-analyzer diagnostics to disable.


## rust-analyzer.diagnostics.enable {#diagnostics.enable}

Default: `true`

Show native rust-analyzer diagnostics.


## rust-analyzer.diagnostics.experimental.enable {#diagnostics.experimental.enable}

Default: `false`

Show experimental rust-analyzer diagnostics that might have more false positives than
usual.


## rust-analyzer.diagnostics.remapPrefix {#diagnostics.remapPrefix}

Default: `{}`

Map of prefixes to be substituted when parsing diagnostic file paths. This should be the
reverse mapping of what is passed to `rustc` as `--remap-path-prefix`.


## rust-analyzer.diagnostics.styleLints.enable {#diagnostics.styleLints.enable}

Default: `false`

Run additional style lints.


## rust-analyzer.diagnostics.warningsAsHint {#diagnostics.warningsAsHint}

Default: `[]`

List of warnings that should be displayed with hint severity.

The warnings will be indicated by faded text or three dots in code and will not show up
in the `Problems Panel`.


## rust-analyzer.diagnostics.warningsAsInfo {#diagnostics.warningsAsInfo}

Default: `[]`

List of warnings that should be displayed with info severity.

The warnings will be indicated by a blue squiggly underline in code and a blue icon in
the `Problems Panel`.


## rust-analyzer.document.symbol.search.excludeLocals {#document.symbol.search.excludeLocals}

Default: `true`

Exclude all locals from document symbol search.


## rust-analyzer.files.exclude {#files.exclude}

Default: `[]`

List of files to ignore

These paths (file/directories) will be ignored by rust-analyzer. They are relative to
the workspace root, and globs are not supported. You may also need to add the folders to
Code's `files.watcherExclude`.


## rust-analyzer.files.watcher {#files.watcher}

Default: `"client"`

Controls file watching implementation.


## rust-analyzer.highlightRelated.branchExitPoints.enable {#highlightRelated.branchExitPoints.enable}

Default: `true`

Highlight related return values while the cursor is on any `match`, `if`, or match arm
arrow (`=>`).


## rust-analyzer.highlightRelated.breakPoints.enable {#highlightRelated.breakPoints.enable}

Default: `true`

Highlight related references while the cursor is on `break`, `loop`, `while`, or `for`
keywords.


## rust-analyzer.highlightRelated.closureCaptures.enable {#highlightRelated.closureCaptures.enable}

Default: `true`

Highlight all captures of a closure while the cursor is on the `|` or move keyword of a closure.


## rust-analyzer.highlightRelated.exitPoints.enable {#highlightRelated.exitPoints.enable}

Default: `true`

Highlight all exit points while the cursor is on any `return`, `?`, `fn`, or return type
arrow (`->`).


## rust-analyzer.highlightRelated.references.enable {#highlightRelated.references.enable}

Default: `true`

Highlight related references while the cursor is on any identifier.


## rust-analyzer.highlightRelated.yieldPoints.enable {#highlightRelated.yieldPoints.enable}

Default: `true`

Highlight all break points for a loop or block context while the cursor is on any
`async` or `await` keywords.


## rust-analyzer.hover.actions.debug.enable {#hover.actions.debug.enable}

Default: `true`

Show `Debug` action. Only applies when `#rust-analyzer.hover.actions.enable#` is set.


## rust-analyzer.hover.actions.enable {#hover.actions.enable}

Default: `true`

Show HoverActions in Rust files.


## rust-analyzer.hover.actions.gotoTypeDef.enable {#hover.actions.gotoTypeDef.enable}

Default: `true`

Show `Go to Type Definition` action. Only applies when
`#rust-analyzer.hover.actions.enable#` is set.


## rust-analyzer.hover.actions.implementations.enable {#hover.actions.implementations.enable}

Default: `true`

Show `Implementations` action. Only applies when `#rust-analyzer.hover.actions.enable#`
is set.


## rust-analyzer.hover.actions.references.enable {#hover.actions.references.enable}

Default: `false`

Show `References` action. Only applies when `#rust-analyzer.hover.actions.enable#` is
set.


## rust-analyzer.hover.actions.run.enable {#hover.actions.run.enable}

Default: `true`

Show `Run` action. Only applies when `#rust-analyzer.hover.actions.enable#` is set.


## rust-analyzer.hover.actions.updateTest.enable {#hover.actions.updateTest.enable}

Default: `true`

Show `Update Test` action. Only applies when `#rust-analyzer.hover.actions.enable#` and
`#rust-analyzer.hover.actions.run.enable#` are set.


## rust-analyzer.hover.documentation.enable {#hover.documentation.enable}

Default: `true`

Show documentation on hover.


## rust-analyzer.hover.documentation.keywords.enable {#hover.documentation.keywords.enable}

Default: `true`

Show keyword hover popups. Only applies when
`#rust-analyzer.hover.documentation.enable#` is set.


## rust-analyzer.hover.dropGlue.enable {#hover.dropGlue.enable}

Default: `true`

Show drop glue information on hover.


## rust-analyzer.hover.links.enable {#hover.links.enable}

Default: `true`

Use markdown syntax for links on hover.


## rust-analyzer.hover.maxSubstitutionLength {#hover.maxSubstitutionLength}

Default: `20`

Show what types are used as generic arguments in calls etc. on hover, and limit the max
length to show such types, beyond which they will be shown with ellipsis.

This can take three values: `null` means "unlimited", the string `"hide"` means to not
show generic substitutions at all, and a number means to limit them to X characters.

The default is 20 characters.


## rust-analyzer.hover.memoryLayout.alignment {#hover.memoryLayout.alignment}

Default: `"hexadecimal"`

How to render the align information in a memory layout hover.


## rust-analyzer.hover.memoryLayout.enable {#hover.memoryLayout.enable}

Default: `true`

Show memory layout data on hover.


## rust-analyzer.hover.memoryLayout.niches {#hover.memoryLayout.niches}

Default: `false`

How to render the niche information in a memory layout hover.


## rust-analyzer.hover.memoryLayout.offset {#hover.memoryLayout.offset}

Default: `"hexadecimal"`

How to render the offset information in a memory layout hover.


## rust-analyzer.hover.memoryLayout.padding {#hover.memoryLayout.padding}

Default: `null`

How to render the padding information in a memory layout hover.


## rust-analyzer.hover.memoryLayout.size {#hover.memoryLayout.size}

Default: `"both"`

How to render the size information in a memory layout hover.


## rust-analyzer.hover.show.enumVariants {#hover.show.enumVariants}

Default: `5`

How many variants of an enum to display when hovering on. Show none if empty.


## rust-analyzer.hover.show.fields {#hover.show.fields}

Default: `5`

How many fields of a struct, variant or union to display when hovering on. Show none if
empty.


## rust-analyzer.hover.show.traitAssocItems {#hover.show.traitAssocItems}

Default: `null`

How many associated items of a trait to display when hovering a trait.


## rust-analyzer.imports.granularity.enforce {#imports.granularity.enforce}

Default: `false`

Enforce the import granularity setting for all files. If set to false rust-analyzer will
try to keep import styles consistent per file.


## rust-analyzer.imports.granularity.group {#imports.granularity.group}

Default: `"crate"`

How imports should be grouped into use statements.


## rust-analyzer.imports.group.enable {#imports.group.enable}

Default: `true`

Group inserted imports by the [following
order](https://rust-analyzer.github.io/book/features.html#auto-import). Groups are
separated by newlines.


## rust-analyzer.imports.merge.glob {#imports.merge.glob}

Default: `true`

Allow import insertion to merge new imports into single path glob imports like `use
std::fmt::*;`.


## rust-analyzer.imports.preferNoStd {#imports.preferNoStd}

Default: `false`

Prefer to unconditionally use imports of the core and alloc crate, over the std crate.


## rust-analyzer.imports.preferPrelude {#imports.preferPrelude}

Default: `false`

Prefer import paths containing a `prelude` module.


## rust-analyzer.imports.prefix {#imports.prefix}

Default: `"crate"`

The path structure for newly inserted paths to use.


## rust-analyzer.imports.prefixExternPrelude {#imports.prefixExternPrelude}

Default: `false`

Prefix external (including std, core) crate imports with `::`.

E.g. `use ::std::io::Read;`.


## rust-analyzer.inlayHints.bindingModeHints.enable {#inlayHints.bindingModeHints.enable}

Default: `false`

Show inlay type hints for binding modes.


## rust-analyzer.inlayHints.chainingHints.enable {#inlayHints.chainingHints.enable}

Default: `true`

Show inlay type hints for method chains.


## rust-analyzer.inlayHints.closingBraceHints.enable {#inlayHints.closingBraceHints.enable}

Default: `true`

Show inlay hints after a closing `}` to indicate what item it belongs to.


## rust-analyzer.inlayHints.closingBraceHints.minLines {#inlayHints.closingBraceHints.minLines}

Default: `25`

Minimum number of lines required before the `}` until the hint is shown (set to 0 or 1
to always show them).


## rust-analyzer.inlayHints.closureCaptureHints.enable {#inlayHints.closureCaptureHints.enable}

Default: `false`

Show inlay hints for closure captures.


## rust-analyzer.inlayHints.closureReturnTypeHints.enable {#inlayHints.closureReturnTypeHints.enable}

Default: `"never"`

Show inlay type hints for return types of closures.


## rust-analyzer.inlayHints.closureStyle {#inlayHints.closureStyle}

Default: `"impl_fn"`

Closure notation in type and chaining inlay hints.


## rust-analyzer.inlayHints.discriminantHints.enable {#inlayHints.discriminantHints.enable}

Default: `"never"`

Show enum variant discriminant hints.


## rust-analyzer.inlayHints.expressionAdjustmentHints.disableReborrows {#inlayHints.expressionAdjustmentHints.disableReborrows}

Default: `true`

Disable reborrows in expression adjustments inlay hints.

Reborrows are a pair of a builtin deref then borrow, i.e. `&*`. They are inserted by the compiler but are mostly useless to the programmer.

Note: if the deref is not builtin (an overloaded deref), or the borrow is `&raw const`/`&raw mut`, they are not removed.


## rust-analyzer.inlayHints.expressionAdjustmentHints.enable {#inlayHints.expressionAdjustmentHints.enable}

Default: `"never"`

Show inlay hints for type adjustments.


## rust-analyzer.inlayHints.expressionAdjustmentHints.hideOutsideUnsafe {#inlayHints.expressionAdjustmentHints.hideOutsideUnsafe}

Default: `false`

Hide inlay hints for type adjustments outside of `unsafe` blocks.


## rust-analyzer.inlayHints.expressionAdjustmentHints.mode {#inlayHints.expressionAdjustmentHints.mode}

Default: `"prefix"`

Show inlay hints as postfix ops (`.*` instead of `*`, etc).


## rust-analyzer.inlayHints.genericParameterHints.const.enable {#inlayHints.genericParameterHints.const.enable}

Default: `true`

Show const generic parameter name inlay hints.


## rust-analyzer.inlayHints.genericParameterHints.lifetime.enable {#inlayHints.genericParameterHints.lifetime.enable}

Default: `false`

Show generic lifetime parameter name inlay hints.


## rust-analyzer.inlayHints.genericParameterHints.type.enable {#inlayHints.genericParameterHints.type.enable}

Default: `false`

Show generic type parameter name inlay hints.


## rust-analyzer.inlayHints.implicitDrops.enable {#inlayHints.implicitDrops.enable}

Default: `false`

Show implicit drop hints.


## rust-analyzer.inlayHints.implicitSizedBoundHints.enable {#inlayHints.implicitSizedBoundHints.enable}

Default: `false`

Show inlay hints for the implied type parameter `Sized` bound.


## rust-analyzer.inlayHints.lifetimeElisionHints.enable {#inlayHints.lifetimeElisionHints.enable}

Default: `"never"`

Show inlay type hints for elided lifetimes in function signatures.


## rust-analyzer.inlayHints.lifetimeElisionHints.useParameterNames {#inlayHints.lifetimeElisionHints.useParameterNames}

Default: `false`

Prefer using parameter names as the name for elided lifetime hints if possible.


## rust-analyzer.inlayHints.maxLength {#inlayHints.maxLength}

Default: `25`

Maximum length for inlay hints. Set to null to have an unlimited length.

**Note:** This is mostly a hint, and we don't guarantee to strictly follow the limit.


## rust-analyzer.inlayHints.parameterHints.enable {#inlayHints.parameterHints.enable}

Default: `true`

Show function parameter name inlay hints at the call site.


## rust-analyzer.inlayHints.rangeExclusiveHints.enable {#inlayHints.rangeExclusiveHints.enable}

Default: `false`

Show exclusive range inlay hints.


## rust-analyzer.inlayHints.reborrowHints.enable {#inlayHints.reborrowHints.enable}

Default: `"never"`

Show inlay hints for compiler inserted reborrows.

This setting is deprecated in favor of
#rust-analyzer.inlayHints.expressionAdjustmentHints.enable#.


## rust-analyzer.inlayHints.renderColons {#inlayHints.renderColons}

Default: `true`

Whether to render leading colons for type hints, and trailing colons for parameter hints.


## rust-analyzer.inlayHints.typeHints.enable {#inlayHints.typeHints.enable}

Default: `true`

Show inlay type hints for variables.


## rust-analyzer.inlayHints.typeHints.hideClosureInitialization {#inlayHints.typeHints.hideClosureInitialization}

Default: `false`

Hide inlay type hints for `let` statements that initialize to a closure.

Only applies to closures with blocks, same as
`#rust-analyzer.inlayHints.closureReturnTypeHints.enable#`.


## rust-analyzer.inlayHints.typeHints.hideClosureParameter {#inlayHints.typeHints.hideClosureParameter}

Default: `false`

Hide inlay parameter type hints for closures.


## rust-analyzer.inlayHints.typeHints.hideNamedConstructor {#inlayHints.typeHints.hideNamedConstructor}

Default: `false`

Hide inlay type hints for constructors.


## rust-analyzer.interpret.tests {#interpret.tests}

Default: `false`

Enable the experimental support for interpreting tests.


## rust-analyzer.joinLines.joinAssignments {#joinLines.joinAssignments}

Default: `true`

Join lines merges consecutive declaration and initialization of an assignment.


## rust-analyzer.joinLines.joinElseIf {#joinLines.joinElseIf}

Default: `true`

Join lines inserts else between consecutive ifs.


## rust-analyzer.joinLines.removeTrailingComma {#joinLines.removeTrailingComma}

Default: `true`

Join lines removes trailing commas.


## rust-analyzer.joinLines.unwrapTrivialBlock {#joinLines.unwrapTrivialBlock}

Default: `true`

Join lines unwraps trivial blocks.


## rust-analyzer.lens.debug.enable {#lens.debug.enable}

Default: `true`

Show `Debug` lens. Only applies when `#rust-analyzer.lens.enable#` is set.


## rust-analyzer.lens.enable {#lens.enable}

Default: `true`

Show CodeLens in Rust files.


## rust-analyzer.lens.implementations.enable {#lens.implementations.enable}

Default: `true`

Show `Implementations` lens. Only applies when `#rust-analyzer.lens.enable#` is set.


## rust-analyzer.lens.location {#lens.location}

Default: `"above_name"`

Where to render annotations.


## rust-analyzer.lens.references.adt.enable {#lens.references.adt.enable}

Default: `false`

Show `References` lens for Struct, Enum, and Union. Only applies when
`#rust-analyzer.lens.enable#` is set.


## rust-analyzer.lens.references.enumVariant.enable {#lens.references.enumVariant.enable}

Default: `false`

Show `References` lens for Enum Variants. Only applies when
`#rust-analyzer.lens.enable#` is set.


## rust-analyzer.lens.references.method.enable {#lens.references.method.enable}

Default: `false`

Show `Method References` lens. Only applies when `#rust-analyzer.lens.enable#` is set.


## rust-analyzer.lens.references.trait.enable {#lens.references.trait.enable}

Default: `false`

Show `References` lens for Trait. Only applies when `#rust-analyzer.lens.enable#` is
set.


## rust-analyzer.lens.run.enable {#lens.run.enable}

Default: `true`

Show `Run` lens. Only applies when `#rust-analyzer.lens.enable#` is set.


## rust-analyzer.lens.updateTest.enable {#lens.updateTest.enable}

Default: `true`

Show `Update Test` lens. Only applies when `#rust-analyzer.lens.enable#` and
`#rust-analyzer.lens.run.enable#` are set.


## rust-analyzer.linkedProjects {#linkedProjects}

Default: `[]`

Disable project auto-discovery in favor of explicitly specified set of projects.

Elements must be paths pointing to `Cargo.toml`, `rust-project.json`, `.rs` files (which
will be treated as standalone files) or JSON objects in `rust-project.json` format.


## rust-analyzer.lru.capacity {#lru.capacity}

Default: `null`

Number of syntax trees rust-analyzer keeps in memory. Defaults to 128.


## rust-analyzer.lru.query.capacities {#lru.query.capacities}

Default: `{}`

The LRU capacity of the specified queries.


## rust-analyzer.notifications.cargoTomlNotFound {#notifications.cargoTomlNotFound}

Default: `true`

Show `can't find Cargo.toml` error message.


## rust-analyzer.numThreads {#numThreads}

Default: `null`

The number of worker threads in the main loop. The default `null` means to pick
automatically.


## rust-analyzer.procMacro.attributes.enable {#procMacro.attributes.enable}

Default: `true`

Expand attribute macros. Requires `#rust-analyzer.procMacro.enable#` to be set.


## rust-analyzer.procMacro.enable {#procMacro.enable}

Default: `true`

Enable support for procedural macros, implies `#rust-analyzer.cargo.buildScripts.enable#`.


## rust-analyzer.procMacro.ignored {#procMacro.ignored}

Default: `{}`

These proc-macros will be ignored when trying to expand them.

This config takes a map of crate names with the exported proc-macro names to ignore as values.


## rust-analyzer.procMacro.server {#procMacro.server}

Default: `null`

Internal config, path to proc-macro server executable.


## rust-analyzer.references.excludeImports {#references.excludeImports}

Default: `false`

Exclude imports from find-all-references.


## rust-analyzer.references.excludeTests {#references.excludeTests}

Default: `false`

Exclude tests from find-all-references and call-hierarchy.


## rust-analyzer.runnables.command {#runnables.command}

Default: `null`

Command to be executed instead of 'cargo' for runnables.


## rust-analyzer.runnables.extraArgs {#runnables.extraArgs}

Default: `[]`

Additional arguments to be passed to cargo for runnables such as
tests or binaries. For example, it may be `--release`.


## rust-analyzer.runnables.extraTestBinaryArgs {#runnables.extraTestBinaryArgs}

Default:
```json
[
  "--nocapture"
]
```

Additional arguments to be passed through Cargo to launched tests, benchmarks, or
doc-tests.

Unless the launched target uses a
[custom test harness](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#the-harness-field),
they will end up being interpreted as options to
[`rustc`’s built-in test harness (“libtest”)](https://doc.rust-lang.org/rustc/tests/index.html#cli-arguments).


## rust-analyzer.rustc.source {#rustc.source}

Default: `null`

Path to the Cargo.toml of the rust compiler workspace, for usage in rustc_private
projects, or "discover" to try to automatically find it if the `rustc-dev` component
is installed.

Any project which uses rust-analyzer with the rustcPrivate
crates must set `[package.metadata.rust-analyzer] rustc_private=true` to use it.

This option does not take effect until rust-analyzer is restarted.


## rust-analyzer.rustfmt.extraArgs {#rustfmt.extraArgs}

Default: `[]`

Additional arguments to `rustfmt`.


## rust-analyzer.rustfmt.overrideCommand {#rustfmt.overrideCommand}

Default: `null`

Advanced option, fully override the command rust-analyzer uses for
formatting. This should be the equivalent of `rustfmt` here, and
not that of `cargo fmt`. The file contents will be passed on the
standard input and the formatted result will be read from the
standard output.

Note: The option must be specified as an array of command line arguments, with
the first argument being the name of the command to run.


## rust-analyzer.rustfmt.rangeFormatting.enable {#rustfmt.rangeFormatting.enable}

Default: `false`

Enables the use of rustfmt's unstable range formatting command for the
`textDocument/rangeFormatting` request. The rustfmt option is unstable and only
available on a nightly build.


## rust-analyzer.semanticHighlighting.comments.enable {#semanticHighlighting.comments.enable}

Default: `true`

Use semantic tokens for comments.

In some editors (e.g. vscode) semantic tokens override other highlighting grammars.
By disabling semantic tokens for comments, other grammars can be used to highlight
their contents.


## rust-analyzer.semanticHighlighting.doc.comment.inject.enable {#semanticHighlighting.doc.comment.inject.enable}

Default: `true`

Inject additional highlighting into doc comments.

When enabled, rust-analyzer will highlight rust source in doc comments as well as intra
doc links.


## rust-analyzer.semanticHighlighting.nonStandardTokens {#semanticHighlighting.nonStandardTokens}

Default: `true`

Emit non-standard tokens and modifiers

When enabled, rust-analyzer will emit tokens and modifiers that are not part of the
standard set of semantic tokens.


## rust-analyzer.semanticHighlighting.operator.enable {#semanticHighlighting.operator.enable}

Default: `true`

Use semantic tokens for operators.

When disabled, rust-analyzer will emit semantic tokens only for operator tokens when
they are tagged with modifiers.


## rust-analyzer.semanticHighlighting.operator.specialization.enable {#semanticHighlighting.operator.specialization.enable}

Default: `false`

Use specialized semantic tokens for operators.

When enabled, rust-analyzer will emit special token types for operator tokens instead
of the generic `operator` token type.


## rust-analyzer.semanticHighlighting.punctuation.enable {#semanticHighlighting.punctuation.enable}

Default: `false`

Use semantic tokens for punctuation.

When disabled, rust-analyzer will emit semantic tokens only for punctuation tokens when
they are tagged with modifiers or have a special role.


## rust-analyzer.semanticHighlighting.punctuation.separate.macro.bang {#semanticHighlighting.punctuation.separate.macro.bang}

Default: `false`

When enabled, rust-analyzer will emit a punctuation semantic token for the `!` of macro
calls.


## rust-analyzer.semanticHighlighting.punctuation.specialization.enable {#semanticHighlighting.punctuation.specialization.enable}

Default: `false`

Use specialized semantic tokens for punctuation.

When enabled, rust-analyzer will emit special token types for punctuation tokens instead
of the generic `punctuation` token type.


## rust-analyzer.semanticHighlighting.strings.enable {#semanticHighlighting.strings.enable}

Default: `true`

Use semantic tokens for strings.

In some editors (e.g. vscode) semantic tokens override other highlighting grammars.
By disabling semantic tokens for strings, other grammars can be used to highlight
their contents.


## rust-analyzer.signatureInfo.detail {#signatureInfo.detail}

Default: `"full"`

Show full signature of the callable. Only shows parameters if disabled.


## rust-analyzer.signatureInfo.documentation.enable {#signatureInfo.documentation.enable}

Default: `true`

Show documentation.


## rust-analyzer.typing.triggerChars {#typing.triggerChars}

Default: `"=."`

Specify the characters allowed to invoke special on typing triggers.

- typing `=` after `let` tries to smartly add `;` if `=` is followed by an existing
  expression
- typing `=` between two expressions adds `;` when in statement position
- typing `=` to turn an assignment into an equality comparison removes `;` when in
  expression position
- typing `.` in a chain method call auto-indents
- typing `{` or `(` in front of an expression inserts a closing `}` or `)` after the
  expression
- typing `{` in a use item adds a closing `}` in the right place
- typing `>` to complete a return type `->` will insert a whitespace after it
- typing `<` in a path or type position inserts a closing `>` after the path or type.


## rust-analyzer.vfs.extraIncludes {#vfs.extraIncludes}

Default: `[]`

Additional paths to include in the VFS. Generally for code that is
generated or otherwise managed by a build system outside of Cargo,
though Cargo might be the eventual consumer.


## rust-analyzer.workspace.discoverConfig {#workspace.discoverConfig}

Default: `null`

Enables automatic discovery of projects using [`DiscoverWorkspaceConfig::command`].

[`DiscoverWorkspaceConfig`] also requires setting `progress_label` and `files_to_watch`.
`progress_label` is used for the title in progress indicators, whereas `files_to_watch`
is used to determine which build system-specific files should be watched in order to
reload rust-analyzer.

Below is an example of a valid configuration:
```json
"rust-analyzer.workspace.discoverConfig": {
    "command": [
        "rust-project",
        "develop-json"
    ],
    "progressLabel": "rust-analyzer",
    "filesToWatch": [
        "BUCK"
    ]
}
```

## On `DiscoverWorkspaceConfig::command`

**Warning**: This format is provisional and subject to change.

[`DiscoverWorkspaceConfig::command`] *must* return a JSON object corresponding to
`DiscoverProjectData::Finished`:

```norun
#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(tag = "kind")]
#[serde(rename_all = "snake_case")]
enum DiscoverProjectData {
    Finished { buildfile: Utf8PathBuf, project: ProjectJsonData },
    Error { error: String, source: Option<String> },
    Progress { message: String },
}
```

As JSON, `DiscoverProjectData::Finished` is:

```json
{
    // the internally-tagged representation of the enum.
    "kind": "finished",
    // the file used by a non-Cargo build system to define
    // a package or target.
    "buildfile": "rust-analyzer/BUILD",
    // the contents of a rust-project.json, elided for brevity
    "project": {
        "sysroot": "foo",
        "crates": []
    }
}
```

It is encouraged, but not required, to use the other variants on `DiscoverProjectData`
to provide a more polished end-user experience.

`DiscoverWorkspaceConfig::command` may *optionally* include an `{arg}`, which will be
substituted with the JSON-serialized form of the following enum:

```norun
#[derive(PartialEq, Clone, Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub enum DiscoverArgument {
   Path(AbsPathBuf),
   Buildfile(AbsPathBuf),
}
```

The JSON representation of `DiscoverArgument::Path` is:

```json
{
    "path": "src/main.rs"
}
```

Similarly, the JSON representation of `DiscoverArgument::Buildfile` is:

```json
{
    "buildfile": "BUILD"
}
```

`DiscoverArgument::Path` is used to find and generate a `rust-project.json`, and
therefore, a workspace, whereas `DiscoverArgument::buildfile` is used to to update an
existing workspace. As a reference for implementors, buck2's `rust-project` will likely
be useful: https://github.com/facebook/buck2/tree/main/integrations/rust-project.


## rust-analyzer.workspace.symbol.search.excludeImports {#workspace.symbol.search.excludeImports}

Default: `false`

Exclude all imports from workspace symbol search.

In addition to regular imports (which are always excluded),
this option removes public imports (better known as re-exports)
and removes imports that rename the imported symbol.


## rust-analyzer.workspace.symbol.search.kind {#workspace.symbol.search.kind}

Default: `"only_types"`

Workspace symbol search kind.


## rust-analyzer.workspace.symbol.search.limit {#workspace.symbol.search.limit}

Default: `128`

Limits the number of items returned from a workspace symbol search (Defaults to 128).
Some clients like vs-code issue new searches on result filtering and don't require all results to be returned in the initial search.
Other clients requires all results upfront and might require a higher limit.


## rust-analyzer.workspace.symbol.search.scope {#workspace.symbol.search.scope}

Default: `"workspace"`

Workspace symbol search scope.