修复 linter mode 未正确使用的 bug
This commit is contained in:
parent
8d45345c54
commit
1d04a5f1cf
@ -255,6 +255,7 @@ impl LanguageServer for Backend {
|
||||
|
||||
async fn did_close(&self, params: DidCloseTextDocumentParams) {
|
||||
// 获取诊断相关的配置信息,如果 mode 为 common,则需要清空关闭文件的诊断信息
|
||||
// 如果同一个文件短时间内多次调用该方法,则读写锁会失效
|
||||
if let Some(linter_mode) = self.server.db.get_lsp_configuration_string_value("digital-ide.function.lsp.linter.mode") {
|
||||
if linter_mode == "common" {
|
||||
self.client.publish_diagnostics(params.text_document.uri, vec![], None).await;
|
||||
|
@ -59,20 +59,24 @@ impl LspServer {
|
||||
|
||||
// 生成诊断信息
|
||||
if let Some(source) = self.db.get_source(&path_string) {
|
||||
let source = source.read().unwrap();
|
||||
let diagnostics = provide_diagnostics(
|
||||
uri,
|
||||
&source.text,
|
||||
&self
|
||||
);
|
||||
diagnostics
|
||||
} else {
|
||||
PublishDiagnosticsParams {
|
||||
uri,
|
||||
diagnostics: Vec::new(),
|
||||
version: None,
|
||||
if let Some(linter_mode) = self.db.get_lsp_configuration_string_value("digital-ide.function.lsp.linter.mode") {
|
||||
if linter_mode != "shutdown" {
|
||||
let source = source.read().unwrap();
|
||||
let diagnostics = provide_diagnostics(
|
||||
uri,
|
||||
&source.text,
|
||||
&self
|
||||
);
|
||||
return diagnostics
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PublishDiagnosticsParams {
|
||||
uri,
|
||||
diagnostics: Vec::new(),
|
||||
version: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn did_change(&self, params: DidChangeTextDocumentParams) {
|
||||
@ -109,19 +113,23 @@ impl LspServer {
|
||||
let path_string = from_uri_to_escape_path_string(&uri).unwrap();
|
||||
|
||||
if let Some(source) = self.db.get_source(&path_string) {
|
||||
let source = source.read().unwrap();
|
||||
provide_diagnostics(
|
||||
uri,
|
||||
&source.text,
|
||||
&self
|
||||
)
|
||||
} else {
|
||||
PublishDiagnosticsParams {
|
||||
uri,
|
||||
diagnostics: Vec::new(),
|
||||
version: None,
|
||||
if let Some(linter_mode) = self.db.get_lsp_configuration_string_value("digital-ide.function.lsp.linter.mode") {
|
||||
if linter_mode != "shutdown" {
|
||||
let source = source.read().unwrap();
|
||||
return provide_diagnostics(
|
||||
uri,
|
||||
&source.text,
|
||||
&self
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PublishDiagnosticsParams {
|
||||
uri,
|
||||
diagnostics: Vec::new(),
|
||||
version: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn did_delete_files(&self, params: DeleteFilesParams) {
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 5be43b5881551523880594828df3b711ed234ccd
|
||||
Subproject commit 2588d1dac8b7015632a453b293794744a75c240b
|
Loading…
x
Reference in New Issue
Block a user