mirror of
https://github.com/joshuadavidthomas/django-language-server.git
synced 2025-09-14 06:15:07 +00:00
swap in tower-lsp-server dependency (#100)
This commit is contained in:
parent
33fb726bdc
commit
e098272ea6
11 changed files with 72 additions and 51 deletions
|
@ -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")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue