|
172 | 172 | targets and features, with the following base command line: |
173 | 173 |
|
174 | 174 | ```bash |
175 | | - cargo check --quiet --workspace --message-format=json --all-targets |
| 175 | + cargo check --quiet --workspace --message-format=json --all-targets --keep-going |
176 | 176 | ``` |
177 | 177 | . |
178 | 178 | ''; |
|
1323 | 1323 | description = '' |
1324 | 1324 | Whether to show const generic parameter name inlay hints. |
1325 | 1325 | ''; |
1326 | | - pluginDefault = false; |
| 1326 | + pluginDefault = true; |
1327 | 1327 | type = { |
1328 | 1328 | kind = "boolean"; |
1329 | 1329 | }; |
|
1332 | 1332 | description = '' |
1333 | 1333 | Whether to show generic lifetime parameter name inlay hints. |
1334 | 1334 | ''; |
1335 | | - pluginDefault = true; |
| 1335 | + pluginDefault = false; |
1336 | 1336 | type = { |
1337 | 1337 | kind = "boolean"; |
1338 | 1338 | }; |
|
1649 | 1649 | pluginDefault = null; |
1650 | 1650 | type = { |
1651 | 1651 | kind = "integer"; |
1652 | | - maximum = null; |
| 1652 | + maximum = 65535; |
1653 | 1653 | minimum = 0; |
1654 | 1654 | }; |
1655 | 1655 | }; |
|
1985 | 1985 | kind = "boolean"; |
1986 | 1986 | }; |
1987 | 1987 | }; |
| 1988 | + "rust-analyzer.workspace.discoverConfig" = { |
| 1989 | + description = '' |
| 1990 | + Enables automatic discovery of projects using [`DiscoverWorkspaceConfig::command`]. |
| 1991 | +
|
| 1992 | + [`DiscoverWorkspaceConfig`] also requires setting `progress_label` and `files_to_watch`. |
| 1993 | + `progress_label` is used for the title in progress indicators, whereas `files_to_watch` |
| 1994 | + is used to determine which build system-specific files should be watched in order to |
| 1995 | + reload rust-analyzer. |
| 1996 | +
|
| 1997 | + Below is an example of a valid configuration: |
| 1998 | + ```json |
| 1999 | + "rust-analyzer.workspace.discoverConfig": { |
| 2000 | + "command": [ |
| 2001 | + "rust-project", |
| 2002 | + "develop-json", |
| 2003 | + {arg} |
| 2004 | + ], |
| 2005 | + "progressLabel": "rust-analyzer", |
| 2006 | + "filesToWatch": [ |
| 2007 | + "BUCK", |
| 2008 | + ], |
| 2009 | + } |
| 2010 | + ``` |
| 2011 | +
|
| 2012 | + ## On `DiscoverWorkspaceConfig::command` |
| 2013 | +
|
| 2014 | + **Warning**: This format is provisional and subject to change. |
| 2015 | +
|
| 2016 | + [`DiscoverWorkspaceConfig::command`] *must* return a JSON object |
| 2017 | + corresponding to `DiscoverProjectData::Finished`: |
| 2018 | +
|
| 2019 | + ```norun |
| 2020 | + #[derive(Debug, Clone, Deserialize, Serialize)] |
| 2021 | + #[serde(tag = "kind")] |
| 2022 | + #[serde(rename_all = "snake_case")] |
| 2023 | + enum DiscoverProjectData { |
| 2024 | + Finished { buildfile: Utf8PathBuf, project: ProjectJsonData }, |
| 2025 | + Error { error: String, source: Option<String> }, |
| 2026 | + Progress { message: String }, |
| 2027 | + } |
| 2028 | + ``` |
| 2029 | +
|
| 2030 | + As JSON, `DiscoverProjectData::Finished` is: |
| 2031 | +
|
| 2032 | + ```json |
| 2033 | + { |
| 2034 | + // the internally-tagged representation of the enum. |
| 2035 | + "kind": "finished", |
| 2036 | + // the file used by a non-Cargo build system to define |
| 2037 | + // a package or target. |
| 2038 | + "buildfile": "rust-analyzer/BUILD", |
| 2039 | + // the contents of a rust-project.json, elided for brevity |
| 2040 | + "project": { |
| 2041 | + "sysroot": "foo", |
| 2042 | + "crates": [] |
| 2043 | + } |
| 2044 | + } |
| 2045 | + ``` |
| 2046 | +
|
| 2047 | + It is encouraged, but not required, to use the other variants on |
| 2048 | + `DiscoverProjectData` to provide a more polished end-user experience. |
| 2049 | +
|
| 2050 | + `DiscoverWorkspaceConfig::command` may *optionally* include an `{arg}`, |
| 2051 | + which will be substituted with the JSON-serialized form of the following |
| 2052 | + enum: |
| 2053 | +
|
| 2054 | + ```norun |
| 2055 | + #[derive(PartialEq, Clone, Debug, Serialize)] |
| 2056 | + #[serde(rename_all = "camelCase")] |
| 2057 | + pub enum DiscoverArgument { |
| 2058 | + Path(AbsPathBuf), |
| 2059 | + Buildfile(AbsPathBuf), |
| 2060 | + } |
| 2061 | + ``` |
| 2062 | +
|
| 2063 | + The JSON representation of `DiscoverArgument::Path` is: |
| 2064 | +
|
| 2065 | + ```json |
| 2066 | + { |
| 2067 | + "path": "src/main.rs" |
| 2068 | + } |
| 2069 | + ``` |
| 2070 | +
|
| 2071 | + Similarly, the JSON representation of `DiscoverArgument::Buildfile` is: |
| 2072 | +
|
| 2073 | + ``` |
| 2074 | + { |
| 2075 | + "buildfile": "BUILD" |
| 2076 | + } |
| 2077 | + ``` |
| 2078 | +
|
| 2079 | + `DiscoverArgument::Path` is used to find and generate a `rust-project.json`, |
| 2080 | + and therefore, a workspace, whereas `DiscoverArgument::buildfile` is used to |
| 2081 | + to update an existing workspace. As a reference for implementors, |
| 2082 | + buck2's `rust-project` will likely be useful: |
| 2083 | + https://github.com/facebook/buck2/tree/main/integrations/rust-project. |
| 2084 | + ''; |
| 2085 | + pluginDefault = null; |
| 2086 | + type = { |
| 2087 | + kind = "oneOf"; |
| 2088 | + subTypes = [ |
| 2089 | + { |
| 2090 | + kind = "submodule"; |
| 2091 | + options = { |
| 2092 | + command = { |
| 2093 | + item = { |
| 2094 | + kind = "string"; |
| 2095 | + }; |
| 2096 | + kind = "list"; |
| 2097 | + }; |
| 2098 | + filesToWatch = { |
| 2099 | + item = { |
| 2100 | + kind = "string"; |
| 2101 | + }; |
| 2102 | + kind = "list"; |
| 2103 | + }; |
| 2104 | + progressLabel = { |
| 2105 | + kind = "string"; |
| 2106 | + }; |
| 2107 | + }; |
| 2108 | + } |
| 2109 | + ]; |
| 2110 | + }; |
| 2111 | + }; |
1988 | 2112 | "rust-analyzer.workspace.symbol.search.kind" = { |
1989 | 2113 | description = '' |
1990 | 2114 | Workspace symbol search kind. |
|
0 commit comments