mirror of
https://github.com/joshuadavidthomas/django-language-server.git
synced 2025-07-19 02:15:09 +00:00
remove import check for django in setup (#27)
unneeded now since the agent imports and sets up Django as part of it's initial serving
This commit is contained in:
parent
9bbc2c2c3a
commit
b13d19a4bf
10 changed files with 21 additions and 104 deletions
|
@ -1,7 +1,6 @@
|
|||
mod packaging;
|
||||
mod python;
|
||||
|
||||
pub use crate::packaging::ImportCheck;
|
||||
pub use crate::packaging::PackagingError;
|
||||
pub use crate::python::Python;
|
||||
pub use crate::python::PythonError;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use djls_ipc::v1::*;
|
||||
use djls_ipc::{ProcessError, PythonProcess, TransportError};
|
||||
use djls_ipc::{ProcessError, TransportError};
|
||||
use serde::Deserialize;
|
||||
use std::collections::HashMap;
|
||||
use std::fmt;
|
||||
|
@ -69,40 +69,6 @@ impl fmt::Display for Packages {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct ImportCheck {
|
||||
can_import: bool,
|
||||
}
|
||||
|
||||
impl ImportCheck {
|
||||
pub fn can_import(&self) -> bool {
|
||||
self.can_import
|
||||
}
|
||||
|
||||
pub fn check(
|
||||
python: &mut PythonProcess,
|
||||
_modules: Option<Vec<String>>,
|
||||
) -> Result<bool, PackagingError> {
|
||||
let request = messages::Request {
|
||||
command: Some(messages::request::Command::CheckDjangoAvailable(
|
||||
check::DjangoAvailableRequest {},
|
||||
)),
|
||||
};
|
||||
|
||||
let response = python
|
||||
.send(request)
|
||||
.map_err(|e| PackagingError::Transport(e))?;
|
||||
|
||||
match response.result {
|
||||
Some(messages::response::Result::CheckDjangoAvailable(response)) => Ok(response.passed),
|
||||
Some(messages::response::Result::Error(e)) => {
|
||||
Err(PackagingError::Process(ProcessError::Health(e.message)))
|
||||
}
|
||||
_ => Err(PackagingError::Process(ProcessError::Response)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum PackagingError {
|
||||
#[error("IO error: {0}")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue