Replace lsp-types in helix-lsp with helix-lsp-types
This commit is contained in:
parent
7793031aa6
commit
e21e4eb825
5 changed files with 20 additions and 32 deletions
15
Cargo.lock
generated
15
Cargo.lock
generated
|
@ -1393,10 +1393,10 @@ dependencies = [
|
||||||
"globset",
|
"globset",
|
||||||
"helix-core",
|
"helix-core",
|
||||||
"helix-loader",
|
"helix-loader",
|
||||||
|
"helix-lsp-types",
|
||||||
"helix-parsec",
|
"helix-parsec",
|
||||||
"helix-stdx",
|
"helix-stdx",
|
||||||
"log",
|
"log",
|
||||||
"lsp-types",
|
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
@ -1732,19 +1732,6 @@ version = "0.4.22"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
|
checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "lsp-types"
|
|
||||||
version = "0.95.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "8e34d33a8e9b006cd3fc4fe69a921affa097bae4bb65f76271f4644f9a334365"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags 1.3.2",
|
|
||||||
"serde",
|
|
||||||
"serde_json",
|
|
||||||
"serde_repr",
|
|
||||||
"url",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memchr"
|
name = "memchr"
|
||||||
version = "2.6.3"
|
version = "2.6.3"
|
||||||
|
|
|
@ -17,13 +17,13 @@ helix-stdx = { path = "../helix-stdx" }
|
||||||
helix-core = { path = "../helix-core" }
|
helix-core = { path = "../helix-core" }
|
||||||
helix-loader = { path = "../helix-loader" }
|
helix-loader = { path = "../helix-loader" }
|
||||||
helix-parsec = { path = "../helix-parsec" }
|
helix-parsec = { path = "../helix-parsec" }
|
||||||
|
helix-lsp-types = { path = "../helix-lsp-types" }
|
||||||
|
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
futures-executor = "0.3"
|
futures-executor = "0.3"
|
||||||
futures-util = { version = "0.3", features = ["std", "async-await"], default-features = false }
|
futures-util = { version = "0.3", features = ["std", "async-await"], default-features = false }
|
||||||
globset = "0.4.14"
|
globset = "0.4.14"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
lsp-types = { version = "0.95" }
|
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
tokio = { version = "1.38", features = ["rt", "rt-multi-thread", "io-util", "io-std", "time", "process", "macros", "fs", "parking_lot", "sync"] }
|
tokio = { version = "1.38", features = ["rt", "rt-multi-thread", "io-util", "io-std", "time", "process", "macros", "fs", "parking_lot", "sync"] }
|
||||||
|
|
|
@ -5,15 +5,14 @@ use crate::{
|
||||||
Call, Error, LanguageServerId, OffsetEncoding, Result,
|
Call, Error, LanguageServerId, OffsetEncoding, Result,
|
||||||
};
|
};
|
||||||
|
|
||||||
use helix_core::{find_workspace, syntax::LanguageServerFeature, ChangeSet, Rope};
|
use crate::lsp::{
|
||||||
use helix_loader::VERSION_AND_GIT_HASH;
|
self, notification::DidChangeWorkspaceFolders, CodeActionCapabilityResolveSupport,
|
||||||
use helix_stdx::path;
|
|
||||||
use lsp::{
|
|
||||||
notification::DidChangeWorkspaceFolders, CodeActionCapabilityResolveSupport,
|
|
||||||
DidChangeWorkspaceFoldersParams, OneOf, PositionEncodingKind, SignatureHelp, Url,
|
DidChangeWorkspaceFoldersParams, OneOf, PositionEncodingKind, SignatureHelp, Url,
|
||||||
WorkspaceFolder, WorkspaceFoldersChangeEvent,
|
WorkspaceFolder, WorkspaceFoldersChangeEvent,
|
||||||
};
|
};
|
||||||
use lsp_types as lsp;
|
use helix_core::{find_workspace, syntax::LanguageServerFeature, ChangeSet, Rope};
|
||||||
|
use helix_loader::VERSION_AND_GIT_HASH;
|
||||||
|
use helix_stdx::path;
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
|
@ -994,7 +993,7 @@ impl Client {
|
||||||
..
|
..
|
||||||
}) => match options.as_ref()? {
|
}) => match options.as_ref()? {
|
||||||
lsp::TextDocumentSyncSaveOptions::Supported(true) => false,
|
lsp::TextDocumentSyncSaveOptions::Supported(true) => false,
|
||||||
lsp::TextDocumentSyncSaveOptions::SaveOptions(lsp_types::SaveOptions {
|
lsp::TextDocumentSyncSaveOptions::SaveOptions(lsp::SaveOptions {
|
||||||
include_text,
|
include_text,
|
||||||
}) => include_text.unwrap_or(false),
|
}) => include_text.unwrap_or(false),
|
||||||
lsp::TextDocumentSyncSaveOptions::Supported(false) => return None,
|
lsp::TextDocumentSyncSaveOptions::Supported(false) => return None,
|
||||||
|
|
|
@ -8,9 +8,9 @@ mod transport;
|
||||||
use arc_swap::ArcSwap;
|
use arc_swap::ArcSwap;
|
||||||
pub use client::Client;
|
pub use client::Client;
|
||||||
pub use futures_executor::block_on;
|
pub use futures_executor::block_on;
|
||||||
|
pub use helix_lsp_types as lsp;
|
||||||
pub use jsonrpc::Call;
|
pub use jsonrpc::Call;
|
||||||
pub use lsp::{Position, Url};
|
pub use lsp::{Position, Url};
|
||||||
pub use lsp_types as lsp;
|
|
||||||
|
|
||||||
use futures_util::stream::select_all::SelectAll;
|
use futures_util::stream::select_all::SelectAll;
|
||||||
use helix_core::syntax::{
|
use helix_core::syntax::{
|
||||||
|
@ -1113,7 +1113,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn emoji_format_gh_4791() {
|
fn emoji_format_gh_4791() {
|
||||||
use lsp_types::{Position, Range, TextEdit};
|
use lsp::{Position, Range, TextEdit};
|
||||||
|
|
||||||
let edits = vec![
|
let edits = vec![
|
||||||
TextEdit {
|
TextEdit {
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
use crate::{jsonrpc, Error, LanguageServerId, Result};
|
use crate::{
|
||||||
|
jsonrpc,
|
||||||
|
lsp::{self, notification::Notification as _},
|
||||||
|
Error, LanguageServerId, Result,
|
||||||
|
};
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use log::{error, info};
|
use log::{error, info};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
@ -289,11 +293,10 @@ impl Transport {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hack: inject a terminated notification so we trigger code that needs to happen after exit
|
// Hack: inject a terminated notification so we trigger code that needs to happen after exit
|
||||||
use lsp_types::notification::Notification as _;
|
|
||||||
let notification =
|
let notification =
|
||||||
ServerMessage::Call(jsonrpc::Call::Notification(jsonrpc::Notification {
|
ServerMessage::Call(jsonrpc::Call::Notification(jsonrpc::Notification {
|
||||||
jsonrpc: None,
|
jsonrpc: None,
|
||||||
method: lsp_types::notification::Exit::METHOD.to_string(),
|
method: lsp::notification::Exit::METHOD.to_string(),
|
||||||
params: jsonrpc::Params::None,
|
params: jsonrpc::Params::None,
|
||||||
}));
|
}));
|
||||||
match transport
|
match transport
|
||||||
|
@ -338,8 +341,8 @@ impl Transport {
|
||||||
|
|
||||||
// Determine if a message is allowed to be sent early
|
// Determine if a message is allowed to be sent early
|
||||||
fn is_initialize(payload: &Payload) -> bool {
|
fn is_initialize(payload: &Payload) -> bool {
|
||||||
use lsp_types::{
|
use lsp::{
|
||||||
notification::{Initialized, Notification},
|
notification::Initialized,
|
||||||
request::{Initialize, Request},
|
request::{Initialize, Request},
|
||||||
};
|
};
|
||||||
match payload {
|
match payload {
|
||||||
|
@ -357,7 +360,7 @@ impl Transport {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_shutdown(payload: &Payload) -> bool {
|
fn is_shutdown(payload: &Payload) -> bool {
|
||||||
use lsp_types::request::{Request, Shutdown};
|
use lsp::request::{Request, Shutdown};
|
||||||
matches!(payload, Payload::Request { value: jsonrpc::MethodCall { method, .. }, .. } if method == Shutdown::METHOD)
|
matches!(payload, Payload::Request { value: jsonrpc::MethodCall { method, .. }, .. } if method == Shutdown::METHOD)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,12 +373,11 @@ impl Transport {
|
||||||
// server successfully initialized
|
// server successfully initialized
|
||||||
is_pending = false;
|
is_pending = false;
|
||||||
|
|
||||||
use lsp_types::notification::Notification;
|
|
||||||
// Hack: inject an initialized notification so we trigger code that needs to happen after init
|
// Hack: inject an initialized notification so we trigger code that needs to happen after init
|
||||||
let notification = ServerMessage::Call(jsonrpc::Call::Notification(jsonrpc::Notification {
|
let notification = ServerMessage::Call(jsonrpc::Call::Notification(jsonrpc::Notification {
|
||||||
jsonrpc: None,
|
jsonrpc: None,
|
||||||
|
|
||||||
method: lsp_types::notification::Initialized::METHOD.to_string(),
|
method: lsp::notification::Initialized::METHOD.to_string(),
|
||||||
params: jsonrpc::Params::None,
|
params: jsonrpc::Params::None,
|
||||||
}));
|
}));
|
||||||
let language_server_name = &transport.name;
|
let language_server_name = &transport.name;
|
||||||
|
|
Loading…
Add table
Reference in a new issue