Replace lsp-types in helix-lsp with helix-lsp-types

This commit is contained in:
Michael Davis 2024-07-27 12:19:57 -04:00
parent 7793031aa6
commit e21e4eb825
No known key found for this signature in database
5 changed files with 20 additions and 32 deletions

15
Cargo.lock generated
View File

@ -1393,10 +1393,10 @@ dependencies = [
"globset",
"helix-core",
"helix-loader",
"helix-lsp-types",
"helix-parsec",
"helix-stdx",
"log",
"lsp-types",
"parking_lot",
"serde",
"serde_json",
@ -1732,19 +1732,6 @@ version = "0.4.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
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]]
name = "memchr"
version = "2.6.3"

View File

@ -17,13 +17,13 @@ helix-stdx = { path = "../helix-stdx" }
helix-core = { path = "../helix-core" }
helix-loader = { path = "../helix-loader" }
helix-parsec = { path = "../helix-parsec" }
helix-lsp-types = { path = "../helix-lsp-types" }
anyhow = "1.0"
futures-executor = "0.3"
futures-util = { version = "0.3", features = ["std", "async-await"], default-features = false }
globset = "0.4.14"
log = "0.4"
lsp-types = { version = "0.95" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
tokio = { version = "1.38", features = ["rt", "rt-multi-thread", "io-util", "io-std", "time", "process", "macros", "fs", "parking_lot", "sync"] }

View File

@ -5,15 +5,14 @@
Call, Error, LanguageServerId, OffsetEncoding, Result,
};
use helix_core::{find_workspace, syntax::LanguageServerFeature, ChangeSet, Rope};
use helix_loader::VERSION_AND_GIT_HASH;
use helix_stdx::path;
use lsp::{
notification::DidChangeWorkspaceFolders, CodeActionCapabilityResolveSupport,
use crate::lsp::{
self, notification::DidChangeWorkspaceFolders, CodeActionCapabilityResolveSupport,
DidChangeWorkspaceFoldersParams, OneOf, PositionEncodingKind, SignatureHelp, Url,
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 serde::Deserialize;
use serde_json::Value;
@ -994,7 +993,7 @@ pub fn text_document_did_save(
..
}) => match options.as_ref()? {
lsp::TextDocumentSyncSaveOptions::Supported(true) => false,
lsp::TextDocumentSyncSaveOptions::SaveOptions(lsp_types::SaveOptions {
lsp::TextDocumentSyncSaveOptions::SaveOptions(lsp::SaveOptions {
include_text,
}) => include_text.unwrap_or(false),
lsp::TextDocumentSyncSaveOptions::Supported(false) => return None,

View File

@ -8,9 +8,9 @@
use arc_swap::ArcSwap;
pub use client::Client;
pub use futures_executor::block_on;
pub use helix_lsp_types as lsp;
pub use jsonrpc::Call;
pub use lsp::{Position, Url};
pub use lsp_types as lsp;
use futures_util::stream::select_all::SelectAll;
use helix_core::syntax::{
@ -1113,7 +1113,7 @@ macro_rules! test_case {
#[test]
fn emoji_format_gh_4791() {
use lsp_types::{Position, Range, TextEdit};
use lsp::{Position, Range, TextEdit};
let edits = vec![
TextEdit {

View File

@ -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 log::{error, info};
use serde::{Deserialize, Serialize};
@ -289,11 +293,10 @@ async fn recv(
}
// Hack: inject a terminated notification so we trigger code that needs to happen after exit
use lsp_types::notification::Notification as _;
let notification =
ServerMessage::Call(jsonrpc::Call::Notification(jsonrpc::Notification {
jsonrpc: None,
method: lsp_types::notification::Exit::METHOD.to_string(),
method: lsp::notification::Exit::METHOD.to_string(),
params: jsonrpc::Params::None,
}));
match transport
@ -338,8 +341,8 @@ async fn send(
// Determine if a message is allowed to be sent early
fn is_initialize(payload: &Payload) -> bool {
use lsp_types::{
notification::{Initialized, Notification},
use lsp::{
notification::Initialized,
request::{Initialize, Request},
};
match payload {
@ -357,7 +360,7 @@ fn is_initialize(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)
}
@ -370,12 +373,11 @@ fn is_shutdown(payload: &Payload) -> bool {
// server successfully initialized
is_pending = false;
use lsp_types::notification::Notification;
// Hack: inject an initialized notification so we trigger code that needs to happen after init
let notification = ServerMessage::Call(jsonrpc::Call::Notification(jsonrpc::Notification {
jsonrpc: None,
method: lsp_types::notification::Initialized::METHOD.to_string(),
method: lsp::notification::Initialized::METHOD.to_string(),
params: jsonrpc::Params::None,
}));
let language_server_name = &transport.name;