Skip to content

Commit

Permalink
fix: startup config process
Browse files Browse the repository at this point in the history
  • Loading branch information
ttak0422 committed Jan 17, 2024
1 parent a07afa8 commit c9b330c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
16 changes: 13 additions & 3 deletions bundler/src/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,19 @@ pub fn bundle<'a>(config: &'a content::Content) -> Bundle<'a> {
content::Package::EagerPlugin(p) => {
let id = config.id_table.get(p);
load_option.plugin_paths.insert(id, p.nix_package.as_str());
load_option.startup_plugins.push(id);
if !p.startup_config.is_empty() {
load_option.startup_config_plugins.push(id);
}
}
content::Package::LazyPlugin(p) => {
let id = config.id_table.get(p);

load_option.plugin_paths.insert(id, p.nix_package.as_str());

if !p.startup_config.is_empty() {
load_option.startup_config_plugins.push(id);
}

for module in &p.on_modules {
load_option
.on_modules
Expand Down Expand Up @@ -180,6 +186,10 @@ pub fn bundle<'a>(config: &'a content::Content) -> Bundle<'a> {
content::Package::LazyGroup(g) => {
let id = g.name.as_str();

if !g.startup_config.is_empty() {
load_option.startup_config_plugins.push(id);
}

for module in &g.on_modules {
load_option
.on_modules
Expand Down Expand Up @@ -225,8 +235,8 @@ pub fn bundle<'a>(config: &'a content::Content) -> Bundle<'a> {
plugins.sort();
plugins.dedup();
}
load_option.startup_plugins.sort();
load_option.startup_plugins.dedup();
load_option.startup_config_plugins.sort();
load_option.startup_config_plugins.dedup();
load_option.timer_clients.sort();
load_option.timer_clients.dedup();
load_option.denops_clients.sort();
Expand Down
2 changes: 1 addition & 1 deletion bundler/src/bundle/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct Component<'a> {
#[derive(Default)]
pub struct LoadOption<'a> {
pub plugin_paths: HashMap<PluginId<'a>, PluginPath<'a>>,
pub startup_plugins: Vec<&'a str>,
pub startup_config_plugins: Vec<&'a str>,
pub on_modules: HashMap<&'a str, Vec<&'a str>>,
pub on_events: HashMap<&'a str, Vec<&'a str>>,
pub on_filetypes: HashMap<&'a str, Vec<&'a str>>,
Expand Down
2 changes: 1 addition & 1 deletion bundler/src/bundle/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl<'a> Exporter for LoadOption<'a> {
write!(
startup_plugins_file,
"return {}",
to_lua_table(&self.startup_plugins)
to_lua_table(&self.startup_config_plugins)
)?;

// modules
Expand Down

0 comments on commit c9b330c

Please sign in to comment.