swap in tower-lsp-server dependency (#100)

This commit is contained in:
Josh Thomas 2025-04-21 13:52:28 -05:00 committed by GitHub
parent 33fb726bdc
commit e098272ea6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 72 additions and 51 deletions

View file

@ -5,7 +5,7 @@ pub use templatetags::TemplateTags;
use pyo3::prelude::*;
use std::fmt;
use std::path::{Path, PathBuf};
use tower_lsp::lsp_types::*;
use tower_lsp_server::lsp_types::*;
use which::which;
#[derive(Debug)]
@ -24,21 +24,6 @@ impl DjangoProject {
}
}
pub fn from_initialize_params(params: &InitializeParams) -> Option<Self> {
// Try current directory first
let path = std::env::current_dir()
.ok()
// Fall back to workspace root if provided
.or_else(|| {
params
.root_uri
.as_ref()
.and_then(|uri| uri.to_file_path().ok())
});
path.map(Self::new)
}
pub fn initialize(&mut self) -> PyResult<()> {
let python_env = PythonEnvironment::new().ok_or_else(|| {
PyErr::new::<pyo3::exceptions::PyRuntimeError, _>("Could not find Python in PATH")