实现 did_close 事件
This commit is contained in:
parent
826d62dfbd
commit
9119cfb0ed
@ -183,18 +183,6 @@ pub fn update_diagnostics_configuration(
|
||||
|
||||
}
|
||||
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(serde::Serialize)]
|
||||
pub enum DigitalLinterMode {
|
||||
/// 全局诊断,将所有设计源直接进行诊断,并报错,无论文件是否打开
|
||||
FULL,
|
||||
/// 单文件关闭时,对应报错去除,打开哪个文件就对哪个文件进行诊断
|
||||
SINGLE,
|
||||
/// 全局关闭,即整个工程都不进行工程报错
|
||||
NONE
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(serde::Serialize)]
|
||||
pub struct DigitalLinterConfiguration {
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::completion::directives::provide_vlog_directives_completions;
|
||||
use crate::core::cache_storage::CacheManager;
|
||||
use crate::diagnostics::{DigitalLinterConfiguration, DigitalLinterMode};
|
||||
use crate::diagnostics::DigitalLinterConfiguration;
|
||||
use crate::sources::*;
|
||||
use crate::completion::{keyword::*, provide_vlog_sys_tasks_completions};
|
||||
use flexi_logger::LoggerHandle;
|
||||
@ -97,8 +97,6 @@ pub struct LspConfiguration {
|
||||
|
||||
|
||||
// 下方是和 linter 相关的配置
|
||||
// 诊断模式
|
||||
pub linter_mode: DigitalLinterMode,
|
||||
// vlog 的诊断配置
|
||||
pub vlog_linter_configuration: DigitalLinterConfiguration,
|
||||
// vhdl 的诊断配置
|
||||
@ -118,7 +116,6 @@ impl Default for LspConfiguration {
|
||||
auto_search_workdir: true,
|
||||
include_dirs: Vec::new(),
|
||||
source_dirs: Vec::new(),
|
||||
linter_mode: DigitalLinterMode::FULL,
|
||||
vlog_linter_configuration: DigitalLinterConfiguration::new("verilog"),
|
||||
vhdl_linter_configuration: DigitalLinterConfiguration::new("vhdl"),
|
||||
svlog_linter_configuration: DigitalLinterConfiguration::new("systemverilog"),
|
||||
@ -254,6 +251,14 @@ impl LanguageServer for Backend {
|
||||
// }
|
||||
}
|
||||
|
||||
async fn did_close(&self, params: DidCloseTextDocumentParams) {
|
||||
// 获取诊断相关的配置信息,如果 mode 为 common,则需要清空关闭文件的诊断信息
|
||||
let linter_mode = self.server.srcs.get_lsp_configuration_string_value("digital-ide.function.lsp.linter.linter-mode").unwrap();
|
||||
if linter_mode == "common" {
|
||||
self.client.publish_diagnostics(params.text_document.uri, vec![], None).await;
|
||||
}
|
||||
}
|
||||
|
||||
async fn did_change(&self, params: DidChangeTextDocumentParams) {
|
||||
// // 如果文件太大则显示错误
|
||||
// if CacheManager::uri_is_big_file(¶ms.text_document.uri) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user