Initial commit of highlight related configuration w/ implementation.
This commit is contained in:
@@ -11,8 +11,8 @@ use std::{ffi::OsString, iter, path::PathBuf};
|
||||
|
||||
use flycheck::FlycheckConfig;
|
||||
use ide::{
|
||||
AssistConfig, CompletionConfig, DiagnosticsConfig, HoverConfig, HoverDocFormat,
|
||||
InlayHintsConfig, JoinLinesConfig,
|
||||
AssistConfig, CompletionConfig, DiagnosticsConfig, HighlightRelatedConfig, HoverConfig,
|
||||
HoverDocFormat, InlayHintsConfig, JoinLinesConfig,
|
||||
};
|
||||
use ide_db::helpers::{
|
||||
insert_use::{ImportGranularity, InsertUseConfig, PrefixKind},
|
||||
@@ -261,6 +261,14 @@ config_data! {
|
||||
workspace_symbol_search_scope: WorskpaceSymbolSearchScopeDef = "\"workspace\"",
|
||||
/// Workspace symbol search kind.
|
||||
workspace_symbol_search_kind: WorskpaceSymbolSearchKindDef = "\"only_types\"",
|
||||
|
||||
highlightRelated_references: bool = "true",
|
||||
|
||||
highlightRelated_exitPoints: bool = "true",
|
||||
|
||||
highlightRelated_breakPoints: bool = "true",
|
||||
|
||||
highlightRelated_yieldPoints: bool = "true",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -852,6 +860,15 @@ impl Config {
|
||||
false
|
||||
)
|
||||
}
|
||||
|
||||
pub fn highlight_related(&self) -> HighlightRelatedConfig {
|
||||
HighlightRelatedConfig {
|
||||
references: self.data.highlightRelated_references,
|
||||
break_points: self.data.highlightRelated_breakPoints,
|
||||
exit_points: self.data.highlightRelated_exitPoints,
|
||||
yield_points: self.data.highlightRelated_yieldPoints,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, Clone)]
|
||||
|
||||
@@ -1188,7 +1188,7 @@ pub(crate) fn handle_document_highlight(
|
||||
let position = from_proto::file_position(&snap, params.text_document_position_params)?;
|
||||
let line_index = snap.file_line_index(position.file_id)?;
|
||||
|
||||
let refs = match snap.analysis.highlight_related(position)? {
|
||||
let refs = match snap.analysis.highlight_related(snap.config.highlight_related(), position)? {
|
||||
None => return Ok(None),
|
||||
Some(refs) => refs,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user