Skip to content

Commit a651517

Browse files
committed
move initialization up to avoid lsps starting with old config
1 parent a853eaa commit a651517

File tree

2 files changed

+23
-35
lines changed

2 files changed

+23
-35
lines changed

helix-term/src/application.rs

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,27 @@ impl Application {
138138
let editor_view = Box::new(ui::EditorView::new(Keymaps::new(keys)));
139139
compositor.push(editor_view);
140140

141+
let mut jobs = Jobs::new();
142+
{
143+
let syn_loader = editor.syn_loader.clone();
144+
145+
let mut cx = crate::commands::Context {
146+
register: None,
147+
count: std::num::NonZeroUsize::new(1),
148+
editor: &mut editor,
149+
callback: Vec::new(),
150+
on_next_key_callback: None,
151+
jobs: &mut jobs,
152+
};
153+
154+
crate::commands::ScriptingEngine::run_initialization_script(
155+
&mut cx,
156+
config.clone(),
157+
syn_loader,
158+
terminal.backend().terminal().event_reader(),
159+
);
160+
}
161+
141162
if args.load_tutor {
142163
let path = helix_loader::runtime_file(Path::new("tutor"));
143164
editor.open(&path, Action::VerticalSplit)?;
@@ -241,36 +262,16 @@ impl Application {
241262
])
242263
.context("build signal handler")?;
243264

244-
let mut app = Self {
265+
let app = Self {
245266
compositor,
246267
terminal,
247268
editor,
248269
config,
249270
signals,
250-
jobs: Jobs::new(),
271+
jobs,
251272
lsp_progress: LspProgressMap::new(),
252273
};
253274

254-
{
255-
let syn_loader = app.editor.syn_loader.clone();
256-
257-
let mut cx = crate::commands::Context {
258-
register: None,
259-
count: std::num::NonZeroUsize::new(1),
260-
editor: &mut app.editor,
261-
callback: Vec::new(),
262-
on_next_key_callback: None,
263-
jobs: &mut app.jobs,
264-
};
265-
266-
crate::commands::ScriptingEngine::run_initialization_script(
267-
&mut cx,
268-
app.config.clone(),
269-
syn_loader,
270-
app.terminal.backend().terminal().event_reader(),
271-
);
272-
}
273-
274275
Ok(app)
275276
}
276277

helix-term/src/commands/engine/steel/mod.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,6 @@ fn dynamic_set_option(
998998

999999
let key_error = || anyhow::anyhow!("Unknown key `{}`", key);
10001000

1001-
// let mut config = serde_json::json!(&cx.editor.config().deref());
10021001
let mut config = serde_json::json!(configuration.load_config().editor);
10031002
let pointer = format!("/{}", key.replace('.', "/"));
10041003
let jvalue = config.pointer_mut(&pointer).ok_or_else(key_error)?;
@@ -3061,18 +3060,6 @@ impl HelixConfiguration {
30613060
Ok(())
30623061
}
30633062

3064-
// fn get_individual_language_config_for_filename(
3065-
// &self,
3066-
// file_name: SteelString,
3067-
// ) -> Option<IndividualLanguageConfiguration> {
3068-
// self.language_configuration
3069-
// .load()
3070-
// .language_config_for_file_name(std::path::Path::new(file_name.as_str()))
3071-
// .map(|config| IndividualLanguageConfiguration {
3072-
// config: (*config).clone(),
3073-
// })
3074-
// }
3075-
30763063
fn update_language_server_config(
30773064
&mut self,
30783065
lsp: SteelString,

0 commit comments

Comments
 (0)