refactor some small session fields
Some checks are pending
lint / cargo-check (push) Waiting to run
lint / clippy (push) Waiting to run
lint / pre-commit (push) Waiting to run
lint / rustfmt (push) Waiting to run
release / build (push) Waiting to run
release / test (push) Waiting to run
release / release (push) Blocked by required conditions
test / generate-matrix (push) Waiting to run
test / Python , Django () (push) Blocked by required conditions
test / tests (push) Blocked by required conditions
zizmor 🌈 / zizmor latest via PyPI (push) Waiting to run

This commit is contained in:
Josh Thomas 2025-05-17 23:24:14 -05:00
parent 9e13422245
commit de5e65c10d
2 changed files with 13 additions and 8 deletions

View file

@ -61,7 +61,7 @@ impl LanguageServer for DjangoLanguageServer {
client::log_message(MessageType::INFO, "Initializing server...");
self.with_session_mut(|session| {
*session.client_capabilities_mut() = Some(params.capabilities);
session.set_client_capabilities(params.capabilities);
})
.await;
@ -121,9 +121,11 @@ impl LanguageServer for DjangoLanguageServer {
self.with_session_mut(|session| {
let settings = djls_conf::Settings::new(&project_path)
.unwrap_or_else(|_| djls_conf::Settings::default());
*session.settings_mut() = settings;
session.set_settings(settings);
let project = djls_project::DjangoProject::new(project_path);
session.set_project(project);
*session.project_mut() = Some(djls_project::DjangoProject::new(project_path));
true
})
.await
@ -298,7 +300,7 @@ impl LanguageServer for DjangoLanguageServer {
if let Some(path) = project_path {
self.with_session_mut(|session| match djls_conf::Settings::new(path.as_path()) {
Ok(new_settings) => {
*session.settings_mut() = new_settings;
session.set_settings(new_settings);
}
Err(e) => {
client::log_message(MessageType::ERROR, format!("Error loading settings: {e}"));