增加全局 conf 属性: extensionPath
This commit is contained in:
parent
9dc59280e6
commit
5540b0b1f2
@ -2,6 +2,7 @@ use std::fs::{self, File};
|
||||
use std::io::BufRead;
|
||||
use std::io::BufReader;
|
||||
use std::path::PathBuf;
|
||||
#[allow(unused)]
|
||||
use log::info;
|
||||
use regex::Regex;
|
||||
use ropey::Rope;
|
||||
|
@ -69,15 +69,38 @@ pub enum LogLevel {
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct ProjectConfig {
|
||||
// 用户工作目录的路径
|
||||
pub workspace_folder: Option<Url>,
|
||||
pub tool_chain: String
|
||||
// 插件安装的根路径
|
||||
pub extension_path: String,
|
||||
// 当前工具链
|
||||
pub tool_chain: String,
|
||||
// if true, recursively search the working directory for files to run diagnostics on
|
||||
pub auto_search_workdir: bool,
|
||||
// list of directories with header files
|
||||
pub include_dirs: Vec<String>,
|
||||
// list of directories to recursively search for SystemVerilog/Verilog sources
|
||||
pub source_dirs: Vec<String>,
|
||||
// config options for verible tools
|
||||
pub verible: Verible,
|
||||
// config options for verilator tools
|
||||
pub verilator: Verilator,
|
||||
// log level
|
||||
pub log_level: LogLevel
|
||||
}
|
||||
|
||||
impl Default for ProjectConfig {
|
||||
fn default() -> Self {
|
||||
ProjectConfig {
|
||||
workspace_folder: None,
|
||||
tool_chain: "xilinx".to_string()
|
||||
extension_path: "".to_string(),
|
||||
tool_chain: "xilinx".to_string(),
|
||||
auto_search_workdir: true,
|
||||
include_dirs: Vec::new(),
|
||||
source_dirs: Vec::new(),
|
||||
verible: Verible::default(),
|
||||
verilator: Verilator::default(),
|
||||
log_level: LogLevel::Info,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -171,7 +194,18 @@ impl LanguageServer for Backend {
|
||||
|
||||
let mut configure = self.server.conf.write().unwrap();
|
||||
configure.workspace_folder = root_uri.clone();
|
||||
info!("当前客户端配置 workspaceFolder: {:?}", params.root_uri);
|
||||
|
||||
if let Some(serde_json::Value::Object(options)) = params.initialization_options {
|
||||
let extension_path = options.get("extensionPath").unwrap().as_str().unwrap();
|
||||
let tool_chain = options.get("toolChain").unwrap().as_str().unwrap();
|
||||
configure.tool_chain = tool_chain.to_string();
|
||||
configure.extension_path = extension_path.to_string();
|
||||
}
|
||||
|
||||
info!("当前客户端初始化结果");
|
||||
info!("workspaceFolder: {:?}", configure.workspace_folder);
|
||||
info!("extensionPath: {:?}", configure.extension_path);
|
||||
info!("toolChain: {:?}", configure.tool_chain);
|
||||
|
||||
let text_document_sync = TextDocumentSyncCapability::Options(
|
||||
TextDocumentSyncOptions {
|
||||
|
Loading…
x
Reference in New Issue
Block a user