sublimelsp / LSP-rust-analyzer

Convenience package for rust-analyzer
MIT License
70 stars 11 forks source link

update rust-analyzer to 2024-09-23 #135

Closed sublimelsp-app[bot] closed 1 month ago

sublimelsp-app[bot] commented 3 months ago

Update rust-analyzer from 2024-06-24 to 2024-09-23 (see all changes).

github-actions[bot] commented 3 months ago

Following are the settings schema changes between tags 2024-06-24 and 2024-09-23. Make sure that those are reflected in LSP-rust-analyzer.sublime-settings and sublime-package.json files.

--- /dev/fd/63  2024-09-24 15:18:36.861193222 +0000
+++ /dev/fd/62  2024-09-24 15:18:36.861193222 +0000
@@ -2,27 +2,11 @@
   {
     "title": "general",
     "properties": {
-      "rust-analyzer.cargoRunner": {
-        "type": [
-          "null",
-          "string"
-        ],
-        "default": null,
-        "description": "Custom cargo runner extension ID."
-      },
       "rust-analyzer.restartServerOnConfigChange": {
         "markdownDescription": "Whether to restart the server automatically when certain settings that require a restart are changed.",
         "default": false,
         "type": "boolean"
       },
-      "rust-analyzer.discoverProjectRunner": {
-        "markdownDescription": "Sets the extension responsible for determining which extension the rust-analyzer extension uses to generate `rust-project.json` files. This should should only be used\n if a build system like Buck or Bazel is also in use.",
-        "default": null,
-        "type": [
-          "null",
-          "string"
-        ]
-      },
       "rust-analyzer.showUnlinkedFileNotification": {
         "markdownDescription": "Whether to show a notification for unlinked files asking the user to add the corresponding Cargo.toml to the linked projects setting.",
         "default": true,
@@ -165,6 +149,7 @@
       },
       "rust-analyzer.trace.extension": {
         "description": "Enable logging of VS Code extensions itself.",
+        "markdownDeprecationMessage": "Log level is now controlled by the [Developer: Set Log Level...](command:workbench.action.setLogLevel) command.You can set the log level for the current session and also the default log level from there. This is also available by clicking the gear icon on the OUTPUT tab when Rust Analyzer Client is visible or by passing the --log rust-lang.rust-analyzer:debug parameter to VS Code.",
         "type": "boolean",
         "default": false
       }
@@ -270,9 +255,19 @@
   {
     "title": "assist",
     "properties": {
+      "rust-analyzer.assist.termSearch.borrowcheck": {
+        "markdownDescription": "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.",
+        "default": true,
+        "type": "boolean"
+      }
+    }
+  },
+  {
+    "title": "assist",
+    "properties": {
       "rust-analyzer.assist.termSearch.fuel": {
-        "markdownDescription": "Term search fuel in \"units of work\" for assists (Defaults to 400).",
-        "default": 400,
+        "markdownDescription": "Term search fuel in \"units of work\" for assists (Defaults to 1800).",
+        "default": 1800,
         "type": "integer",
         "minimum": 0
       }
@@ -348,26 +343,8 @@
   {
     "title": "cargo",
     "properties": {
-      "rust-analyzer.cargo.buildScripts.invocationLocation": {
-        "markdownDescription": "Specifies the working directory for running build scripts.\n- \"workspace\": run build scripts for a workspace in the workspace's root directory.\n    This is incompatible with `#rust-analyzer.cargo.buildScripts.invocationStrategy#` set to `once`.\n- \"root\": run build scripts in the project's root directory.\nThis config only has an effect when `#rust-analyzer.cargo.buildScripts.overrideCommand#`\nis set.",
-        "default": "workspace",
-        "type": "string",
-        "enum": [
-          "workspace",
-          "root"
-        ],
-        "enumDescriptions": [
-          "The command will be executed in the corresponding workspace root.",
-          "The command will be executed in the project root."
-        ]
-      }
-    }
-  },
-  {
-    "title": "cargo",
-    "properties": {
       "rust-analyzer.cargo.buildScripts.invocationStrategy": {
-        "markdownDescription": "Specifies the invocation strategy to use when running the build scripts command.\nIf `per_workspace` is set, the command will be executed for each workspace.\nIf `once` is set, the command will be executed once.\nThis config only has an effect when `#rust-analyzer.cargo.buildScripts.overrideCommand#`\nis set.",
+        "markdownDescription": "Specifies the invocation strategy to use when running the build scripts command.\nIf `per_workspace` is set, the command will be executed for each Rust workspace with the\nworkspace as the working directory.\nIf `once` is set, the command will be executed once with the opened project as the\nworking directory.\nThis config only has an effect when `#rust-analyzer.cargo.buildScripts.overrideCommand#`\nis set.",
         "default": "per_workspace",
         "type": "string",
         "enum": [
@@ -375,8 +352,8 @@
           "once"
         ],
         "enumDescriptions": [
-          "The command will be executed for each workspace.",
-          "The command will be executed once."
+          "The command will be executed for each Rust workspace with the workspace as the working directory.",
+          "The command will be executed once with the opened project as the working directory."
         ]
       }
     }
@@ -385,7 +362,7 @@
     "title": "cargo",
     "properties": {
       "rust-analyzer.cargo.buildScripts.overrideCommand": {
-        "markdownDescription": "Override the command rust-analyzer uses to run build scripts and\nbuild procedural macros. The command is required to output json\nand should therefore include `--message-format=json` or a similar\noption.\n\nIf there are multiple linked projects/workspaces, this command is invoked for\neach of them, with the working directory being the workspace root\n(i.e., the folder containing the `Cargo.toml`). This can be overwritten\nby changing `#rust-analyzer.cargo.buildScripts.invocationStrategy#` and\n`#rust-analyzer.cargo.buildScripts.invocationLocation#`.\n\nBy default, a cargo invocation will be constructed for the configured\ntargets and features, with the following base command line:\n\n```bash\ncargo check --quiet --workspace --message-format=json --all-targets\n```\n.",
+        "markdownDescription": "Override the command rust-analyzer uses to run build scripts and\nbuild procedural macros. The command is required to output json\nand should therefore include `--message-format=json` or a similar\noption.\n\nIf there are multiple linked projects/workspaces, this command is invoked for\neach of them, with the working directory being the workspace root\n(i.e., the folder containing the `Cargo.toml`). This can be overwritten\nby changing `#rust-analyzer.cargo.buildScripts.invocationStrategy#`.\n\nBy default, a cargo invocation will be constructed for the configured\ntargets and features, with the following base command line:\n\n```bash\ncargo check --quiet --workspace --message-format=json --all-targets --keep-going\n```\n.",
         "default": null,
         "type": [
           "null",
@@ -505,16 +482,6 @@
   {
     "title": "cargo",
     "properties": {
-      "rust-analyzer.cargo.sysrootQueryMetadata": {
-        "markdownDescription": "Whether to run cargo metadata on the sysroot library allowing rust-analyzer to analyze\nthird-party dependencies of the standard libraries.\n\nThis will cause `cargo` to create a lockfile in your sysroot directory. rust-analyzer\nwill attempt to clean up afterwards, but nevertheless requires the location to be\nwritable to.",
-        "default": false,
-        "type": "boolean"
-      }
-    }
-  },
-  {
-    "title": "cargo",
-    "properties": {
       "rust-analyzer.cargo.sysrootSrc": {
         "markdownDescription": "Relative path to the sysroot library sources. If left unset, this will default to\n`{cargo.sysroot}/lib/rustlib/src/rust/library`.\n\nThis option does not take effect until rust-analyzer is restarted.",
         "default": null,
@@ -660,24 +627,6 @@
   {
     "title": "check",
     "properties": {
-      "rust-analyzer.check.invocationLocation": {
-        "markdownDescription": "Specifies the working directory for running checks.\n- \"workspace\": run checks for workspaces in the corresponding workspaces' root directories.\n    This falls back to \"root\" if `#rust-analyzer.check.invocationStrategy#` is set to `once`.\n- \"root\": run checks in the project's root directory.\nThis config only has an effect when `#rust-analyzer.check.overrideCommand#`\nis set.",
-        "default": "workspace",
-        "type": "string",
-        "enum": [
-          "workspace",
-          "root"
-        ],
-        "enumDescriptions": [
-          "The command will be executed in the corresponding workspace root.",
-          "The command will be executed in the project root."
-        ]
-      }
-    }
-  },
-  {
-    "title": "check",
-    "properties": {
       "rust-analyzer.check.invocationStrategy": {
         "markdownDescription": "Specifies the invocation strategy to use when running the check command.\nIf `per_workspace` is set, the command will be executed for each workspace.\nIf `once` is set, the command will be executed once.\nThis config only has an effect when `#rust-analyzer.check.overrideCommand#`\nis set.",
         "default": "per_workspace",
@@ -687,8 +636,8 @@
           "once"
         ],
         "enumDescriptions": [
-          "The command will be executed for each workspace.",
-          "The command will be executed once."
+          "The command will be executed for each Rust workspace with the workspace as the working directory.",
+          "The command will be executed once with the opened project as the working directory."
         ]
       }
     }
@@ -710,7 +659,7 @@
     "title": "check",
     "properties": {
       "rust-analyzer.check.overrideCommand": {
-        "markdownDescription": "Override the command rust-analyzer uses instead of `cargo check` for\ndiagnostics on save. The command is required to output json and\nshould therefore include `--message-format=json` or a similar option\n(if your client supports the `colorDiagnosticOutput` experimental\ncapability, you can use `--message-format=json-diagnostic-rendered-ansi`).\n\nIf you're changing this because you're using some tool wrapping\nCargo, you might also want to change\n`#rust-analyzer.cargo.buildScripts.overrideCommand#`.\n\nIf there are multiple linked projects/workspaces, this command is invoked for\neach of them, with the working directory being the workspace root\n(i.e., the folder containing the `Cargo.toml`). This can be overwritten\nby changing `#rust-analyzer.check.invocationStrategy#` and\n`#rust-analyzer.check.invocationLocation#`.\n\nIf `$saved_file` is part of the command, rust-analyzer will pass\nthe absolute path of the saved file to the provided command. This is\nintended to be used with non-Cargo build systems.\nNote that `$saved_file` is experimental and may be removed in the future.\n\nAn example command would be:\n\n```bash\ncargo check --workspace --message-format=json --all-targets\n```\n.",
+        "markdownDescription": "Override the command rust-analyzer uses instead of `cargo check` for\ndiagnostics on save. The command is required to output json and\nshould therefore include `--message-format=json` or a similar option\n(if your client supports the `colorDiagnosticOutput` experimental\ncapability, you can use `--message-format=json-diagnostic-rendered-ansi`).\n\nIf you're changing this because you're using some tool wrapping\nCargo, you might also want to change\n`#rust-analyzer.cargo.buildScripts.overrideCommand#`.\n\nIf there are multiple linked projects/workspaces, this command is invoked for\neach of them, with the working directory being the workspace root\n(i.e., the folder containing the `Cargo.toml`). This can be overwritten\nby changing `#rust-analyzer.check.invocationStrategy#`.\n\nIf `$saved_file` is part of the command, rust-analyzer will pass\nthe absolute path of the saved file to the provided command. This is\nintended to be used with non-Cargo build systems.\nNote that `$saved_file` is experimental and may be removed in the future.\n\nAn example command would be:\n\n```bash\ncargo check --workspace --message-format=json --all-targets\n```\n.",
         "default": null,
         "type": [
           "null",
@@ -758,6 +707,16 @@
   {
     "title": "completion",
     "properties": {
+      "rust-analyzer.completion.addSemicolonToUnit": {
+        "markdownDescription": "Whether to automatically add a semicolon when completing unit-returning functions.\n\nIn `match` arms it completes a comma instead.",
+        "default": true,
+        "type": "boolean"
+      }
+    }
+  },
+  {
+    "title": "completion",
+    "properties": {
       "rust-analyzer.completion.autoimport.enable": {
         "markdownDescription": "Toggles the additional completions that automatically add imports when completed.\nNote that your client must specify the `additionalTextEdits` LSP client capability to truly have this feature enabled.",
         "default": true,
@@ -808,6 +767,16 @@
   {
     "title": "completion",
     "properties": {
+      "rust-analyzer.completion.hideDeprecated": {
+        "markdownDescription": "Whether to omit deprecated items from autocompletion. By default they are marked as deprecated but not hidden.",
+        "default": false,
+        "type": "boolean"
+      }
+    }
+  },
+  {
+    "title": "completion",
+    "properties": {
       "rust-analyzer.completion.limit": {
         "markdownDescription": "Maximum number of completions to return. If `None`, the limit is infinite.",
         "default": null,
@@ -866,12 +835,6 @@
             "description": "Put the expression into a pinned `Box`",
             "scope": "expr"
           },
-          "Ok": {
-            "postfix": "ok",
-            "body": "Ok(${receiver})",
-            "description": "Wrap the expression in a `Result::Ok`",
-            "scope": "expr"
-          },
           "Err": {
             "postfix": "err",
             "body": "Err(${receiver})",
@@ -883,6 +846,12 @@
             "body": "Some(${receiver})",
             "description": "Wrap the expression in an `Option::Some`",
             "scope": "expr"
+          },
+          "Ok": {
+            "postfix": "ok",
+            "body": "Ok(${receiver})",
+            "description": "Wrap the expression in a `Result::Ok`",
+            "scope": "expr"
           }
         },
         "type": "object"
@@ -903,8 +872,8 @@
     "title": "completion",
     "properties": {
       "rust-analyzer.completion.termSearch.fuel": {
-        "markdownDescription": "Term search fuel in \"units of work\" for autocompletion (Defaults to 200).",
-        "default": 200,
+        "markdownDescription": "Term search fuel in \"units of work\" for autocompletion (Defaults to 1000).",
+        "default": 1000,
         "type": "integer",
         "minimum": 0
       }
@@ -1402,6 +1371,16 @@
     }
   },
   {
+    "title": "imports",
+    "properties": {
+      "rust-analyzer.imports.prefixExternPrelude": {
+        "markdownDescription": "Whether to prefix external (including std, core) crate imports with `::`. e.g. \"use ::std::io::Read;\".",
+        "default": false,
+        "type": "boolean"
+      }
+    }
+  },
+  {
     "title": "inlayHints",
     "properties": {
       "rust-analyzer.inlayHints.bindingModeHints.enable": {
@@ -1569,6 +1548,36 @@
   {
     "title": "inlayHints",
     "properties": {
+      "rust-analyzer.inlayHints.genericParameterHints.const.enable": {
+        "markdownDescription": "Whether to show const generic parameter name inlay hints.",
+        "default": true,
+        "type": "boolean"
+      }
+    }
+  },
+  {
+    "title": "inlayHints",
+    "properties": {
+      "rust-analyzer.inlayHints.genericParameterHints.lifetime.enable": {
+        "markdownDescription": "Whether to show generic lifetime parameter name inlay hints.",
+        "default": false,
+        "type": "boolean"
+      }
+    }
+  },
+  {
+    "title": "inlayHints",
+    "properties": {
+      "rust-analyzer.inlayHints.genericParameterHints.type.enable": {
+        "markdownDescription": "Whether to show generic type parameter name inlay hints.",
+        "default": false,
+        "type": "boolean"
+      }
+    }
+  },
+  {
+    "title": "inlayHints",
+    "properties": {
       "rust-analyzer.inlayHints.implicitDrops.enable": {
         "markdownDescription": "Whether to show implicit drop hints.",
         "default": false,
@@ -1773,16 +1782,6 @@
   {
     "title": "lens",
     "properties": {
-      "rust-analyzer.lens.forceCustomCommands": {
-        "markdownDescription": "Internal config: use custom client-side commands even when the\nclient doesn't set the corresponding capability.",
-        "default": true,
-        "type": "boolean"
-      }
-    }
-  },
-  {
-    "title": "lens",
-    "properties": {
       "rust-analyzer.lens.implementations.enable": {
         "markdownDescription": "Whether to show `Implementations` lens. Only applies when\n`#rust-analyzer.lens.enable#` is set.",
         "default": true,
@@ -1884,7 +1883,8 @@
           "null",
           "integer"
         ],
-        "minimum": 0
+        "minimum": 0,
+        "maximum": 65535
       }
     }
   },
@@ -1909,16 +1909,6 @@
     }
   },
   {
-    "title": "notifications",
-    "properties": {
-      "rust-analyzer.notifications.unindexedProject": {
-        "markdownDescription": "Whether to send an UnindexedProject notification to the client.",
-        "default": false,
-        "type": "boolean"
-      }
-    }
-  },
-  {
     "title": "general",
     "properties": {
       "rust-analyzer.numThreads": {
@@ -2222,6 +2212,40 @@
       }
     }
   },
+  {
+    "title": "workspace",
+    "properties": {
+      "rust-analyzer.workspace.discoverConfig": {
+        "markdownDescription": "Enables automatic discovery of projects using [`DiscoverWorkspaceConfig::command`].\n\n[`DiscoverWorkspaceConfig`] also requires setting `progress_label` and `files_to_watch`.\n`progress_label` is used for the title in progress indicators, whereas `files_to_watch`\nis used to determine which build system-specific files should be watched in order to\nreload rust-analyzer.\n\nBelow is an example of a valid configuration:\n```json\n\"rust-analyzer.workspace.discoverConfig\": {\n        \"command\": [\n                \"rust-project\",\n                \"develop-json\"\n        ],\n        \"progressLabel\": \"rust-analyzer\",\n        \"filesToWatch\": [\n                \"BUCK\"\n        ]\n}\n```\n\n## On `DiscoverWorkspaceConfig::command`\n\n**Warning**: This format is provisional and subject to change.\n\n[`DiscoverWorkspaceConfig::command`] *must* return a JSON object\ncorresponding to `DiscoverProjectData::Finished`:\n\n```norun\n#[derive(Debug, Clone, Deserialize, Serialize)]\n#[serde(tag = \"kind\")]\n#[serde(rename_all = \"snake_case\")]\nenum DiscoverProjectData {\n        Finished { buildfile: Utf8PathBuf, project: ProjectJsonData },\n        Error { error: String, source: Option<String> },\n        Progress { message: String },\n}\n```\n\nAs JSON, `DiscoverProjectData::Finished` is:\n\n```json\n{\n        // the internally-tagged representation of the enum.\n        \"kind\": \"finished\",\n        // the file used by a non-Cargo build system to define\n        // a package or target.\n        \"buildfile\": \"rust-analyzer/BUILD\",\n        // the contents of a rust-project.json, elided for brevity\n        \"project\": {\n                \"sysroot\": \"foo\",\n                \"crates\": []\n        }\n}\n```\n\nIt is encouraged, but not required, to use the other variants on\n`DiscoverProjectData` to provide a more polished end-user experience.\n\n`DiscoverWorkspaceConfig::command` may *optionally* include an `{arg}`,\nwhich will be substituted with the JSON-serialized form of the following\nenum:\n\n```norun\n#[derive(PartialEq, Clone, Debug, Serialize)]\n#[serde(rename_all = \"camelCase\")]\npub enum DiscoverArgument {\n     Path(AbsPathBuf),\n     Buildfile(AbsPathBuf),\n}\n```\n\nThe JSON representation of `DiscoverArgument::Path` is:\n\n```json\n{\n        \"path\": \"src/main.rs\"\n}\n```\n\nSimilarly, the JSON representation of `DiscoverArgument::Buildfile` is:\n\n```\n{\n        \"buildfile\": \"BUILD\"\n}\n```\n\n`DiscoverArgument::Path` is used to find and generate a `rust-project.json`,\nand therefore, a workspace, whereas `DiscoverArgument::buildfile` is used to\nto update an existing workspace. As a reference for implementors,\nbuck2's `rust-project` will likely be useful:\nhttps://github.com/facebook/buck2/tree/main/integrations/rust-project.",
+        "default": null,
+        "anyOf": [
+          {
+            "type": "null"
+          },
+          {
+            "type": "object",
+            "properties": {
+              "command": {
+                "type": "array",
+                "items": {
+                  "type": "string"
+                }
+              },
+              "progressLabel": {
+                "type": "string"
+              },
+              "filesToWatch": {
+                "type": "array",
+                "items": {
+                  "type": "string"
+                }
+              }
+            }
+          }
+        ]
+      }
+    }
+  },
   {
     "title": "workspace",
     "properties": {