summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
Diffstat (limited to 'cli')
-rw-r--r--cli/Cargo.toml2
-rw-r--r--cli/bench/lsp.rs2
-rw-r--r--cli/lsp/analysis.rs6
-rw-r--r--cli/lsp/capabilities.rs2
-rw-r--r--cli/lsp/client.rs22
-rw-r--r--cli/lsp/code_lens.rs2
-rw-r--r--cli/lsp/completions.rs2
-rw-r--r--cli/lsp/config.rs2
-rw-r--r--cli/lsp/diagnostics.rs2
-rw-r--r--cli/lsp/documents.rs2
-rw-r--r--cli/lsp/language_server.rs161
-rw-r--r--cli/lsp/lsp_custom.rs2
-rw-r--r--cli/lsp/mod.rs37
-rw-r--r--cli/lsp/refactor.rs2
-rw-r--r--cli/lsp/registries.rs2
-rw-r--r--cli/lsp/repl.rs44
-rw-r--r--cli/lsp/semantic_tokens.rs10
-rw-r--r--cli/lsp/testing/definitions.rs2
-rw-r--r--cli/lsp/testing/execution.rs2
-rw-r--r--cli/lsp/testing/lsp_custom.rs2
-rw-r--r--cli/lsp/testing/server.rs6
-rw-r--r--cli/lsp/text.rs6
-rw-r--r--cli/lsp/tsc.rs6
-rw-r--r--cli/tests/integration/lsp_tests.rs6
24 files changed, 179 insertions, 153 deletions
diff --git a/cli/Cargo.toml b/cli/Cargo.toml
index 0ded96e1a..497fc9d42 100644
--- a/cli/Cargo.toml
+++ b/cli/Cargo.toml
@@ -74,7 +74,6 @@ import_map = "=0.9.0"
jsonc-parser = { version = "=0.19.0", features = ["serde"] }
libc = "=0.2.121"
log = { version = "=0.4.14", features = ["serde"] }
-lspower = "=1.4.0"
node_resolver = "=0.1.1"
notify = "=5.0.0-pre.14"
num-format = "=0.4.0"
@@ -95,6 +94,7 @@ text-size = "=1.1.0"
text_lines = "=0.4.1"
tokio = { version = "=1.17", features = ["full"] }
tokio-util = "=0.7.0"
+tower-lsp = "=0.16.0"
typed-arena = "2.0.1"
uuid = { version = "=0.8.2", features = ["v4", "serde"] }
walkdir = "=2.3.2"
diff --git a/cli/bench/lsp.rs b/cli/bench/lsp.rs
index fdddb9734..8397d23d7 100644
--- a/cli/bench/lsp.rs
+++ b/cli/bench/lsp.rs
@@ -6,12 +6,12 @@ use deno_core::serde_json;
use deno_core::serde_json::json;
use deno_core::serde_json::Value;
use deno_core::url::Url;
-use lspower::lsp;
use std::collections::HashMap;
use std::path::Path;
use std::time::Duration;
use test_util::lsp::LspClient;
use test_util::lsp::LspResponseError;
+use tower_lsp::lsp_types as lsp;
static FIXTURE_CODE_LENS_TS: &str = include_str!("testdata/code_lens.ts");
static FIXTURE_DB_TS: &str = include_str!("testdata/db.ts");
diff --git a/cli/lsp/analysis.rs b/cli/lsp/analysis.rs
index f789cf2fc..2c7079951 100644
--- a/cli/lsp/analysis.rs
+++ b/cli/lsp/analysis.rs
@@ -16,13 +16,13 @@ use deno_core::error::AnyError;
use deno_core::serde::Deserialize;
use deno_core::serde_json::json;
use deno_core::ModuleSpecifier;
-use lspower::lsp;
-use lspower::lsp::Position;
-use lspower::lsp::Range;
use once_cell::sync::Lazy;
use regex::Regex;
use std::cmp::Ordering;
use std::collections::HashMap;
+use tower_lsp::lsp_types as lsp;
+use tower_lsp::lsp_types::Position;
+use tower_lsp::lsp_types::Range;
/// Diagnostic error codes which actually are the same, and so when grouping
/// fixes we treat them the same.
diff --git a/cli/lsp/capabilities.rs b/cli/lsp/capabilities.rs
index 9f545d893..79d2eee1b 100644
--- a/cli/lsp/capabilities.rs
+++ b/cli/lsp/capabilities.rs
@@ -6,7 +6,7 @@
///! client.
///!
use deno_core::serde_json::json;
-use lspower::lsp::*;
+use tower_lsp::lsp_types::*;
use super::refactor::ALL_KNOWN_REFACTOR_ACTION_KINDS;
use super::semantic_tokens::get_legend;
diff --git a/cli/lsp/client.rs b/cli/lsp/client.rs
index b5728961f..25c97d9d5 100644
--- a/cli/lsp/client.rs
+++ b/cli/lsp/client.rs
@@ -8,8 +8,8 @@ use deno_core::error::AnyError;
use deno_core::futures::future;
use deno_core::serde_json;
use deno_core::serde_json::Value;
-use lspower::lsp;
-use lspower::lsp::ConfigurationItem;
+use tower_lsp::lsp_types as lsp;
+use tower_lsp::lsp_types::ConfigurationItem;
use crate::lsp::repl::get_repl_workspace_settings;
@@ -35,8 +35,8 @@ impl std::fmt::Debug for Client {
}
impl Client {
- pub fn from_lspower(client: lspower::Client) -> Self {
- Self(Arc::new(LspowerClient(client)))
+ pub fn from_tower(client: tower_lsp::Client) -> Self {
+ Self(Arc::new(TowerClient(client)))
}
pub fn new_for_repl() -> Self {
@@ -148,9 +148,9 @@ trait ClientTrait: Send + Sync {
}
#[derive(Clone)]
-struct LspowerClient(lspower::Client);
+struct TowerClient(tower_lsp::Client);
-impl ClientTrait for LspowerClient {
+impl ClientTrait for TowerClient {
fn publish_diagnostics(
&self,
uri: lsp::Url,
@@ -170,9 +170,7 @@ impl ClientTrait for LspowerClient {
let client = self.0.clone();
Box::pin(async move {
client
- .send_custom_notification::<lsp_custom::RegistryStateNotification>(
- params,
- )
+ .send_notification::<lsp_custom::RegistryStateNotification>(params)
.await
})
}
@@ -183,18 +181,18 @@ impl ClientTrait for LspowerClient {
match notification {
TestingNotification::Module(params) => {
client
- .send_custom_notification::<testing_lsp_custom::TestModuleNotification>(
+ .send_notification::<testing_lsp_custom::TestModuleNotification>(
params,
)
.await
}
TestingNotification::DeleteModule(params) => client
- .send_custom_notification::<testing_lsp_custom::TestModuleDeleteNotification>(
+ .send_notification::<testing_lsp_custom::TestModuleDeleteNotification>(
params,
)
.await,
TestingNotification::Progress(params) => client
- .send_custom_notification::<testing_lsp_custom::TestRunProgressNotification>(
+ .send_notification::<testing_lsp_custom::TestRunProgressNotification>(
params,
)
.await,
diff --git a/cli/lsp/code_lens.rs b/cli/lsp/code_lens.rs
index e750aadc0..a80f9bbb0 100644
--- a/cli/lsp/code_lens.rs
+++ b/cli/lsp/code_lens.rs
@@ -19,13 +19,13 @@ use deno_core::serde::Serialize;
use deno_core::serde_json;
use deno_core::serde_json::json;
use deno_core::ModuleSpecifier;
-use lspower::lsp;
use once_cell::sync::Lazy;
use regex::Regex;
use std::cell::RefCell;
use std::collections::HashSet;
use std::rc::Rc;
use std::sync::Arc;
+use tower_lsp::lsp_types as lsp;
static ABSTRACT_MODIFIER: Lazy<Regex> =
Lazy::new(|| Regex::new(r"\babstract\b").unwrap());
diff --git a/cli/lsp/completions.rs b/cli/lsp/completions.rs
index 860ca4b3d..b05d7bfb9 100644
--- a/cli/lsp/completions.rs
+++ b/cli/lsp/completions.rs
@@ -20,10 +20,10 @@ use deno_core::serde::Serialize;
use deno_core::url::Position;
use deno_core::ModuleSpecifier;
use import_map::ImportMap;
-use lspower::lsp;
use once_cell::sync::Lazy;
use regex::Regex;
use std::sync::Arc;
+use tower_lsp::lsp_types as lsp;
static FILE_PROTO_RE: Lazy<Regex> =
Lazy::new(|| Regex::new(r#"^file:/{2}(?:/[A-Za-z]:)?"#).unwrap());
diff --git a/cli/lsp/config.rs b/cli/lsp/config.rs
index 6cd401b0c..0e257ebf4 100644
--- a/cli/lsp/config.rs
+++ b/cli/lsp/config.rs
@@ -9,10 +9,10 @@ use deno_core::serde::Serialize;
use deno_core::serde_json;
use deno_core::serde_json::Value;
use deno_core::ModuleSpecifier;
-use lspower::lsp;
use std::collections::BTreeMap;
use std::collections::HashMap;
use std::sync::Arc;
+use tower_lsp::lsp_types as lsp;
pub const SETTINGS_SECTION: &str = "deno";
diff --git a/cli/lsp/diagnostics.rs b/cli/lsp/diagnostics.rs
index fd905f6e0..b1ce06dcb 100644
--- a/cli/lsp/diagnostics.rs
+++ b/cli/lsp/diagnostics.rs
@@ -27,7 +27,6 @@ use deno_core::ModuleSpecifier;
use deno_graph::Resolved;
use deno_runtime::tokio_util::create_basic_runtime;
use log::error;
-use lspower::lsp;
use std::collections::HashMap;
use std::sync::Arc;
use std::thread;
@@ -35,6 +34,7 @@ use tokio::sync::mpsc;
use tokio::sync::Mutex;
use tokio::time::Duration;
use tokio_util::sync::CancellationToken;
+use tower_lsp::lsp_types as lsp;
pub type SnapshotForDiagnostics =
(Arc<StateSnapshot>, Arc<ConfigSnapshot>, Option<LintConfig>);
diff --git a/cli/lsp/documents.rs b/cli/lsp/documents.rs
index 61ab1c4b6..0a383e781 100644
--- a/cli/lsp/documents.rs
+++ b/cli/lsp/documents.rs
@@ -25,7 +25,6 @@ use deno_core::url;
use deno_core::ModuleSpecifier;
use deno_graph::Module;
use deno_graph::Resolved;
-use lspower::lsp;
use once_cell::sync::Lazy;
use std::collections::BTreeMap;
use std::collections::HashMap;
@@ -36,6 +35,7 @@ use std::path::Path;
use std::path::PathBuf;
use std::str::FromStr;
use std::sync::Arc;
+use tower_lsp::lsp_types as lsp;
static JS_HEADERS: Lazy<HashMap<String, String>> = Lazy::new(|| {
([(
diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs
index 4555e3b85..8b452586a 100644
--- a/cli/lsp/language_server.rs
+++ b/cli/lsp/language_server.rs
@@ -11,15 +11,15 @@ use deno_core::ModuleSpecifier;
use import_map::ImportMap;
use log::error;
use log::warn;
-use lspower::jsonrpc::Error as LspError;
-use lspower::jsonrpc::Result as LspResult;
-use lspower::lsp::request::*;
-use lspower::lsp::*;
use serde_json::from_value;
use std::env;
use std::path::PathBuf;
use std::sync::Arc;
use tokio::fs;
+use tower_lsp::jsonrpc::Error as LspError;
+use tower_lsp::jsonrpc::Result as LspResult;
+use tower_lsp::lsp_types::request::*;
+use tower_lsp::lsp_types::*;
use super::analysis::fix_ts_import_changes;
use super::analysis::ts_changes_to_edit;
@@ -132,6 +132,85 @@ impl LanguageServer {
pub fn new(client: Client) -> Self {
Self(Arc::new(tokio::sync::Mutex::new(Inner::new(client))))
}
+
+ pub async fn cache_request(
+ &self,
+ params: Option<Value>,
+ ) -> LspResult<Option<Value>> {
+ match params.map(serde_json::from_value) {
+ Some(Ok(params)) => self.0.lock().await.cache(params).await,
+ Some(Err(err)) => Err(LspError::invalid_params(err.to_string())),
+ None => Err(LspError::invalid_params("Missing parameters")),
+ }
+ }
+
+ pub async fn performance_request(&self) -> LspResult<Option<Value>> {
+ Ok(Some(self.0.lock().await.get_performance()))
+ }
+
+ pub async fn reload_import_registries_request(
+ &self,
+ ) -> LspResult<Option<Value>> {
+ self.0.lock().await.reload_import_registries().await
+ }
+
+ pub async fn task_request(&self) -> LspResult<Option<Value>> {
+ self.0.lock().await.get_tasks()
+ }
+
+ pub async fn test_run_request(
+ &self,
+ params: Option<Value>,
+ ) -> LspResult<Option<Value>> {
+ let inner = self.0.lock().await;
+ if let Some(testing_server) = &inner.maybe_testing_server {
+ match params.map(serde_json::from_value) {
+ Some(Ok(params)) => testing_server
+ .run_request(params, inner.config.get_workspace_settings()),
+ Some(Err(err)) => Err(LspError::invalid_params(err.to_string())),
+ None => Err(LspError::invalid_params("Missing parameters")),
+ }
+ } else {
+ Err(LspError::invalid_request())
+ }
+ }
+
+ pub async fn test_run_cancel_request(
+ &self,
+ params: Option<Value>,
+ ) -> LspResult<Option<Value>> {
+ if let Some(testing_server) = &self.0.lock().await.maybe_testing_server {
+ match params.map(serde_json::from_value) {
+ Some(Ok(params)) => testing_server.run_cancel_request(params),
+ Some(Err(err)) => Err(LspError::invalid_params(err.to_string())),
+ None => Err(LspError::invalid_params("Missing parameters")),
+ }
+ } else {
+ Err(LspError::invalid_request())
+ }
+ }
+
+ pub async fn virtual_text_document(
+ &self,
+ params: Option<Value>,
+ ) -> LspResult<Option<Value>> {
+ match params.map(serde_json::from_value) {
+ Some(Ok(params)) => Ok(Some(
+ serde_json::to_value(
+ self.0.lock().await.virtual_text_document(params).await?,
+ )
+ .map_err(|err| {
+ error!(
+ "Failed to serialize virtual_text_document response: {}",
+ err
+ );
+ LspError::internal_error()
+ })?,
+ )),
+ Some(Err(err)) => Err(LspError::invalid_params(err.to_string())),
+ None => Err(LspError::invalid_params("Missing parameters")),
+ }
+ }
}
impl Inner {
@@ -2144,68 +2223,6 @@ impl Inner {
}
}
- async fn request_else(
- &mut self,
- method: &str,
- params: Option<Value>,
- ) -> LspResult<Option<Value>> {
- match method {
- lsp_custom::CACHE_REQUEST => match params.map(serde_json::from_value) {
- Some(Ok(params)) => self.cache(params).await,
- Some(Err(err)) => Err(LspError::invalid_params(err.to_string())),
- None => Err(LspError::invalid_params("Missing parameters")),
- },
- lsp_custom::PERFORMANCE_REQUEST => Ok(Some(self.get_performance())),
- lsp_custom::RELOAD_IMPORT_REGISTRIES_REQUEST => {
- self.reload_import_registries().await
- }
- lsp_custom::TASK_REQUEST => self.get_tasks(),
- testing::TEST_RUN_REQUEST => {
- if let Some(testing_server) = &self.maybe_testing_server {
- match params.map(serde_json::from_value) {
- Some(Ok(params)) => testing_server
- .run_request(params, self.config.get_workspace_settings()),
- Some(Err(err)) => Err(LspError::invalid_params(err.to_string())),
- None => Err(LspError::invalid_params("Missing parameters")),
- }
- } else {
- Err(LspError::invalid_request())
- }
- }
- testing::TEST_RUN_CANCEL_REQUEST => {
- if let Some(testing_server) = &self.maybe_testing_server {
- match params.map(serde_json::from_value) {
- Some(Ok(params)) => testing_server.run_cancel_request(params),
- Some(Err(err)) => Err(LspError::invalid_params(err.to_string())),
- None => Err(LspError::invalid_params("Missing parameters")),
- }
- } else {
- Err(LspError::invalid_request())
- }
- }
- lsp_custom::VIRTUAL_TEXT_DOCUMENT => {
- match params.map(serde_json::from_value) {
- Some(Ok(params)) => Ok(Some(
- serde_json::to_value(self.virtual_text_document(params).await?)
- .map_err(|err| {
- error!(
- "Failed to serialize virtual_text_document response: {}",
- err
- );
- LspError::internal_error()
- })?,
- )),
- Some(Err(err)) => Err(LspError::invalid_params(err.to_string())),
- None => Err(LspError::invalid_params("Missing parameters")),
- }
- }
- _ => {
- error!("Got a {} request, but no handler is defined", method);
- Err(LspError::method_not_found())
- }
- }
- }
-
async fn selection_range(
&mut self,
params: SelectionRangeParams,
@@ -2441,8 +2458,8 @@ impl Inner {
}
}
-#[lspower::async_trait]
-impl lspower::LanguageServer for LanguageServer {
+#[tower_lsp::async_trait]
+impl tower_lsp::LanguageServer for LanguageServer {
async fn initialize(
&self,
params: InitializeParams,
@@ -2780,14 +2797,6 @@ impl lspower::LanguageServer for LanguageServer {
self.0.lock().await.rename(params).await
}
- async fn request_else(
- &self,
- method: &str,
- params: Option<Value>,
- ) -> LspResult<Option<Value>> {
- self.0.lock().await.request_else(method, params).await
- }
-
async fn selection_range(
&self,
params: SelectionRangeParams,
diff --git a/cli/lsp/lsp_custom.rs b/cli/lsp/lsp_custom.rs
index eff55e2ea..49c06e15c 100644
--- a/cli/lsp/lsp_custom.rs
+++ b/cli/lsp/lsp_custom.rs
@@ -2,7 +2,7 @@
use deno_core::serde::Deserialize;
use deno_core::serde::Serialize;
-use lspower::lsp;
+use tower_lsp::lsp_types as lsp;
pub const CACHE_REQUEST: &str = "deno/cache";
pub const PERFORMANCE_REQUEST: &str = "deno/performance";
diff --git a/cli/lsp/mod.rs b/cli/lsp/mod.rs
index 1cfd3041c..2ee22510f 100644
--- a/cli/lsp/mod.rs
+++ b/cli/lsp/mod.rs
@@ -1,9 +1,10 @@
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
use deno_core::error::AnyError;
-use lspower::LspService;
-use lspower::Server;
+use tower_lsp::LspService;
+use tower_lsp::Server;
+use crate::lsp::language_server::LanguageServer;
pub use repl::ReplCompletionItem;
pub use repl::ReplLanguageServer;
@@ -35,13 +36,31 @@ pub async fn start() -> Result<(), AnyError> {
let stdin = tokio::io::stdin();
let stdout = tokio::io::stdout();
- let (service, messages) = LspService::new(|client| {
- language_server::LanguageServer::new(client::Client::from_lspower(client))
- });
- Server::new(stdin, stdout)
- .interleave(messages)
- .serve(service)
- .await;
+ 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,
+ )
+ .finish();
+
+ Server::new(stdin, stdout, socket).serve(service).await;
Ok(())
}
diff --git a/cli/lsp/refactor.rs b/cli/lsp/refactor.rs
index cf18eca79..d2f633331 100644
--- a/cli/lsp/refactor.rs
+++ b/cli/lsp/refactor.rs
@@ -6,8 +6,8 @@
use deno_core::serde::Deserialize;
use deno_core::serde::Serialize;
use deno_core::ModuleSpecifier;
-use lspower::lsp;
use once_cell::sync::Lazy;
+use tower_lsp::lsp_types as lsp;
pub struct RefactorCodeActionKind {
pub kind: lsp::CodeActionKind,
diff --git a/cli/lsp/registries.rs b/cli/lsp/registries.rs
index 45dac2f48..b22e15a1f 100644
--- a/cli/lsp/registries.rs
+++ b/cli/lsp/registries.rs
@@ -31,12 +31,12 @@ use deno_graph::Dependency;
use deno_runtime::deno_web::BlobStore;
use deno_runtime::permissions::Permissions;
use log::error;
-use lspower::lsp;
use once_cell::sync::Lazy;
use regex::Regex;
use std::collections::HashMap;
use std::path::Path;
use std::path::PathBuf;
+use tower_lsp::lsp_types as lsp;
const CONFIG_PATH: &str = "/.well-known/deno-import-intellisense.json";
const COMPONENT: &percent_encoding::AsciiSet = &percent_encoding::CONTROLS
diff --git a/cli/lsp/repl.rs b/cli/lsp/repl.rs
index 44634580d..d937b0273 100644
--- a/cli/lsp/repl.rs
+++ b/cli/lsp/repl.rs
@@ -10,28 +10,28 @@ use deno_ast::SourceTextInfo;
use deno_core::anyhow::anyhow;
use deno_core::error::AnyError;
use deno_core::serde_json;
-use lspower::lsp::ClientCapabilities;
-use lspower::lsp::ClientInfo;
-use lspower::lsp::CompletionContext;
-use lspower::lsp::CompletionParams;
-use lspower::lsp::CompletionResponse;
-use lspower::lsp::CompletionTextEdit;
-use lspower::lsp::CompletionTriggerKind;
-use lspower::lsp::DidChangeTextDocumentParams;
-use lspower::lsp::DidCloseTextDocumentParams;
-use lspower::lsp::DidOpenTextDocumentParams;
-use lspower::lsp::InitializeParams;
-use lspower::lsp::InitializedParams;
-use lspower::lsp::PartialResultParams;
-use lspower::lsp::Position;
-use lspower::lsp::Range;
-use lspower::lsp::TextDocumentContentChangeEvent;
-use lspower::lsp::TextDocumentIdentifier;
-use lspower::lsp::TextDocumentItem;
-use lspower::lsp::TextDocumentPositionParams;
-use lspower::lsp::VersionedTextDocumentIdentifier;
-use lspower::lsp::WorkDoneProgressParams;
-use lspower::LanguageServer;
+use tower_lsp::lsp_types::ClientCapabilities;
+use tower_lsp::lsp_types::ClientInfo;
+use tower_lsp::lsp_types::CompletionContext;
+use tower_lsp::lsp_types::CompletionParams;
+use tower_lsp::lsp_types::CompletionResponse;
+use tower_lsp::lsp_types::CompletionTextEdit;
+use tower_lsp::lsp_types::CompletionTriggerKind;
+use tower_lsp::lsp_types::DidChangeTextDocumentParams;
+use tower_lsp::lsp_types::DidCloseTextDocumentParams;
+use tower_lsp::lsp_types::DidOpenTextDocumentParams;
+use tower_lsp::lsp_types::InitializeParams;
+use tower_lsp::lsp_types::InitializedParams;
+use tower_lsp::lsp_types::PartialResultParams;
+use tower_lsp::lsp_types::Position;
+use tower_lsp::lsp_types::Range;
+use tower_lsp::lsp_types::TextDocumentContentChangeEvent;
+use tower_lsp::lsp_types::TextDocumentIdentifier;
+use tower_lsp::lsp_types::TextDocumentItem;
+use tower_lsp::lsp_types::TextDocumentPositionParams;
+use tower_lsp::lsp_types::VersionedTextDocumentIdentifier;
+use tower_lsp::lsp_types::WorkDoneProgressParams;
+use tower_lsp::LanguageServer;
use super::client::Client;
use super::config::CompletionSettings;
diff --git a/cli/lsp/semantic_tokens.rs b/cli/lsp/semantic_tokens.rs
index 4937600d3..d15b55cec 100644
--- a/cli/lsp/semantic_tokens.rs
+++ b/cli/lsp/semantic_tokens.rs
@@ -5,12 +5,12 @@
// and https://github.com/microsoft/vscode/blob/main/src/vs/workbench/api/common/extHostTypes.ts
// for the SemanticTokensBuilder implementation.
-use lspower::lsp::SemanticToken;
-use lspower::lsp::SemanticTokenModifier;
-use lspower::lsp::SemanticTokenType;
-use lspower::lsp::SemanticTokens;
-use lspower::lsp::SemanticTokensLegend;
use std::ops::{Index, IndexMut};
+use tower_lsp::lsp_types::SemanticToken;
+use tower_lsp::lsp_types::SemanticTokenModifier;
+use tower_lsp::lsp_types::SemanticTokenType;
+use tower_lsp::lsp_types::SemanticTokens;
+use tower_lsp::lsp_types::SemanticTokensLegend;
pub const MODIFIER_MASK: u32 = 255;
pub const TYPE_OFFSET: u32 = 8;
diff --git a/cli/lsp/testing/definitions.rs b/cli/lsp/testing/definitions.rs
index 0fa6a8fd5..aad667959 100644
--- a/cli/lsp/testing/definitions.rs
+++ b/cli/lsp/testing/definitions.rs
@@ -8,8 +8,8 @@ use crate::lsp::client::TestingNotification;
use deno_ast::swc::common::Span;
use deno_ast::SourceTextInfo;
use deno_core::ModuleSpecifier;
-use lspower::lsp;
use std::collections::HashMap;
+use tower_lsp::lsp_types as lsp;
fn span_to_range(
span: &Span,
diff --git a/cli/lsp/testing/execution.rs b/cli/lsp/testing/execution.rs
index 03436ad6a..dcf980fd6 100644
--- a/cli/lsp/testing/execution.rs
+++ b/cli/lsp/testing/execution.rs
@@ -28,7 +28,6 @@ use deno_core::serde_json::Value;
use deno_core::ModuleSpecifier;
use deno_runtime::permissions::Permissions;
use deno_runtime::tokio_util::run_basic;
-use lspower::lsp;
use std::collections::HashMap;
use std::collections::HashSet;
use std::sync::Arc;
@@ -36,6 +35,7 @@ use std::time::Duration;
use std::time::Instant;
use tokio::sync::mpsc;
use tokio_util::sync::CancellationToken;
+use tower_lsp::lsp_types as lsp;
/// Logic to convert a test request into a set of test modules to be tested and
/// any filters to be applied to those tests
diff --git a/cli/lsp/testing/lsp_custom.rs b/cli/lsp/testing/lsp_custom.rs
index c1182b04e..f114a8b35 100644
--- a/cli/lsp/testing/lsp_custom.rs
+++ b/cli/lsp/testing/lsp_custom.rs
@@ -2,7 +2,7 @@
use deno_core::serde::Deserialize;
use deno_core::serde::Serialize;
-use lspower::lsp;
+use tower_lsp::lsp_types as lsp;
pub const TEST_RUN_CANCEL_REQUEST: &str = "deno/testRunCancel";
pub const TEST_RUN_REQUEST: &str = "deno/testRun";
diff --git a/cli/lsp/testing/server.rs b/cli/lsp/testing/server.rs
index b176fea68..ab8f99c0e 100644
--- a/cli/lsp/testing/server.rs
+++ b/cli/lsp/testing/server.rs
@@ -18,14 +18,14 @@ use deno_core::serde_json::json;
use deno_core::serde_json::Value;
use deno_core::ModuleSpecifier;
use deno_runtime::tokio_util::create_basic_runtime;
-use lspower::jsonrpc::Error as LspError;
-use lspower::jsonrpc::Result as LspResult;
-use lspower::lsp;
use std::collections::HashMap;
use std::collections::HashSet;
use std::sync::Arc;
use std::thread;
use tokio::sync::mpsc;
+use tower_lsp::jsonrpc::Error as LspError;
+use tower_lsp::jsonrpc::Result as LspResult;
+use tower_lsp::lsp_types as lsp;
fn as_delete_notification(uri: ModuleSpecifier) -> TestingNotification {
TestingNotification::DeleteModule(
diff --git a/cli/lsp/text.rs b/cli/lsp/text.rs
index 9a99624fa..64721ebc7 100644
--- a/cli/lsp/text.rs
+++ b/cli/lsp/text.rs
@@ -6,14 +6,14 @@ use deno_core::serde_json::json;
use deno_core::serde_json::Value;
use dissimilar::diff;
use dissimilar::Chunk;
-use lspower::jsonrpc;
-use lspower::lsp;
-use lspower::lsp::TextEdit;
use std::collections::HashMap;
use std::ops::Bound;
use std::ops::RangeBounds;
use text_size::TextRange;
use text_size::TextSize;
+use tower_lsp::jsonrpc;
+use tower_lsp::lsp_types as lsp;
+use tower_lsp::lsp_types::TextEdit;
fn partition_point<T, P>(slice: &[T], mut predicate: P) -> usize
where
diff --git a/cli/lsp/tsc.rs b/cli/lsp/tsc.rs
index 64560cefb..6b8a149c2 100644
--- a/cli/lsp/tsc.rs
+++ b/cli/lsp/tsc.rs
@@ -45,9 +45,6 @@ use deno_core::RuntimeOptions;
use deno_runtime::tokio_util::create_basic_runtime;
use log::error;
use log::warn;
-use lspower::jsonrpc::Error as LspError;
-use lspower::jsonrpc::Result as LspResult;
-use lspower::lsp;
use once_cell::sync::Lazy;
use regex::Captures;
use regex::Regex;
@@ -63,6 +60,9 @@ use text_size::TextSize;
use tokio::sync::mpsc;
use tokio::sync::oneshot;
use tokio_util::sync::CancellationToken;
+use tower_lsp::jsonrpc::Error as LspError;
+use tower_lsp::jsonrpc::Result as LspResult;
+use tower_lsp::lsp_types as lsp;
static BRACKET_ACCESSOR_RE: Lazy<Regex> =
Lazy::new(|| Regex::new(r#"^\[['"](.+)[\['"]\]$"#).unwrap());
diff --git a/cli/tests/integration/lsp_tests.rs b/cli/tests/integration/lsp_tests.rs
index fecfdb001..6e50e2f68 100644
--- a/cli/tests/integration/lsp_tests.rs
+++ b/cli/tests/integration/lsp_tests.rs
@@ -8,7 +8,6 @@ use deno_core::serde_json;
use deno_core::serde_json::json;
use deno_core::serde_json::Value;
use deno_core::url::Url;
-use lspower::lsp;
use pretty_assertions::assert_eq;
use std::collections::HashSet;
use std::fs;
@@ -17,6 +16,7 @@ use test_util::http_server;
use test_util::lsp::LspClient;
use test_util::testdata_path;
use test_util::TempDir;
+use tower_lsp::lsp_types as lsp;
fn load_fixture(path: &str) -> Value {
load_fixture_as(path)
@@ -605,7 +605,7 @@ fn lsp_deno_task() {
.unwrap();
let (maybe_res, maybe_err) = client
- .write_request::<_, _, Value>("deno/task", json!({}))
+ .write_request::<_, _, Value>("deno/task", json!(null))
.unwrap();
assert!(maybe_err.is_none());
@@ -4280,7 +4280,7 @@ fn lsp_performance() {
assert!(maybe_err.is_none());
assert!(maybe_res.is_some());
let (maybe_res, maybe_err) = client
- .write_request::<_, _, PerformanceAverages>("deno/performance", json!({}))
+ .write_request::<_, _, PerformanceAverages>("deno/performance", json!(null))
.unwrap();
assert!(maybe_err.is_none());
if let Some(res) = maybe_res {