Skip to content

Commit

Permalink
Add option for the libraries location as part of the vhdl_lang execut…
Browse files Browse the repository at this point in the history
…able
  • Loading branch information
Schottkyc137 committed Sep 21, 2024
1 parent 3b04fe5 commit b7dc42f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions vhdl_ls/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ struct Args {
#[arg(long, default_value_t = false)]
no_lint: bool,

/// Path to the config file for the VHDL standard libraries (i.e., IEEE std_logic_1164).
/// If omitted, will search for these libraries in a set of standard paths
#[arg(short = 'l', long)]
libraries: Option<String>,

/// Normally warning and error messages are sent to window/showMessage
/// This will silence all window/showMessage and only use window/logMessage
#[arg(long, default_value_t = false)]
Expand All @@ -28,6 +33,7 @@ fn main() {
vhdl_ls::start(VHDLServerSettings {
no_lint: args.no_lint,
silent: args.silent,
libraries_path: args.libraries,
..Default::default()
});
}
6 changes: 5 additions & 1 deletion vhdl_ls/src/vhdl_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ pub struct VHDLServerSettings {
pub no_lint: bool,
pub silent: bool,
pub non_project_file_handling: NonProjectFileHandling,
pub libraries_path: Option<String>,
}

pub struct VHDLServer {
Expand Down Expand Up @@ -123,7 +124,10 @@ impl VHDLServer {
let mut config = Config::default();

if self.use_external_config {
config.load_external_config(&mut self.message_filter(), None);
config.load_external_config(
&mut self.message_filter(),
self.settings.libraries_path.clone(),
);
}

match self.load_root_uri_config() {
Expand Down

0 comments on commit b7dc42f

Please sign in to comment.