Skip to content

Commit d31e492

Browse files
committed
Add option to allow disable echo project root.
Close #772.
1 parent 15cc7c7 commit d31e492

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

Diff for: src/language_server_protocol.rs

+12-7
Original file line numberDiff line numberDiff line change
@@ -110,17 +110,19 @@ impl LanguageClient {
110110
.as_ref(),
111111
)?;
112112

113-
let (diagnosticsSignsMax, documentHighlightDisplay, selectionUI_autoOpen, use_virtual_text): (
114-
Option<u64>,
115-
Value,
116-
u8,
117-
u8,
118-
) = self.vim()?.eval(
113+
let (
114+
diagnosticsSignsMax,
115+
documentHighlightDisplay,
116+
selectionUI_autoOpen,
117+
use_virtual_text,
118+
echo_project_root,
119+
): (Option<u64>, Value, u8, u8, u8) = self.vim()?.eval(
119120
[
120121
"get(g:, 'LanguageClient_diagnosticsSignsMax', v:null)",
121122
"get(g:, 'LanguageClient_documentHighlightDisplay', {})",
122123
"!!s:GetVar('LanguageClient_selectionUI_autoOpen', 1)",
123124
"s:useVirtualText()",
125+
"!!s:GetVar('LanguageClient_echoProjectRoot', 1)",
124126
]
125127
.as_ref(),
126128
)?;
@@ -207,6 +209,7 @@ impl LanguageClient {
207209
state.hoverPreview = hoverPreview;
208210
state.completionPreferTextEdit = completionPreferTextEdit;
209211
state.use_virtual_text = use_virtual_text == 1;
212+
state.echo_project_root = echo_project_root == 1;
210213
state.loggingFile = loggingFile;
211214
state.loggingLevel = loggingLevel;
212215
state.serverStderr = serverStderr;
@@ -2751,7 +2754,9 @@ impl LanguageClient {
27512754
.into()
27522755
};
27532756
let message = format!("Project root: {}", root);
2754-
self.vim()?.echomsg_ellipsis(&message)?;
2757+
if self.get(|state| state.echo_project_root)? {
2758+
self.vim()?.echomsg_ellipsis(&message)?;
2759+
}
27552760
info!("{}", message);
27562761
self.update(|state| {
27572762
state.roots.insert(languageId.clone(), root.clone());

Diff for: src/types.rs

+2
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ pub struct State {
160160
pub hoverPreview: HoverPreviewOption,
161161
pub completionPreferTextEdit: bool,
162162
pub use_virtual_text: bool,
163+
pub echo_project_root: bool,
163164

164165
pub loggingFile: Option<String>,
165166
pub loggingLevel: log::LevelFilter,
@@ -234,6 +235,7 @@ impl State {
234235
hoverPreview: HoverPreviewOption::default(),
235236
completionPreferTextEdit: false,
236237
use_virtual_text: true,
238+
echo_project_root: true,
237239
loggingFile: None,
238240
loggingLevel: log::LevelFilter::Warn,
239241
serverStderr: None,

0 commit comments

Comments
 (0)