Skip to content

Commit

Permalink
Replace lsp-types in helix-lsp with helix-lsp-types
Browse files Browse the repository at this point in the history
  • Loading branch information
the-mikedavis committed Jul 28, 2024
1 parent 7793031 commit e21e4eb
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 32 deletions.
15 changes: 1 addition & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion helix-lsp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
13 changes: 6 additions & 7 deletions helix-lsp/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ use crate::{
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;
Expand Down Expand Up @@ -994,7 +993,7 @@ impl Client {
..
}) => 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,
Expand Down
4 changes: 2 additions & 2 deletions helix-lsp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ mod transport;
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::{
Expand Down Expand Up @@ -1113,7 +1113,7 @@ mod tests {

#[test]
fn emoji_format_gh_4791() {
use lsp_types::{Position, Range, TextEdit};
use lsp::{Position, Range, TextEdit};

let edits = vec![
TextEdit {
Expand Down
18 changes: 10 additions & 8 deletions helix-lsp/src/transport.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -289,11 +293,10 @@ impl Transport {
}

// 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
Expand Down Expand Up @@ -338,8 +341,8 @@ impl Transport {

// 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 {
Expand All @@ -357,7 +360,7 @@ impl Transport {
}

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)
}

Expand All @@ -370,12 +373,11 @@ impl Transport {
// 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;
Expand Down

0 comments on commit e21e4eb

Please sign in to comment.