Update depencencies

This commit is contained in:
Markus Westerlind 2021-10-04 00:40:05 +02:00
parent 9f5e9e3733
commit 719fb7d34a
12 changed files with 538 additions and 725 deletions

1166
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -13,12 +13,12 @@ edition = "2018"
clap = "2.19.0"
log = "0.4.0"
env_logger = "0.7.0"
env_logger = "0.9.0"
anyhow = "1"
codespan-lsp = "0.10"
codespan-reporting = "0.9"
codespan-lsp = "0.11.1"
codespan-reporting = "0.11.1"
url = "2"
@ -26,25 +26,25 @@ combine = "4"
async-trait = "0.1"
async-pipe = "0.1"
jsonrpc-core = "14"
jsonrpc-core = "18.0.0"
futures = { version = "0.3", features = ["compat"] }
tokio = { version = "0.2", features = ["full"] }
tokio-util = { version = "0.3", features = ["codec"] }
bytes = "0.5"
tokio = { version = "1.12.0", features = ["full"] }
tokio-util = { version = "0.6.8", features = ["codec"] }
bytes = "1.1.0"
serde = "1.0.0"
serde_json = "1.0.0"
serde_derive = "1.0.0"
lsp-types = "0.77.0"
lsp-types = "0.88.0"
debugserver-types = "0.5.0"
gluon = { version = "0.17", features = ["serialization", "regex", "rand", "web"] }
gluon_completion = "0.17"
gluon_format = "0.17"
gluon = { version = "0.18.1", features = ["serialization", "regex", "rand", "web"] }
gluon_completion = "0.18.0"
gluon_format = "0.18.0"
[dev-dependencies]
pretty_assertions = "0.6"
pretty_assertions = "1.0.0"
# [patch.crates-io]
# gluon_base = { path = "../gluon/base" }

View file

@ -11,18 +11,22 @@ use gluon::{
use {futures::prelude::*, tokio::sync::Mutex, url::Url};
use crate::{name::module_name_to_file_, text_edit::TextChanges};
use crate::{
name::module_name_to_file_,
text_edit::{TextChanges, Version},
};
pub(crate) struct Module {
pub source: Arc<gluon::base::source::FileMap>,
pub expr: Arc<OwnedExpr<Symbol>>,
#[allow(unused)] // TODO
pub metadata: Arc<Metadata>,
pub uri: Url,
}
pub struct State {
pub uri: Url,
pub version: Option<i64>,
pub version: Option<Version>,
pub text_changes: TextChanges,
}

View file

@ -50,6 +50,7 @@ impl LanguageServerCommand<InitializeParams> for Initialize {
work_done_progress_options: WorkDoneProgressOptions {
work_done_progress: None,
},
all_commit_characters: None,
}),
signature_help_provider: Some(SignatureHelpOptions {
trigger_characters: None,
@ -59,11 +60,11 @@ impl LanguageServerCommand<InitializeParams> for Initialize {
},
}),
hover_provider: Some(true.into()),
document_formatting_provider: Some(true),
document_highlight_provider: Some(true),
document_symbol_provider: Some(true),
workspace_symbol_provider: Some(true),
definition_provider: Some(true),
document_formatting_provider: Some(lsp_types::OneOf::Left(true)),
document_highlight_provider: Some(lsp_types::OneOf::Left(true)),
document_symbol_provider: Some(lsp_types::OneOf::Left(true)),
workspace_symbol_provider: Some(lsp_types::OneOf::Left(true)),
definition_provider: Some(lsp_types::OneOf::Left(true)),
..ServerCapabilities::default()
},
})

View file

@ -143,6 +143,7 @@ fn completion_symbol_to_document_symbol(
})
.unwrap_or_else(|| completion_symbol_kind(&symbol.value));
let range = byte_span_to_range(source, symbol.span)?;
#[allow(deprecated)]
Ok(DocumentSymbol {
kind,
range,
@ -173,6 +174,7 @@ fn completion_symbol_to_document_symbol(
Some(children)
}
},
tags: Default::default(),
})
}
@ -182,6 +184,7 @@ fn completion_symbol_to_symbol_information(
uri: Url,
) -> Result<SymbolInformation, ServerError<()>> {
let kind = completion_symbol_kind(&symbol.value);
#[allow(deprecated)]
Ok(SymbolInformation {
kind,
location: Location {
@ -191,6 +194,7 @@ fn completion_symbol_to_symbol_information(
name: symbol.value.name.declared_name().to_string(),
container_name: None,
deprecated: Default::default(),
tags: Default::default(),
})
}

View file

@ -76,9 +76,10 @@ pub fn register(io: &mut IoHandler, thread: &RootedThread) {
})
.collect(),
),
active_parameter: None,
}],
active_signature: None,
active_parameter: help.index.map(i64::from),
active_parameter: help.index.map(u32::from),
}
}),
)

View file

