2023-01-02 16:00:42 -05:00
|
|
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
2021-05-11 14:54:10 +10:00
|
|
|
|
2020-12-21 14:44:26 +01:00
|
|
|
use deno_core::error::AnyError;
|
2022-04-03 12:17:30 +08:00
|
|
|
use tower_lsp::LspService;
|
|
|
|
use tower_lsp::Server;
|
2020-12-07 21:46:39 +11:00
|
|
|
|
2022-04-03 12:17:30 +08:00
|
|
|
use crate::lsp::language_server::LanguageServer;
|
2021-12-15 13:23:43 -05:00
|
|
|
pub use repl::ReplCompletionItem;
|
|
|
|
pub use repl::ReplLanguageServer;
|
|
|
|
|
2020-12-07 21:46:39 +11:00
|
|
|
mod analysis;
|
2021-10-11 08:26:22 +11:00
|
|
|
mod cache;
|
2020-12-07 21:46:39 +11:00
|
|
|
mod capabilities;
|
2021-12-15 13:23:43 -05:00
|
|
|
mod client;
|
2021-06-05 07:31:44 +10:00
|
|
|
mod code_lens;
|
2021-03-25 11:13:37 +11:00
|
|
|
mod completions;
|
2020-12-07 21:46:39 +11:00
|
|
|
mod config;
|
|
|
|
mod diagnostics;
|
2021-01-22 21:03:16 +11:00
|
|
|
mod documents;
|
2022-03-23 09:54:22 -04:00
|
|
|
pub mod language_server;
|
2021-12-15 13:23:43 -05:00
|
|
|
mod logging;
|
2021-06-01 21:53:08 +10:00
|
|
|
mod lsp_custom;
|
2021-06-17 19:57:58 -04:00
|
|
|
mod parent_process_checker;
|
2021-04-09 11:27:27 +10:00
|
|
|
mod path_to_regex;
|
2021-01-27 11:32:49 +11:00
|
|
|
mod performance;
|
2021-08-05 20:46:32 -05:00
|
|
|
mod refactor;
|
2021-04-09 11:27:27 +10:00
|
|
|
mod registries;
|
2021-12-15 13:23:43 -05:00
|
|
|
mod repl;
|
2021-04-19 20:26:36 -05:00
|
|
|
mod semantic_tokens;
|
2022-03-30 09:59:27 +11:00
|
|
|
mod testing;
|
2020-12-07 21:46:39 +11:00
|
|
|
mod text;
|
|
|
|
mod tsc;
|
2021-02-18 15:37:05 +11:00
|
|
|
mod urls;
|
2020-12-07 21:46:39 +11:00
|
|
|
|
2021-06-22 21:48:01 -04:00
|
|
|
pub async fn start() -> Result<(), AnyError> {
|
2020-12-21 14:44:26 +01:00
|
|
|
let stdin = tokio::io::stdin();
|
|
|
|
let stdout = tokio::io::stdout();
|
2020-12-07 21:46:39 +11:00
|
|
|
|
2022-04-03 12:17:30 +08:00
|
|
|
let (service, socket) = LspService::build(|client| {
|
|
|
|
language_server::LanguageServer::new(client::Client::from_tower(client))
|
|
|
|
})
|
|
|
|
.custom_method(lsp_custom::CACHE_REQUEST, LanguageServer::cache_request)
|
|
|
|
.custom_method(
|
|
|
|
lsp_custom::PERFORMANCE_REQUEST,
|
|
|
|
LanguageServer::performance_request,
|
|
|
|
)
|
|
|
|
.custom_method(
|
|
|
|
lsp_custom::RELOAD_IMPORT_REGISTRIES_REQUEST,
|
|
|
|
LanguageServer::reload_import_registries_request,
|
|
|
|
)
|
|
|
|
.custom_method(lsp_custom::TASK_REQUEST, LanguageServer::task_request)
|
|
|
|
.custom_method(testing::TEST_RUN_REQUEST, LanguageServer::test_run_request)
|
|
|
|
.custom_method(
|
|
|
|
testing::TEST_RUN_CANCEL_REQUEST,
|
|
|
|
LanguageServer::test_run_cancel_request,
|
|
|
|
)
|
|
|
|
.custom_method(
|
|
|
|
lsp_custom::VIRTUAL_TEXT_DOCUMENT,
|
|
|
|
LanguageServer::virtual_text_document,
|
|
|
|
)
|
2022-10-16 13:39:43 +11:00
|
|
|
.custom_method(lsp_custom::INLAY_HINT, LanguageServer::inlay_hint)
|
2022-04-03 12:17:30 +08:00
|
|
|
.finish();
|
|
|
|
|
|
|
|
Server::new(stdin, stdout, socket).serve(service).await;
|
2020-12-07 21:46:39 +11:00
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|