aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/release.yaml114
-rw-r--r--crates/rust-analyzer/src/config.rs34
-rw-r--r--docs/user/generated_config.adoc26
-rw-r--r--editors/code/package.json50
-rw-r--r--editors/code/src/main.ts20
-rw-r--r--xtask/src/dist.rs72
6 files changed, 224 insertions, 92 deletions
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 919d58925..09752b817 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -15,12 +15,9 @@ env:
15 RUSTUP_MAX_RETRIES: 10 15 RUSTUP_MAX_RETRIES: 10
16 16
17jobs: 17jobs:
18 dist: 18 dist-windows:
19 name: dist 19 name: dist (Windows)
20 runs-on: ${{ matrix.os }} 20 runs-on: windows-latest
21 strategy:
22 matrix:
23 os: [ubuntu-16.04, windows-latest, macos-latest]
24 21
25 steps: 22 steps:
26 - name: Checkout repository 23 - name: Checkout repository
@@ -30,8 +27,7 @@ jobs:
30 # which takes a long time. The fastest way to do this is to rename the 27 # which takes a long time. The fastest way to do this is to rename the
31 # existing folder, as deleting it takes about as much time as not doing 28 # existing folder, as deleting it takes about as much time as not doing
32 # anything and just updating rust-docs. 29 # anything and just updating rust-docs.
33 - name: Rename existing rust toolchain (Windows) 30 - name: Rename existing rust toolchain
34 if: matrix.os == 'windows-latest'
35 run: Rename-Item C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc.old 31 run: Rename-Item C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc.old
36 32
37 - name: Install Rust toolchain 33 - name: Install Rust toolchain
@@ -41,38 +37,116 @@ jobs:
41 profile: minimal 37 profile: minimal
42 override: true 38 override: true
43 39
40 - name: Dist
41 run: cargo xtask dist
42 env:
43 RA_TARGET: x86_64-pc-windows-msvc
44
45 - name: Upload artifacts
46 uses: actions/upload-artifact@v1
47 with:
48 name: dist-windows-latest
49 path: ./dist
50
51 dist-ubuntu:
52 name: dist (Ubuntu 16.04)
53 runs-on: ubuntu-16.04
54
55 steps:
56 - name: Checkout repository
57 uses: actions/checkout@v2
58
59 - name: Install Rust toolchain
60 uses: actions-rs/toolchain@v1
61 with:
62 toolchain: stable
63 profile: minimal
64 override: true
65
44 - name: Install Nodejs 66 - name: Install Nodejs
45 if: matrix.os == 'ubuntu-16.04'
46 uses: actions/setup-node@v1 67 uses: actions/setup-node@v1
47 with: 68 with:
48 node-version: 12.x 69 node-version: 12.x
49 70
50 - name: Dist 71 - name: Dist
51 if: matrix.os == 'ubuntu-16.04' && github.ref == 'refs/heads/release' 72 if: github.ref == 'refs/heads/release'
52 run: cargo xtask dist --client 0.2.$GITHUB_RUN_NUMBER 73 run: cargo xtask dist --client 0.2.$GITHUB_RUN_NUMBER
74 env:
75 RA_TARGET: x86_64-unknown-linux-gnu
53 76
54 - name: Dist 77 - name: Dist
55 if: matrix.os == 'ubuntu-16.04' && github.ref != 'refs/heads/release' 78 if: github.ref != 'refs/heads/release'
56 run: cargo xtask dist --nightly --client 0.3.$GITHUB_RUN_NUMBER-nightly 79 run: cargo xtask dist --nightly --client 0.3.$GITHUB_RUN_NUMBER-nightly
80 env:
81 RA_TARGET: x86_64-unknown-linux-gnu
82
83 - name: Nightly analysis-stats check
84 if: github.ref != 'refs/heads/release'
85 run: ./dist/rust-analyzer-x86_64-unknown-linux-gnu analysis-stats .
86
87 - name: Upload artifacts
88 uses: actions/upload-artifact@v1
89 with:
90 name: dist-ubuntu-16.04
91 path: ./dist
92
93 dist-macos-latest:
94 name: dist (MacOS latest)
95 runs-on: macos-latest
96
97 steps:
98 - name: Checkout repository
99 uses: actions/checkout@v2
100
101 - name: Install Rust toolchain
102 uses: actions-rs/toolchain@v1
103 with:
104 toolchain: stable
105 profile: minimal
106 override: true
57 107
58 - name: Dist 108 - name: Dist
59 if: matrix.os != 'ubuntu-16.04'
60 run: cargo xtask dist 109 run: cargo xtask dist
110 env:
111 RA_TARGET: x86_64-apple-darwin
61 112
62 - name: Nightly analysis-stats check 113 - name: Upload artifacts
63 if: matrix.os == 'ubuntu-16.04' && github.ref != 'refs/heads/release' 114 uses: actions/upload-artifact@v1
64 run: ./dist/rust-analyzer-linux analysis-stats . 115 with:
116 name: dist-macos-latest
117 path: ./dist
118
119 dist-macos-11:
120 name: dist (MacOS 11.0)
121 runs-on: macos-11.0
122
123 steps:
124 - name: Checkout repository
125 uses: actions/checkout@v2
126
127 - name: Install Rust toolchain (beta)
128 uses: actions-rs/toolchain@v1
129 with:
130 toolchain: beta
131 target: aarch64-apple-darwin
132 profile: minimal
133 override: true
134
135 - name: Dist
136 run: cargo xtask dist
137 env:
138 RA_TARGET: aarch64-apple-darwin
65 139
66 - name: Upload artifacts 140 - name: Upload artifacts
67 uses: actions/upload-artifact@v1 141 uses: actions/upload-artifact@v1
68 with: 142 with:
69 name: dist-${{ matrix.os }} 143 name: dist-macos-11.0
70 path: ./dist 144 path: ./dist
71 145
72 publish: 146 publish:
73 name: publish 147 name: publish
74 runs-on: ubuntu-16.04 148 runs-on: ubuntu-16.04
75 needs: ['dist'] 149 needs: ['dist-windows', 'dist-ubuntu', 'dist-macos-latest', 'dist-macos-11']
76 steps: 150 steps:
77 - name: Install Nodejs 151 - name: Install Nodejs
78 uses: actions/setup-node@v1 152 uses: actions/setup-node@v1
@@ -93,6 +167,10 @@ jobs:
93 167
94 - uses: actions/download-artifact@v1 168 - uses: actions/download-artifact@v1
95 with: 169 with:
170 name: dist-macos-11.0
171 path: dist
172 - uses: actions/download-artifact@v1
173 with:
96 name: dist-macos-latest 174 name: dist-macos-latest
97 path: dist 175 path: dist
98 - uses: actions/download-artifact@v1 176 - uses: actions/download-artifact@v1
@@ -103,7 +181,7 @@ jobs:
103 with: 181 with:
104 name: dist-windows-latest 182 name: dist-windows-latest
105 path: dist 183 path: dist
106 - run: ls -all ./dist 184 - run: ls -al ./dist
107 185
108 - name: Publish Release 186 - name: Publish Release
109 uses: ./.github/actions/github-release 187 uses: ./.github/actions/github-release
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs
index 1f4b5c24c..11cdae57f 100644
--- a/crates/rust-analyzer/src/config.rs
+++ b/crates/rust-analyzer/src/config.rs
@@ -33,7 +33,7 @@ config_data! {
33 callInfo_full: bool = "true", 33 callInfo_full: bool = "true",
34 34
35 /// Automatically refresh project info via `cargo metadata` on 35 /// Automatically refresh project info via `cargo metadata` on
36 /// Cargo.toml changes. 36 /// `Cargo.toml` changes.
37 cargo_autoreload: bool = "true", 37 cargo_autoreload: bool = "true",
38 /// Activate all available features. 38 /// Activate all available features.
39 cargo_allFeatures: bool = "false", 39 cargo_allFeatures: bool = "false",
@@ -52,7 +52,7 @@ config_data! {
52 /// Run specified `cargo check` command for diagnostics on save. 52 /// Run specified `cargo check` command for diagnostics on save.
53 checkOnSave_enable: bool = "true", 53 checkOnSave_enable: bool = "true",
54 /// Check with all features (will be passed as `--all-features`). 54 /// Check with all features (will be passed as `--all-features`).
55 /// Defaults to `rust-analyzer.cargo.allFeatures`. 55 /// Defaults to `#rust-analyzer.cargo.allFeatures#`.
56 checkOnSave_allFeatures: Option<bool> = "null", 56 checkOnSave_allFeatures: Option<bool> = "null",
57 /// Check all targets and tests (will be passed as `--all-targets`). 57 /// Check all targets and tests (will be passed as `--all-targets`).
58 checkOnSave_allTargets: bool = "true", 58 checkOnSave_allTargets: bool = "true",
@@ -61,12 +61,12 @@ config_data! {
61 /// Do not activate the `default` feature. 61 /// Do not activate the `default` feature.
62 checkOnSave_noDefaultFeatures: Option<bool> = "null", 62 checkOnSave_noDefaultFeatures: Option<bool> = "null",
63 /// Check for a specific target. Defaults to 63 /// Check for a specific target. Defaults to
64 /// `rust-analyzer.cargo.target`. 64 /// `#rust-analyzer.cargo.target#`.
65 checkOnSave_target: Option<String> = "null", 65 checkOnSave_target: Option<String> = "null",
66 /// Extra arguments for `cargo check`. 66 /// Extra arguments for `cargo check`.
67 checkOnSave_extraArgs: Vec<String> = "[]", 67 checkOnSave_extraArgs: Vec<String> = "[]",
68 /// List of features to activate. Defaults to 68 /// List of features to activate. Defaults to
69 /// `rust-analyzer.cargo.features`. 69 /// `#rust-analyzer.cargo.features#`.
70 checkOnSave_features: Option<Vec<String>> = "null", 70 checkOnSave_features: Option<Vec<String>> = "null",
71 /// Advanced option, fully override the command rust-analyzer uses for 71 /// Advanced option, fully override the command rust-analyzer uses for
72 /// checking. The command should include `--message-format=json` or 72 /// checking. The command should include `--message-format=json` or
@@ -80,7 +80,7 @@ config_data! {
80 /// Whether to show postfix snippets like `dbg`, `if`, `not`, etc. 80 /// Whether to show postfix snippets like `dbg`, `if`, `not`, etc.
81 completion_postfix_enable: bool = "true", 81 completion_postfix_enable: bool = "true",
82 /// Toggles the additional completions that automatically add imports when completed. 82 /// Toggles the additional completions that automatically add imports when completed.
83 /// Note that your client have to specify the `additionalTextEdits` LSP client capability to truly have this feature enabled. 83 /// Note that your client must specify the `additionalTextEdits` LSP client capability to truly have this feature enabled.
84 completion_autoimport_enable: bool = "true", 84 completion_autoimport_enable: bool = "true",
85 85
86 /// Whether to show native rust-analyzer diagnostics. 86 /// Whether to show native rust-analyzer diagnostics.
@@ -90,13 +90,13 @@ config_data! {
90 diagnostics_enableExperimental: bool = "true", 90 diagnostics_enableExperimental: bool = "true",
91 /// List of rust-analyzer diagnostics to disable. 91 /// List of rust-analyzer diagnostics to disable.
92 diagnostics_disabled: FxHashSet<String> = "[]", 92 diagnostics_disabled: FxHashSet<String> = "[]",
93 /// List of warnings that should be displayed with info severity.\nThe 93 /// List of warnings that should be displayed with info severity.\n\nThe
94 /// warnings will be indicated by a blue squiggly underline in code and 94 /// warnings will be indicated by a blue squiggly underline in code and
95 /// a blue icon in the problems panel. 95 /// a blue icon in the `Problems Panel`.
96 diagnostics_warningsAsHint: Vec<String> = "[]", 96 diagnostics_warningsAsHint: Vec<String> = "[]",
97 /// List of warnings that should be displayed with hint severity.\nThe 97 /// List of warnings that should be displayed with hint severity.\n\nThe
98 /// warnings will be indicated by faded text or three dots in code and 98 /// warnings will be indicated by faded text or three dots in code and
99 /// will not show up in the problems panel. 99 /// will not show up in the `Problems Panel`.
100 diagnostics_warningsAsInfo: Vec<String> = "[]", 100 diagnostics_warningsAsInfo: Vec<String> = "[]",
101 101
102 /// Controls file watching implementation. 102 /// Controls file watching implementation.
@@ -121,7 +121,7 @@ config_data! {
121 121
122 /// Whether to show inlay type hints for method chains. 122 /// Whether to show inlay type hints for method chains.
123 inlayHints_chainingHints: bool = "true", 123 inlayHints_chainingHints: bool = "true",
124 /// Maximum length for inlay hints. 124 /// Maximum length for inlay hints. Default is unlimited.
125 inlayHints_maxLength: Option<usize> = "null", 125 inlayHints_maxLength: Option<usize> = "null",
126 /// Whether to show function parameter name inlay hints at the call 126 /// Whether to show function parameter name inlay hints at the call
127 /// site. 127 /// site.
@@ -145,27 +145,27 @@ config_data! {
145 lens_methodReferences: bool = "false", 145 lens_methodReferences: bool = "false",
146 146
147 /// Disable project auto-discovery in favor of explicitly specified set 147 /// Disable project auto-discovery in favor of explicitly specified set
148 /// of projects. \nElements must be paths pointing to Cargo.toml, 148 /// of projects.\n\nElements must be paths pointing to `Cargo.toml`,
149 /// rust-project.json, or JSON objects in rust-project.json format. 149 /// `rust-project.json`, or JSON objects in `rust-project.json` format.
150 linkedProjects: Vec<ManifestOrProjectJson> = "[]", 150 linkedProjects: Vec<ManifestOrProjectJson> = "[]",
151 /// Number of syntax trees rust-analyzer keeps in memory. 151 /// Number of syntax trees rust-analyzer keeps in memory. Defaults to 128.
152 lruCapacity: Option<usize> = "null", 152 lruCapacity: Option<usize> = "null",
153 /// Whether to show `can't find Cargo.toml` error message. 153 /// Whether to show `can't find Cargo.toml` error message.
154 notifications_cargoTomlNotFound: bool = "true", 154 notifications_cargoTomlNotFound: bool = "true",
155 /// Enable Proc macro support, cargo.loadOutDirsFromCheck must be 155 /// Enable Proc macro support, `#rust-analyzer.cargo.loadOutDirsFromCheck#` must be
156 /// enabled. 156 /// enabled.
157 procMacro_enable: bool = "false", 157 procMacro_enable: bool = "false",
158 158
159 /// Command to be executed instead of 'cargo' for runnables. 159 /// Command to be executed instead of 'cargo' for runnables.
160 runnables_overrideCargo: Option<String> = "null", 160 runnables_overrideCargo: Option<String> = "null",
161 /// Additional arguments to be passed to cargo for runnables such as 161 /// Additional arguments to be passed to cargo for runnables such as
162 /// tests or binaries.\nFor example, it may be '--release'. 162 /// tests or binaries.\nFor example, it may be `--release`.
163 runnables_cargoExtraArgs: Vec<String> = "[]", 163 runnables_cargoExtraArgs: Vec<String> = "[]",
164 164
165 /// Path to the rust compiler sources, for usage in rustc_private projects. 165 /// Path to the rust compiler sources, for usage in rustc_private projects.
166 rustcSource : Option<String> = "null", 166 rustcSource : Option<String> = "null",
167 167
168 /// Additional arguments to rustfmt. 168 /// Additional arguments to `rustfmt`.
169 rustfmt_extraArgs: Vec<String> = "[]", 169 rustfmt_extraArgs: Vec<String> = "[]",
170 /// Advanced option, fully override the command rust-analyzer uses for 170 /// Advanced option, fully override the command rust-analyzer uses for
171 /// formatting. 171 /// formatting.
@@ -758,7 +758,7 @@ fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json
758 ], 758 ],
759 "enumDescriptions": [ 759 "enumDescriptions": [
760 "Insert import paths relative to the current module, using up to one `super` prefix if the parent module contains the requested item.", 760 "Insert import paths relative to the current module, using up to one `super` prefix if the parent module contains the requested item.",
761 "Prefix all import paths with `self` if they don't begin with `self`, `super`, `crate` or a crate name", 761 "Prefix all import paths with `self` if they don't begin with `self`, `super`, `crate` or a crate name.",
762 "Force import paths to be absolute by always starting them with `crate` or the crate name they refer to." 762 "Force import paths to be absolute by always starting them with `crate` or the crate name they refer to."
763 ], 763 ],
764 }, 764 },
diff --git a/docs/user/generated_config.adoc b/docs/user/generated_config.adoc
index cb2ae6fc1..3025dc8d6 100644
--- a/docs/user/generated_config.adoc
+++ b/docs/user/generated_config.adoc
@@ -5,7 +5,7 @@ rust-analyzer.assist.importPrefix (default: `"plain"`)::
5rust-analyzer.callInfo.full (default: `true`):: 5rust-analyzer.callInfo.full (default: `true`)::
6 Show function name and docs in parameter hints. 6 Show function name and docs in parameter hints.
7rust-analyzer.cargo.autoreload (default: `true`):: 7rust-analyzer.cargo.autoreload (default: `true`)::
8 Automatically refresh project info via `cargo metadata` on Cargo.toml changes. 8 Automatically refresh project info via `cargo metadata` on `Cargo.toml` changes.
9rust-analyzer.cargo.allFeatures (default: `false`):: 9rust-analyzer.cargo.allFeatures (default: `false`)::
10 Activate all available features. 10 Activate all available features.
11rust-analyzer.cargo.features (default: `[]`):: 11rust-analyzer.cargo.features (default: `[]`)::
@@ -21,7 +21,7 @@ rust-analyzer.cargo.noSysroot (default: `false`)::
21rust-analyzer.checkOnSave.enable (default: `true`):: 21rust-analyzer.checkOnSave.enable (default: `true`)::
22 Run specified `cargo check` command for diagnostics on save. 22 Run specified `cargo check` command for diagnostics on save.
23rust-analyzer.checkOnSave.allFeatures (default: `null`):: 23rust-analyzer.checkOnSave.allFeatures (default: `null`)::
24 Check with all features (will be passed as `--all-features`). Defaults to `rust-analyzer.cargo.allFeatures`. 24 Check with all features (will be passed as `--all-features`). Defaults to `#rust-analyzer.cargo.allFeatures#`.
25rust-analyzer.checkOnSave.allTargets (default: `true`):: 25rust-analyzer.checkOnSave.allTargets (default: `true`)::
26 Check all targets and tests (will be passed as `--all-targets`). 26 Check all targets and tests (will be passed as `--all-targets`).
27rust-analyzer.checkOnSave.command (default: `"check"`):: 27rust-analyzer.checkOnSave.command (default: `"check"`)::
@@ -29,11 +29,11 @@ rust-analyzer.checkOnSave.command (default: `"check"`)::
29rust-analyzer.checkOnSave.noDefaultFeatures (default: `null`):: 29rust-analyzer.checkOnSave.noDefaultFeatures (default: `null`)::
30 Do not activate the `default` feature. 30 Do not activate the `default` feature.
31rust-analyzer.checkOnSave.target (default: `null`):: 31rust-analyzer.checkOnSave.target (default: `null`)::
32 Check for a specific target. Defaults to `rust-analyzer.cargo.target`. 32 Check for a specific target. Defaults to `#rust-analyzer.cargo.target#`.
33rust-analyzer.checkOnSave.extraArgs (default: `[]`):: 33rust-analyzer.checkOnSave.extraArgs (default: `[]`)::
34 Extra arguments for `cargo check`. 34 Extra arguments for `cargo check`.
35rust-analyzer.checkOnSave.features (default: `null`):: 35rust-analyzer.checkOnSave.features (default: `null`)::
36 List of features to activate. Defaults to `rust-analyzer.cargo.features`. 36 List of features to activate. Defaults to `#rust-analyzer.cargo.features#`.
37rust-analyzer.checkOnSave.overrideCommand (default: `null`):: 37rust-analyzer.checkOnSave.overrideCommand (default: `null`)::
38 Advanced option, fully override the command rust-analyzer uses for checking. The command should include `--message-format=json` or similar option. 38 Advanced option, fully override the command rust-analyzer uses for checking. The command should include `--message-format=json` or similar option.
39rust-analyzer.completion.addCallArgumentSnippets (default: `true`):: 39rust-analyzer.completion.addCallArgumentSnippets (default: `true`)::
@@ -43,7 +43,7 @@ rust-analyzer.completion.addCallParenthesis (default: `true`)::
43rust-analyzer.completion.postfix.enable (default: `true`):: 43rust-analyzer.completion.postfix.enable (default: `true`)::
44 Whether to show postfix snippets like `dbg`, `if`, `not`, etc. 44 Whether to show postfix snippets like `dbg`, `if`, `not`, etc.
45rust-analyzer.completion.autoimport.enable (default: `true`):: 45rust-analyzer.completion.autoimport.enable (default: `true`)::
46 Toggles the additional completions that automatically add imports when completed. Note that your client have to specify the `additionalTextEdits` LSP client capability to truly have this feature enabled. 46 Toggles the additional completions that automatically add imports when completed. Note that your client must specify the `additionalTextEdits` LSP client capability to truly have this feature enabled.
47rust-analyzer.diagnostics.enable (default: `true`):: 47rust-analyzer.diagnostics.enable (default: `true`)::
48 Whether to show native rust-analyzer diagnostics. 48 Whether to show native rust-analyzer diagnostics.
49rust-analyzer.diagnostics.enableExperimental (default: `true`):: 49rust-analyzer.diagnostics.enableExperimental (default: `true`)::
@@ -51,9 +51,9 @@ rust-analyzer.diagnostics.enableExperimental (default: `true`)::
51rust-analyzer.diagnostics.disabled (default: `[]`):: 51rust-analyzer.diagnostics.disabled (default: `[]`)::
52 List of rust-analyzer diagnostics to disable. 52 List of rust-analyzer diagnostics to disable.
53rust-analyzer.diagnostics.warningsAsHint (default: `[]`):: 53rust-analyzer.diagnostics.warningsAsHint (default: `[]`)::
54 List of warnings that should be displayed with info severity.\nThe warnings will be indicated by a blue squiggly underline in code and a blue icon in the problems panel. 54 List of warnings that should be displayed with info severity.\n\nThe warnings will be indicated by a blue squiggly underline in code and a blue icon in the `Problems Panel`.
55rust-analyzer.diagnostics.warningsAsInfo (default: `[]`):: 55rust-analyzer.diagnostics.warningsAsInfo (default: `[]`)::
56 List of warnings that should be displayed with hint severity.\nThe warnings will be indicated by faded text or three dots in code and will not show up in the problems panel. 56 List of warnings that should be displayed with hint severity.\n\nThe warnings will be indicated by faded text or three dots in code and will not show up in the `Problems Panel`.
57rust-analyzer.files.watcher (default: `"client"`):: 57rust-analyzer.files.watcher (default: `"client"`)::
58 Controls file watching implementation. 58 Controls file watching implementation.
59rust-analyzer.hoverActions.debug (default: `true`):: 59rust-analyzer.hoverActions.debug (default: `true`)::
@@ -71,7 +71,7 @@ rust-analyzer.hoverActions.linksInHover (default: `true`)::
71rust-analyzer.inlayHints.chainingHints (default: `true`):: 71rust-analyzer.inlayHints.chainingHints (default: `true`)::
72 Whether to show inlay type hints for method chains. 72 Whether to show inlay type hints for method chains.
73rust-analyzer.inlayHints.maxLength (default: `null`):: 73rust-analyzer.inlayHints.maxLength (default: `null`)::
74 Maximum length for inlay hints. 74 Maximum length for inlay hints. Default is unlimited.
75rust-analyzer.inlayHints.parameterHints (default: `true`):: 75rust-analyzer.inlayHints.parameterHints (default: `true`)::
76 Whether to show function parameter name inlay hints at the call site. 76 Whether to show function parameter name inlay hints at the call site.
77rust-analyzer.inlayHints.typeHints (default: `true`):: 77rust-analyzer.inlayHints.typeHints (default: `true`)::
@@ -87,20 +87,20 @@ rust-analyzer.lens.run (default: `true`)::
87rust-analyzer.lens.methodReferences (default: `false`):: 87rust-analyzer.lens.methodReferences (default: `false`)::
88 Whether to show `Method References` lens. Only applies when `#rust-analyzer.lens.enable#` is set. 88 Whether to show `Method References` lens. Only applies when `#rust-analyzer.lens.enable#` is set.
89rust-analyzer.linkedProjects (default: `[]`):: 89rust-analyzer.linkedProjects (default: `[]`)::
90 Disable project auto-discovery in favor of explicitly specified set of projects. \nElements must be paths pointing to Cargo.toml, rust-project.json, or JSON objects in rust-project.json format. 90 Disable project auto-discovery in favor of explicitly specified set of projects.\n\nElements must be paths pointing to `Cargo.toml`, `rust-project.json`, or JSON objects in `rust-project.json` format.
91rust-analyzer.lruCapacity (default: `null`):: 91rust-analyzer.lruCapacity (default: `null`)::
92 Number of syntax trees rust-analyzer keeps in memory. 92 Number of syntax trees rust-analyzer keeps in memory. Defaults to 128.
93rust-analyzer.notifications.cargoTomlNotFound (default: `true`):: 93rust-analyzer.notifications.cargoTomlNotFound (default: `true`)::
94 Whether to show `can't find Cargo.toml` error message. 94 Whether to show `can't find Cargo.toml` error message.
95rust-analyzer.procMacro.enable (default: `false`):: 95rust-analyzer.procMacro.enable (default: `false`)::
96 Enable Proc macro support, cargo.loadOutDirsFromCheck must be enabled. 96 Enable Proc macro support, `#rust-analyzer.cargo.loadOutDirsFromCheck#` must be enabled.
97rust-analyzer.runnables.overrideCargo (default: `null`):: 97rust-analyzer.runnables.overrideCargo (default: `null`)::
98 Command to be executed instead of 'cargo' for runnables. 98 Command to be executed instead of 'cargo' for runnables.
99rust-analyzer.runnables.cargoExtraArgs (default: `[]`):: 99rust-analyzer.runnables.cargoExtraArgs (default: `[]`)::
100 Additional arguments to be passed to cargo for runnables such as tests or binaries.\nFor example, it may be '--release'. 100 Additional arguments to be passed to cargo for runnables such as tests or binaries.\nFor example, it may be `--release`.
101rust-analyzer.rustcSource (default: `null`):: 101rust-analyzer.rustcSource (default: `null`)::
102 Path to the rust compiler sources, for usage in rustc_private projects. 102 Path to the rust compiler sources, for usage in rustc_private projects.
103rust-analyzer.rustfmt.extraArgs (default: `[]`):: 103rust-analyzer.rustfmt.extraArgs (default: `[]`)::
104 Additional arguments to rustfmt. 104 Additional arguments to `rustfmt`.
105rust-analyzer.rustfmt.overrideCommand (default: `null`):: 105rust-analyzer.rustfmt.overrideCommand (default: `null`)::
106 Advanced option, fully override the command rust-analyzer uses for formatting. 106 Advanced option, fully override the command rust-analyzer uses for formatting.
diff --git a/editors/code/package.json b/editors/code/package.json
index abcc84eda..13749a084 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -250,12 +250,12 @@
250 } 250 }
251 ], 251 ],
252 "default": null, 252 "default": null,
253 "description": "Environment variables passed to the runnable launched using `Test ` or `Debug` lens or `rust-analyzer.run` command." 253 "markdownDescription": "Environment variables passed to the runnable launched using `Test` or `Debug` lens or `rust-analyzer.run` command."
254 }, 254 },
255 "rust-analyzer.inlayHints.enable": { 255 "rust-analyzer.inlayHints.enable": {
256 "type": "boolean", 256 "type": "boolean",
257 "default": true, 257 "default": true,
258 "description": "Whether to show inlay hints" 258 "description": "Whether to show inlay hints."
259 }, 259 },
260 "rust-analyzer.updates.channel": { 260 "rust-analyzer.updates.channel": {
261 "type": "string", 261 "type": "string",
@@ -265,15 +265,15 @@
265 ], 265 ],
266 "default": "stable", 266 "default": "stable",
267 "markdownEnumDescriptions": [ 267 "markdownEnumDescriptions": [
268 "`\"stable\"` updates are shipped weekly, they don't contain cutting-edge features from VSCode proposed APIs but have less bugs in general", 268 "`stable` updates are shipped weekly, they don't contain cutting-edge features from VSCode proposed APIs but have less bugs in general.",
269 "`\"nightly\"` updates are shipped daily (extension updates automatically by downloading artifacts directly from GitHub), they contain cutting-edge features and latest bug fixes. These releases help us get your feedback very quickly and speed up rust-analyzer development **drastically**" 269 "`nightly` updates are shipped daily (extension updates automatically by downloading artifacts directly from GitHub), they contain cutting-edge features and latest bug fixes. These releases help us get your feedback very quickly and speed up rust-analyzer development **drastically**."
270 ], 270 ],
271 "markdownDescription": "Choose `\"nightly\"` updates to get the latest features and bug fixes every day. While `\"stable\"` releases occur weekly and don't contain cutting-edge features from VSCode proposed APIs" 271 "markdownDescription": "Choose `nightly` updates to get the latest features and bug fixes every day. While `stable` releases occur weekly and don't contain cutting-edge features from VSCode proposed APIs."
272 }, 272 },
273 "rust-analyzer.updates.askBeforeDownload": { 273 "rust-analyzer.updates.askBeforeDownload": {
274 "type": "boolean", 274 "type": "boolean",
275 "default": true, 275 "default": true,
276 "description": "Whether to ask for permission before downloading any files from the Internet" 276 "description": "Whether to ask for permission before downloading any files from the Internet."
277 }, 277 },
278 "rust-analyzer.serverPath": { 278 "rust-analyzer.serverPath": {
279 "type": [ 279 "type": [
@@ -281,7 +281,7 @@
281 "string" 281 "string"
282 ], 282 ],
283 "default": null, 283 "default": null,
284 "description": "Path to rust-analyzer executable (points to bundled binary by default). If this is set, then \"rust-analyzer.updates.channel\" setting is not used" 284 "markdownDescription": "Path to rust-analyzer executable (points to bundled binary by default). If this is set, then `#rust-analyzer.updates.channel#` setting is not used"
285 }, 285 },
286 "rust-analyzer.trace.server": { 286 "rust-analyzer.trace.server": {
287 "type": "string", 287 "type": "string",
@@ -297,10 +297,10 @@
297 "Full log" 297 "Full log"
298 ], 298 ],
299 "default": "off", 299 "default": "off",
300 "description": "Trace requests to the rust-analyzer (this is usually overly verbose and not recommended for regular users)" 300 "description": "Trace requests to the rust-analyzer (this is usually overly verbose and not recommended for regular users)."
301 }, 301 },
302 "rust-analyzer.trace.extension": { 302 "rust-analyzer.trace.extension": {
303 "description": "Enable logging of VS Code extensions itself", 303 "description": "Enable logging of VS Code extensions itself.",
304 "type": "boolean", 304 "type": "boolean",
305 "default": false 305 "default": false
306 }, 306 },
@@ -327,14 +327,14 @@
327 } 327 }
328 }, 328 },
329 "rust-analyzer.debug.openDebugPane": { 329 "rust-analyzer.debug.openDebugPane": {
330 "description": "Whether to open up the Debug Pane on debugging start.", 330 "markdownDescription": "Whether to open up the `Debug Panel` on debugging start.",
331 "type": "boolean", 331 "type": "boolean",
332 "default": false 332 "default": false
333 }, 333 },
334 "rust-analyzer.debug.engineSettings": { 334 "rust-analyzer.debug.engineSettings": {
335 "type": "object", 335 "type": "object",
336 "default": {}, 336 "default": {},
337 "description": "Optional settings passed to the debug engine. Example:\n{ \"lldb\": { \"terminal\":\"external\"} }" 337 "markdownDescription": "Optional settings passed to the debug engine. Example: `{ \"lldb\": { \"terminal\":\"external\"} }`"
338 }, 338 },
339 "rust-analyzer.assist.importMergeBehaviour": { 339 "rust-analyzer.assist.importMergeBehaviour": {
340 "markdownDescription": "The strategy to use when inserting new imports or merging imports.", 340 "markdownDescription": "The strategy to use when inserting new imports or merging imports.",
@@ -362,7 +362,7 @@
362 ], 362 ],
363 "enumDescriptions": [ 363 "enumDescriptions": [
364 "Insert import paths relative to the current module, using up to one `super` prefix if the parent module contains the requested item.", 364 "Insert import paths relative to the current module, using up to one `super` prefix if the parent module contains the requested item.",
365 "Prefix all import paths with `self` if they don't begin with `self`, `super`, `crate` or a crate name", 365 "Prefix all import paths with `self` if they don't begin with `self`, `super`, `crate` or a crate name.",
366 "Force import paths to be absolute by always starting them with `crate` or the crate name they refer to." 366 "Force import paths to be absolute by always starting them with `crate` or the crate name they refer to."
367 ] 367 ]
368 }, 368 },
@@ -372,7 +372,7 @@
372 "type": "boolean" 372 "type": "boolean"
373 }, 373 },
374 "rust-analyzer.cargo.autoreload": { 374 "rust-analyzer.cargo.autoreload": {
375 "markdownDescription": "Automatically refresh project info via `cargo metadata` on Cargo.toml changes.", 375 "markdownDescription": "Automatically refresh project info via `cargo metadata` on `Cargo.toml` changes.",
376 "default": true, 376 "default": true,
377 "type": "boolean" 377 "type": "boolean"
378 }, 378 },
@@ -418,7 +418,7 @@
418 "type": "boolean" 418 "type": "boolean"
419 }, 419 },
420 "rust-analyzer.checkOnSave.allFeatures": { 420 "rust-analyzer.checkOnSave.allFeatures": {
421 "markdownDescription": "Check with all features (will be passed as `--all-features`). Defaults to `rust-analyzer.cargo.allFeatures`.", 421 "markdownDescription": "Check with all features (will be passed as `--all-features`). Defaults to `#rust-analyzer.cargo.allFeatures#`.",
422 "default": null, 422 "default": null,
423 "type": [ 423 "type": [
424 "null", 424 "null",
@@ -444,7 +444,7 @@
444 ] 444 ]
445 }, 445 },
446 "rust-analyzer.checkOnSave.target": { 446 "rust-analyzer.checkOnSave.target": {
447 "markdownDescription": "Check for a specific target. Defaults to `rust-analyzer.cargo.target`.", 447 "markdownDescription": "Check for a specific target. Defaults to `#rust-analyzer.cargo.target#`.",
448 "default": null, 448 "default": null,
449 "type": [ 449 "type": [
450 "null", 450 "null",
@@ -460,7 +460,7 @@
460 } 460 }
461 }, 461 },
462 "rust-analyzer.checkOnSave.features": { 462 "rust-analyzer.checkOnSave.features": {
463 "markdownDescription": "List of features to activate. Defaults to `rust-analyzer.cargo.features`.", 463 "markdownDescription": "List of features to activate. Defaults to `#rust-analyzer.cargo.features#`.",
464 "default": null, 464 "default": null,
465 "type": [ 465 "type": [
466 "null", 466 "null",
@@ -497,7 +497,7 @@
497 "type": "boolean" 497 "type": "boolean"
498 }, 498 },
499 "rust-analyzer.completion.autoimport.enable": { 499 "rust-analyzer.completion.autoimport.enable": {
500 "markdownDescription": "Toggles the additional completions that automatically add imports when completed. Note that your client have to specify the `additionalTextEdits` LSP client capability to truly have this feature enabled.", 500 "markdownDescription": "Toggles the additional completions that automatically add imports when completed. Note that your client must specify the `additionalTextEdits` LSP client capability to truly have this feature enabled.",
501 "default": true, 501 "default": true,
502 "type": "boolean" 502 "type": "boolean"
503 }, 503 },
@@ -521,7 +521,7 @@
521 "uniqueItems": true 521 "uniqueItems": true
522 }, 522 },
523 "rust-analyzer.diagnostics.warningsAsHint": { 523 "rust-analyzer.diagnostics.warningsAsHint": {
524 "markdownDescription": "List of warnings that should be displayed with info severity.\\nThe warnings will be indicated by a blue squiggly underline in code and a blue icon in the problems panel.", 524 "markdownDescription": "List of warnings that should be displayed with info severity.\\n\\nThe warnings will be indicated by a blue squiggly underline in code and a blue icon in the `Problems Panel`.",
525 "default": [], 525 "default": [],
526 "type": "array", 526 "type": "array",
527 "items": { 527 "items": {
@@ -529,7 +529,7 @@
529 } 529 }
530 }, 530 },
531 "rust-analyzer.diagnostics.warningsAsInfo": { 531 "rust-analyzer.diagnostics.warningsAsInfo": {
532 "markdownDescription": "List of warnings that should be displayed with hint severity.\\nThe warnings will be indicated by faded text or three dots in code and will not show up in the problems panel.", 532 "markdownDescription": "List of warnings that should be displayed with hint severity.\\n\\nThe warnings will be indicated by faded text or three dots in code and will not show up in the `Problems Panel`.",
533 "default": [], 533 "default": [],
534 "type": "array", 534 "type": "array",
535 "items": { 535 "items": {
@@ -577,7 +577,7 @@
577 "type": "boolean" 577 "type": "boolean"
578 }, 578 },
579 "rust-analyzer.inlayHints.maxLength": { 579 "rust-analyzer.inlayHints.maxLength": {
580 "markdownDescription": "Maximum length for inlay hints.", 580 "markdownDescription": "Maximum length for inlay hints. Default is unlimited.",
581 "default": null, 581 "default": null,
582 "type": [ 582 "type": [
583 "null", 583 "null",
@@ -621,7 +621,7 @@
621 "type": "boolean" 621 "type": "boolean"
622 }, 622 },
623 "rust-analyzer.linkedProjects": { 623 "rust-analyzer.linkedProjects": {
624 "markdownDescription": "Disable project auto-discovery in favor of explicitly specified set of projects. \\nElements must be paths pointing to Cargo.toml, rust-project.json, or JSON objects in rust-project.json format.", 624 "markdownDescription": "Disable project auto-discovery in favor of explicitly specified set of projects.\\n\\nElements must be paths pointing to `Cargo.toml`, `rust-project.json`, or JSON objects in `rust-project.json` format.",
625 "default": [], 625 "default": [],
626 "type": "array", 626 "type": "array",
627 "items": { 627 "items": {
@@ -632,7 +632,7 @@
632 } 632 }
633 }, 633 },
634 "rust-analyzer.lruCapacity": { 634 "rust-analyzer.lruCapacity": {
635 "markdownDescription": "Number of syntax trees rust-analyzer keeps in memory.", 635 "markdownDescription": "Number of syntax trees rust-analyzer keeps in memory. Defaults to 128.",
636 "default": null, 636 "default": null,
637 "type": [ 637 "type": [
638 "null", 638 "null",
@@ -646,7 +646,7 @@
646 "type": "boolean" 646 "type": "boolean"
647 }, 647 },
648 "rust-analyzer.procMacro.enable": { 648 "rust-analyzer.procMacro.enable": {
649 "markdownDescription": "Enable Proc macro support, cargo.loadOutDirsFromCheck must be enabled.", 649 "markdownDescription": "Enable Proc macro support, `#rust-analyzer.cargo.loadOutDirsFromCheck#` must be enabled.",
650 "default": false, 650 "default": false,
651 "type": "boolean" 651 "type": "boolean"
652 }, 652 },
@@ -659,7 +659,7 @@
659 ] 659 ]
660 }, 660 },
661 "rust-analyzer.runnables.cargoExtraArgs": { 661 "rust-analyzer.runnables.cargoExtraArgs": {
662 "markdownDescription": "Additional arguments to be passed to cargo for runnables such as tests or binaries.\\nFor example, it may be '--release'.", 662 "markdownDescription": "Additional arguments to be passed to cargo for runnables such as tests or binaries.\\nFor example, it may be `--release`.",
663 "default": [], 663 "default": [],
664 "type": "array", 664 "type": "array",
665 "items": { 665 "items": {
@@ -675,7 +675,7 @@
675 ] 675 ]
676 }, 676 },
677 "rust-analyzer.rustfmt.extraArgs": { 677 "rust-analyzer.rustfmt.extraArgs": {
678 "markdownDescription": "Additional arguments to rustfmt.", 678 "markdownDescription": "Additional arguments to `rustfmt`.",
679 "default": [], 679 "default": [],
680 "type": "array", 680 "type": "array",
681 "items": { 681 "items": {
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts
index 4b2d3c8a5..83d0bdf12 100644
--- a/editors/code/src/main.ts
+++ b/editors/code/src/main.ts
@@ -131,7 +131,7 @@ async function tryActivate(context: vscode.ExtensionContext) {
131 ctx.pushCleanup(activateTaskProvider(workspaceFolder, ctx.config)); 131 ctx.pushCleanup(activateTaskProvider(workspaceFolder, ctx.config));
132 132
133 activateInlayHints(ctx); 133 activateInlayHints(ctx);
134 warnAboutRustLangExtensionConflict(); 134 warnAboutExtensionConflicts();
135 135
136 vscode.workspace.onDidChangeConfiguration( 136 vscode.workspace.onDidChangeConfiguration(
137 _ => ctx?.client?.sendNotification('workspace/didChangeConfiguration', { settings: "" }), 137 _ => ctx?.client?.sendNotification('workspace/didChangeConfiguration', { settings: "" }),
@@ -411,11 +411,21 @@ async function queryForGithubToken(state: PersistentState): Promise<void> {
411 } 411 }
412} 412}
413 413
414function warnAboutRustLangExtensionConflict() { 414function warnAboutExtensionConflicts() {
415 const rustLangExt = vscode.extensions.getExtension("rust-lang.rust"); 415 const conflicting = [
416 if (rustLangExt !== undefined) { 416 ["rust-analyzer", "matklad.rust-analyzer"],
417 ["Rust", "rust-lang.rust"],
418 ["Rust", "kalitaalexey.vscode-rust"],
419 ];
420
421 const found = conflicting.filter(
422 nameId => vscode.extensions.getExtension(nameId[1]) !== undefined);
423
424 if (found.length > 1) {
425 const fst = found[0];
426 const sec = found[1];
417 vscode.window.showWarningMessage( 427 vscode.window.showWarningMessage(
418 "You have both rust-analyzer (matklad.rust-analyzer) and Rust (rust-lang.rust) " + 428 `You have both the ${fst[0]} (${fst[1]}) and ${sec[0]} (${sec[1]}) ` +
419 "plugins enabled. These are known to conflict and cause various functions of " + 429 "plugins enabled. These are known to conflict and cause various functions of " +
420 "both plugins to not work correctly. You should disable one of them.", "Got it"); 430 "both plugins to not work correctly. You should disable one of them.", "Got it");
421 }; 431 };
diff --git a/xtask/src/dist.rs b/xtask/src/dist.rs
index 9e15a5a4c..d07ad9420 100644
--- a/xtask/src/dist.rs
+++ b/xtask/src/dist.rs
@@ -58,30 +58,74 @@ fn dist_client(version: &str, release_tag: &str) -> Result<()> {
58} 58}
59 59
60fn dist_server() -> Result<()> { 60fn dist_server() -> Result<()> {
61 if cfg!(target_os = "linux") { 61 let target = get_target();
62 if target.contains("-linux-gnu") {
62 env::set_var("CC", "clang"); 63 env::set_var("CC", "clang");
63 } 64 }
64 cmd!("cargo build --manifest-path ./crates/rust-analyzer/Cargo.toml --bin rust-analyzer --release").run()?;
65
66 let (src, dst) = if cfg!(target_os = "linux") {
67 ("./target/release/rust-analyzer", "./dist/rust-analyzer-linux")
68 } else if cfg!(target_os = "windows") {
69 ("./target/release/rust-analyzer.exe", "./dist/rust-analyzer-windows.exe")
70 } else if cfg!(target_os = "macos") {
71 ("./target/release/rust-analyzer", "./dist/rust-analyzer-mac")
72 } else {
73 panic!("Unsupported OS")
74 };
75 65
76 let src = Path::new(src); 66 let toolchain = toolchain(&target);
77 let dst = Path::new(dst); 67 cmd!("cargo +{toolchain} build --manifest-path ./crates/rust-analyzer/Cargo.toml --bin rust-analyzer --target {target} --release").run()?;
78 68
69 let suffix = exe_suffix(&target);
70 let src =
71 Path::new("target").join(&target).join("release").join(format!("rust-analyzer{}", suffix));
72 let dst = Path::new("dist").join(format!("rust-analyzer-{}{}", target, suffix));
79 cp(&src, &dst)?; 73 cp(&src, &dst)?;
80 gzip(&src, &dst.with_extension("gz"))?; 74 gzip(&src, &dst.with_extension("gz"))?;
81 75
76 // FIXME: the old names are temporarily kept for client compatibility, but they should be removed
77 // Remove this block after a couple of releases
78 match target.as_ref() {
79 "x86_64-unknown-linux-gnu" => {
80 cp(&src, "dist/rust-analyzer-linux")?;
81 gzip(&src, Path::new("dist/rust-analyzer-linux.gz"))?;
82 }
83 "x86_64-pc-windows-msvc" => {
84 cp(&src, "dist/rust-analyzer-windows.exe")?;
85 gzip(&src, Path::new("dist/rust-analyzer-windows.gz"))?;
86 }
87 "x86_64-apple-darwin" => {
88 cp(&src, "dist/rust-analyzer-mac")?;
89 gzip(&src, Path::new("dist/rust-analyzer-mac.gz"))?;
90 }
91 _ => {}
92 }
93
82 Ok(()) 94 Ok(())
83} 95}
84 96
97fn get_target() -> String {
98 match env::var("RA_TARGET") {
99 Ok(target) => target,
100 _ => {
101 if cfg!(target_os = "linux") {
102 "x86_64-unknown-linux-gnu".to_string()
103 } else if cfg!(target_os = "windows") {
104 "x86_64-pc-windows-msvc".to_string()
105 } else if cfg!(target_os = "macos") {
106 "x86_64-apple-darwin".to_string()
107 } else {
108 panic!("Unsupported OS, maybe try setting RA_TARGET")
109 }
110 }
111 }
112}
113
114fn exe_suffix(target: &str) -> String {
115 if target.contains("-windows-") {
116 ".exe".into()
117 } else {
118 "".into()
119 }
120}
121
122fn toolchain(target: &str) -> String {
123 match target {
124 "aarch64-apple-darwin" => "beta".to_string(),
125 _ => "stable".to_string(),
126 }
127}
128
85fn gzip(src_path: &Path, dest_path: &Path) -> Result<()> { 129fn gzip(src_path: &Path, dest_path: &Path) -> Result<()> {
86 let mut encoder = GzEncoder::new(File::create(dest_path)?, Compression::best()); 130 let mut encoder = GzEncoder::new(File::create(dest_path)?, Compression::best());
87 let mut input = io::BufReader::new(File::open(src_path)?); 131 let mut input = io::BufReader::new(File::open(src_path)?);