Report if language server requires Node or not

This commit is contained in:
Julia 2023-03-21 14:39:20 -04:00
parent d89936e4a9
commit b579211861
13 changed files with 75 additions and 8 deletions

View file

@ -77,6 +77,12 @@ pub trait ToLspPosition {
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct LanguageServerName(pub Arc<str>);
#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize)]
pub enum ServerExecutionKind {
Launch,
Node,
}
/// Represents a Language Server, with certain cached sync properties.
/// Uses [`LspAdapter`] under the hood, but calls all 'static' methods
/// once at startup, and caches the results.
@ -172,6 +178,8 @@ impl CachedLspAdapter {
pub trait LspAdapter: 'static + Send + Sync {
async fn name(&self) -> LanguageServerName;
async fn server_execution_kind(&self) -> ServerExecutionKind;
async fn fetch_latest_server_version(
&self,
http: Arc<dyn HttpClient>,
@ -1442,6 +1450,10 @@ impl LspAdapter for Arc<FakeLspAdapter> {
LanguageServerName(self.name.into())
}
async fn server_execution_kind(&self) -> ServerExecutionKind {
ServerExecutionKind::Launch
}
async fn fetch_latest_server_version(
&self,
_: Arc<dyn HttpClient>,