@ -32,7 +32,7 @@ use crate::{
},
rpc::{self, send_response, Entry, ServerError},
server::{Handler, ShutdownReceiver},
text_edit::TextChanges,
text_edit::{TextChanges, Version},
};
fn create_diagnostics<'a>(
@ -126,7 +126,7 @@ impl DiagnosticsWorker {
pub async fn run_diagnostics(
&mut self,
uri_filename: &Url,
version: Option<i64>,
version: Option<Version>,
fileinput: &str,
) {
info!("Running diagnostics on {}", uri_filename);
@ -182,7 +182,7 @@ impl DiagnosticsWorker {
&mut self,
uri_filename: &Url,
name: &str,
version: Option<i64>,
version: Option<Version>,
) -> GluonResult<()> {
let result = self
.thread
@ -283,7 +283,7 @@ pub fn register(
mut work_queue: S,
change: DidChangeTextDocumentParams,
) where
S: Sink<Entry<Url, String, i64>, Error = ()> + Send + Unpin + 'static,
S: Sink<Entry<Url, String, Version>, Error = ()> + Send + Unpin + 'static,
{
// If it does not exist in sources it should exist in the `import` macro
let import = thread.get_macros().get("import").expect("Import macro");
@ -302,7 +302,7 @@ pub fn register(
.or_insert_with(|| State::empty(change.text_document.uri.clone()));
module_state.text_changes.add(
change.text_document.version.expect("version"),
crate::text_edit::Version::from(change.text_document.version),
change.content_changes,
);

View file

@ -55,7 +55,7 @@ use gluon::base::{
fn position_to_byte_index(
files: &FileMap,
position: &lsp_types::Position,
) -> Result<ByteIndex, codespan_lsp::Error> {
) -> Result<ByteIndex, codespan_reporting::files::Error> {
let index = codespan_lsp::position_to_byte_index(files, (), position)?;
Ok(files.span().start() + ByteOffset::from(index as i64))
@ -64,7 +64,7 @@ fn position_to_byte_index(
fn byte_span_to_range(
files: &FileMap,
span: Span<ByteIndex>,
) -> Result<lsp_types::Range, codespan_lsp::Error> {
) -> Result<lsp_types::Range, codespan_reporting::files::Error> {
let start = files.span().start().to_usize();
let range = span.start().to_usize() - start..span.end().to_usize() - start;
codespan_lsp::byte_span_to_range(files, (), range)

View file

@ -23,10 +23,7 @@ use combine::{
Parser,
};
use bytes::{
buf::{ext::BufMutExt, Buf},
BytesMut,
};
use bytes::{buf::Buf, BufMut, BytesMut};
use tokio_util::codec::{Decoder, Encoder};
@ -128,7 +125,7 @@ where
T: LanguageServerCommand<P>,
P: for<'de> serde::Deserialize<'de> + 'static,
{
type Out = futures::compat::Compat<BoxFuture<Value, Error>>;
type Out = BoxFuture<Value, Error>;
fn call(&self, param: Params) -> Self::Out {
let value = match param {
Params::Map(map) => Value::Object(map),
@ -154,7 +151,6 @@ where
}),
})
.boxed()
.compat()
}
Err(err) => err,
};
@ -167,7 +163,6 @@ where
.map(|v| to_value(v).expect("error data could not be serialized")),
})
.boxed()
.compat()
}
}

View file

@ -4,7 +4,6 @@ use {
anyhow::anyhow,
futures::{
channel::{mpsc, oneshot},
compat::*,
prelude::*,
},
jsonrpc_core::{IoHandler, MetaIoHandler},
@ -121,17 +120,16 @@ impl Server {
let mut message_sender = message_sender.clone();
async move {
debug!("Handle: {}", json);
let result = handlers.handle_request(&json).compat().await;
let result = handlers.handle_request(&json).await;
match result {
Ok(Some(response)) => {
Some(response) => {
debug!("Response: {}", response);
message_sender
.send(response)
.await
.map_err(|_| anyhow!("Unable to send"))?;
}
Ok(None) => (),
Err(()) => (),
None => (),
}
Ok(())
}

View file

@ -5,7 +5,7 @@ use lsp_types::TextDocumentContentChangeEvent;
use crate::rpc::ServerError;
use codespan_lsp::range_to_byte_span;
pub type Version = i64;
pub type Version = i32;
#[derive(Debug)]
struct VersionedChange {

View file

@ -116,7 +116,7 @@ where
did_open_uri(stdin, test_url(uri), text).await
}
pub async fn did_change<W: ?Sized>(stdin: &mut W, uri: &str, version: i64, range: Range, text: &str)
pub async fn did_change<W: ?Sized>(stdin: &mut W, uri: &str, version: i32, range: Range, text: &str)
where
W: AsyncWrite + Unpin,
{
@ -136,7 +136,7 @@ where
pub async fn did_change_event<W: ?Sized>(
stdin: &mut W,
uri: &str,
version: i64,
version: i32,
content_changes: Vec<TextDocumentContentChangeEvent>,
) where
W: AsyncWrite + Unpin,
@ -146,7 +146,7 @@ pub async fn did_change_event<W: ?Sized>(
DidChangeTextDocumentParams {
text_document: VersionedTextDocumentIdentifier {
uri: test_url(uri),
version: Some(version),
version,
},
content_changes,
},
@ -231,10 +231,8 @@ pub fn run_no_panic_catch<F>(fut: F)
where
F: Future<Output = ()> + Send + 'static,
{
tokio::runtime::Builder::new()
tokio::runtime::Builder::new_current_thread()
.enable_all()
.core_threads(1)
.basic_scheduler()
.build()
.unwrap()
.block_on(fut)
@ -246,8 +244,8 @@ struct ServerHandle {
}
fn start_local() -> ServerHandle {
let (mut stdin_write, stdin_read) = async_pipe::pipe();
let (stdout_write, stdout_read) = async_pipe::pipe();
let (mut stdin_write, stdin_read) = tokio::io::duplex(4096);
let (stdout_write, stdout_read) = tokio::io::duplex(4096);
let stdout_read = BufReader::new(stdout_read);
tokio::spawn(async move {