修复 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) {
|
async fn did_close(&self, params: DidCloseTextDocumentParams) {
|
||||||
// 获取诊断相关的配置信息,如果 mode 为 common,则需要清空关闭文件的诊断信息
|
// 获取诊断相关的配置信息,如果 mode 为 common,则需要清空关闭文件的诊断信息
|
||||||
|
// 如果同一个文件短时间内多次调用该方法,则读写锁会失效
|
||||||
if let Some(linter_mode) = self.server.db.get_lsp_configuration_string_value("digital-ide.function.lsp.linter.mode") {
|
if let Some(linter_mode) = self.server.db.get_lsp_configuration_string_value("digital-ide.function.lsp.linter.mode") {
|
||||||
if linter_mode == "common" {
|
if linter_mode == "common" {
|
||||||
self.client.publish_diagnostics(params.text_document.uri, vec![], None).await;
|
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) {
|
if let Some(source) = self.db.get_source(&path_string) {
|
||||||
let source = source.read().unwrap();
|
if let Some(linter_mode) = self.db.get_lsp_configuration_string_value("digital-ide.function.lsp.linter.mode") {
|
||||||
let diagnostics = provide_diagnostics(
|
if linter_mode != "shutdown" {
|
||||||
uri,
|
let source = source.read().unwrap();
|
||||||
&source.text,
|
let diagnostics = provide_diagnostics(
|
||||||
&self
|
uri,
|
||||||
);
|
&source.text,
|
||||||
diagnostics
|
&self
|
||||||
} else {
|
);
|
||||||
PublishDiagnosticsParams {
|
return diagnostics
|
||||||
uri,
|
}
|
||||||
diagnostics: Vec::new(),
|
|
||||||
version: None,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PublishDiagnosticsParams {
|
||||||
|
uri,
|
||||||
|
diagnostics: Vec::new(),
|
||||||
|
version: None,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn did_change(&self, params: DidChangeTextDocumentParams) {
|
pub fn did_change(&self, params: DidChangeTextDocumentParams) {
|
||||||
@ -109,19 +113,23 @@ impl LspServer {
|
|||||||
let path_string = from_uri_to_escape_path_string(&uri).unwrap();
|
let path_string = from_uri_to_escape_path_string(&uri).unwrap();
|
||||||
|
|
||||||
if let Some(source) = self.db.get_source(&path_string) {
|
if let Some(source) = self.db.get_source(&path_string) {
|
||||||
let source = source.read().unwrap();
|
if let Some(linter_mode) = self.db.get_lsp_configuration_string_value("digital-ide.function.lsp.linter.mode") {
|
||||||
provide_diagnostics(
|
if linter_mode != "shutdown" {
|
||||||
uri,
|
let source = source.read().unwrap();
|
||||||
&source.text,
|
return provide_diagnostics(
|
||||||
&self
|
uri,
|
||||||
)
|
&source.text,
|
||||||
} else {
|
&self
|
||||||
PublishDiagnosticsParams {
|
);
|
||||||
uri,
|
}
|
||||||
diagnostics: Vec::new(),
|
|
||||||
version: None,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PublishDiagnosticsParams {
|
||||||
|
uri,
|
||||||
|
diagnostics: Vec::new(),
|
||||||
|
version: None,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn did_delete_files(&self, params: DeleteFilesParams) {
|
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