Skip to content

Commit

Permalink
update language server deps: lsp-types, lsp-server
Browse files Browse the repository at this point in the history
  • Loading branch information
mkurnikov committed Apr 13, 2021
1 parent 0e17a96 commit e51980a
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 69 deletions.
72 changes: 19 additions & 53 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion lang/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ hex = "0.4.2"
itertools = "0.9.0"
walkdir = "2.3.1"

lsp-types = {version = "0.74.0", features = ["proposed"]}
lsp-types = "0.89.0"
#lsp-types = {version = "0.74.0", features = ["proposed"]}
codespan = "0.8.0"
codespan-reporting = "0.8.0"
codespan9 = { package = "codespan", version = "0.9.2" }
Expand Down
4 changes: 2 additions & 2 deletions lang/src/compiler/location.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ where
column: ColumnIndex::from(line_src.chars().count() as u32),
};
Ok(Position::new(
loc.line.to_usize() as u64,
loc.column.to_usize() as u64,
loc.line.to_usize() as u32,
loc.column.to_usize() as u32,
))
}

Expand Down
7 changes: 3 additions & 4 deletions language_server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,18 @@ version = "0.4.0"
authors = ["Maxim Kurnikov <[email protected]>"]
edition = "2018"


[dependencies]
log = "0.4.8"
env_logger = "0.7.1"

anyhow = "1.0.31"
lsp-types = "0.74.2"
lsp-server = "0.3.2"
lsp-types = "0.89.0"
lsp-server = "0.5.0"

serde = { version = "=1.0.118", features = ["derive"] }
serde_json = "1.0.48"
threadpool = "1.8.1"
crossbeam-channel = "0.4.2"
crossbeam-channel = "0.5.1"
walkdir = "2.3.1"
codespan = "0.8.0"
codespan-reporting = "0.8.0"
Expand Down
2 changes: 1 addition & 1 deletion language_server/src/main_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ pub fn main_loop(global_state: &mut GlobalState, connection: &Connection) -> Res

#[derive(Debug, Default)]
pub struct LoopState {
next_request_id: u64,
next_request_id: i32,
opened_files: OpenedFiles,
configuration_request_id: Option<RequestId>,
}
Expand Down
3 changes: 1 addition & 2 deletions language_server/src/req.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ pub use lsp_types::{
DocumentSymbolParams, DocumentSymbolResponse, FileSystemWatcher, Hover, InitializeResult,
MessageType, PartialResultParams, ProgressParams, ProgressParamsValue, ProgressToken,
PublishDiagnosticsParams, ReferenceParams, Registration, RegistrationParams, SelectionRange,
SelectionRangeParams, SemanticTokensParams, SemanticTokensRangeParams,
SemanticTokensRangeResult, SemanticTokensResult, ServerCapabilities, ShowMessageParams,
SelectionRangeParams, ServerCapabilities, ShowMessageParams,
SignatureHelp, SymbolKind, TextDocumentEdit, TextDocumentPositionParams, TextEdit,
WorkDoneProgressParams, WorkspaceEdit, WorkspaceSymbolParams,
};
2 changes: 1 addition & 1 deletion language_server/tests/test_compilation_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fn script_path<'a>() -> impl Into<Cow<'a, str>> {
.to_string()
}

fn range(start: (u64, u64), end: (u64, u64)) -> Range {
fn range(start: (u32, u32), end: (u32, u32)) -> Range {
Range::new(Position::new(start.0, start.1), Position::new(end.0, end.1))
}

Expand Down
11 changes: 6 additions & 5 deletions language_server/tests/test_lsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use lang::compiler::file::MoveFile;
use lang::compiler::ConstPool;
use resources::assets_dir;

const SHUTDOWN_REQ_ID: u64 = 10;
const SHUTDOWN_REQ_ID: i32 = 10;

#[allow(deprecated)]
fn client_initialize_params() -> InitializeParams {
Expand All @@ -29,12 +29,13 @@ fn client_initialize_params() -> InitializeParams {
root_uri: None,
trace: None,
workspace_folders: None,
locale: None,
}
}

fn initialize_req(req_id: usize) -> Message {
fn initialize_req(req_id: i32) -> Message {
let req =
request_new::<Initialize>(RequestId::from(req_id as u64), client_initialize_params());
request_new::<Initialize>(RequestId::from(req_id), client_initialize_params());
Message::Request(req)
}

Expand All @@ -50,8 +51,8 @@ where
Message::Notification(notification_new::<N>(params))
}

fn response(req_id: usize, contents: serde_json::Value) -> Message {
Message::Response(Response::new_ok(RequestId::from(req_id as u64), contents))
fn response(req_id: i32, contents: serde_json::Value) -> Message {
Message::Response(Response::new_ok(RequestId::from(req_id), contents))
}

trait MessageType {
Expand Down

0 comments on commit e51980a

Please sign in to comment.