2021-01-11 12:13:41 -05:00
|
|
|
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
|
2021-05-11 00:54:10 -04:00
|
|
|
|
2020-12-21 08:44:26 -05:00
|
|
|
use deno_core::error::AnyError;
|
|
|
|
use lspower::LspService;
|
|
|
|
use lspower::Server;
|
2020-12-07 05:46:39 -05:00
|
|
|
|
|
|
|
mod analysis;
|
|
|
|
mod capabilities;
|
2021-06-04 17:31:44 -04:00
|
|
|
mod code_lens;
|
2021-03-24 20:13:37 -04:00
|
|
|
mod completions;
|
2020-12-07 05:46:39 -05:00
|
|
|
mod config;
|
|
|
|
mod diagnostics;
|
2021-01-22 05:03:16 -05:00
|
|
|
mod documents;
|
2021-04-08 21:27:27 -04:00
|
|
|
pub(crate) mod language_server;
|
2021-06-01 07:53:08 -04:00
|
|
|
mod lsp_custom;
|
2021-06-17 19:57:58 -04:00
|
|
|
mod parent_process_checker;
|
2021-04-08 21:27:27 -04:00
|
|
|
mod path_to_regex;
|
2021-01-26 19:32:49 -05:00
|
|
|
mod performance;
|
2021-04-08 21:27:27 -04:00
|
|
|
mod registries;
|
2021-04-19 21:26:36 -04:00
|
|
|
mod semantic_tokens;
|
2020-12-07 05:46:39 -05:00
|
|
|
mod sources;
|
|
|
|
mod text;
|
|
|
|
mod tsc;
|
2021-02-17 23:37:05 -05:00
|
|
|
mod urls;
|
2020-12-07 05:46:39 -05:00
|
|
|
|
2021-06-17 19:57:58 -04:00
|
|
|
pub async fn start(parent_pid: Option<u32>) -> Result<(), AnyError> {
|
2020-12-21 08:44:26 -05:00
|
|
|
let stdin = tokio::io::stdin();
|
|
|
|
let stdout = tokio::io::stdout();
|
2020-12-07 05:46:39 -05:00
|
|
|
|
2021-06-17 19:57:58 -04:00
|
|
|
if let Some(parent_pid) = parent_pid {
|
|
|
|
parent_process_checker::start(parent_pid);
|
|
|
|
}
|
|
|
|
|
2020-12-21 08:44:26 -05:00
|
|
|
let (service, messages) =
|
|
|
|
LspService::new(language_server::LanguageServer::new);
|
|
|
|
Server::new(stdin, stdout)
|
|
|
|
.interleave(messages)
|
|
|
|
.serve(service)
|
|
|
|
.await;
|
2020-12-07 05:46:39 -05:00
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|