Unconditionally enable location links in inlay hints again

This commit is contained in:
Lukas Wirth 2023-01-16 16:04:38 +01:00
parent 5306eb06cc
commit 3a95864df5
7 changed files with 38 additions and 54 deletions

View file

@ -183,8 +183,6 @@ fn run_server() -> Result<()> {
}
}
config.client_specific_adjustments(&initialize_params.client_info);
let server_capabilities = rust_analyzer::server_capabilities(&config);
let initialize_result = lsp_types::InitializeResult {

View file

@ -20,7 +20,7 @@ use ide_db::{
SnippetCap,
};
use itertools::Itertools;
use lsp_types::{ClientCapabilities, ClientInfo, MarkupKind};
use lsp_types::{ClientCapabilities, MarkupKind};
use project_model::{
CargoConfig, CargoFeatures, ProjectJson, ProjectJsonData, ProjectManifest, RustcSource,
UnsetTestCrates,
@ -342,8 +342,6 @@ config_data! {
inlayHints_lifetimeElisionHints_enable: LifetimeElisionDef = "\"never\"",
/// Whether to prefer using parameter names as the name for elided lifetime hints if possible.
inlayHints_lifetimeElisionHints_useParameterNames: bool = "false",
/// Whether to use location links for parts of type mentioned in inlay hints.
inlayHints_locationLinks: bool = "true",
/// Maximum length for inlay hints. Set to null to have an unlimited length.
inlayHints_maxLength: Option<usize> = "25",
/// Whether to show function parameter name inlay hints at the call
@ -728,19 +726,6 @@ impl Config {
}
}
pub fn client_specific_adjustments(&mut self, client_info: &Option<ClientInfo>) {
// FIXME: remove this when we drop support for vscode 1.65 and below
if let Some(client) = client_info {
if client.name.contains("Code") || client.name.contains("Codium") {
if let Some(version) = &client.version {
if version.as_str() < "1.76" {
self.data.inlayHints_locationLinks = false;
}
}
}
}
}
pub fn update(&mut self, mut json: serde_json::Value) -> Result<(), ConfigUpdateError> {
tracing::info!("updating config from JSON: {:#}", json);
if json.is_null() || json.as_object().map_or(false, |it| it.is_empty()) {
@ -1229,7 +1214,6 @@ impl Config {
pub fn inlay_hints(&self) -> InlayHintsConfig {
InlayHintsConfig {
location_links: self.data.inlayHints_locationLinks,
render_colons: self.data.inlayHints_renderColons,
type_hints: self.data.inlayHints_typeHints_enable,
parameter_hints: self.data.inlayHints_parameterHints_enable,