summaryrefslogtreecommitdiff
path: root/cli/lsp/mod.rs
blob: 4723f8b561a0b854be60a0b910c781b39658b9a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.

use deno_core::error::AnyError;
use lspower::LspService;
use lspower::Server;

mod analysis;
mod capabilities;
mod code_lens;
mod completions;
mod config;
mod diagnostics;
mod documents;
pub(crate) mod language_server;
mod lsp_custom;
mod parent_process_checker;
mod path_to_regex;
mod performance;
mod registries;
mod semantic_tokens;
mod sources;
mod text;
mod tsc;
mod urls;

pub async fn start(parent_pid: Option<u32>) -> Result<(), AnyError> {
  let stdin = tokio::io::stdin();
  let stdout = tokio::io::stdout();

  if let Some(parent_pid) = parent_pid {
    parent_process_checker::start(parent_pid);
  }

  let (service, messages) =
    LspService::new(language_server::LanguageServer::new);
  Server::new(stdin, stdout)
    .interleave(messages)
    .serve(service)
    .await;

  Ok(())
}