Update dependencies; fix breakage

This commit is contained in:
silvanshade 2022-07-09 18:18:42 -06:00
parent f9e82abb85
commit 0a0dfd058c
No known key found for this signature in database
8 changed files with 1053 additions and 2958 deletions

View file

@ -4,7 +4,7 @@ skip_core_tasks = true
[tasks.deps]
script = '''
cargo install wasm-bindgen-cli --version 0.2.80
cargo install wasm-bindgen-cli --version 0.2.81
npm install
'''

View file

@ -17,11 +17,11 @@ demo-lsp-server = { version = "0.0", path = "../server", default-features = fals
futures = "0.3.21"
js-sys = "0.3.57"
tower-lsp = { version = "0.17.0", default-features = false }
tree-sitter = { version = "*", package = "tree-sitter-facade" }
wasm-bindgen = "0.2.80"
tree-sitter = { version = "0.9", package = "tree-sitter-facade" }
wasm-bindgen = "0.2.81"
wasm-bindgen-futures = { version = "0.4.30", features = ["futures-core-03-stream"] }
wasm-streams = "0.2.3"
web-tree-sitter-sys = "*"
web-tree-sitter-sys = "1.3"
[dependencies.web-sys]
version = "0.3.57"

View file

@ -4,7 +4,7 @@
use futures::stream::TryStreamExt;
use tower_lsp::{LspService, Server};
use wasm_bindgen::{prelude::*, JsCast};
use wasm_bindgen_futures::{stream::JsStream, JsFuture};
use wasm_bindgen_futures::stream::JsStream;
#[wasm_bindgen]
pub struct ServerConfig {
@ -39,10 +39,8 @@ pub async fn serve(config: ServerConfig) -> Result<(), JsValue> {
from_server,
} = config;
tree_sitter::TreeSitter::init().await?;
let language = demo_lsp_language::language::javascript().await.unwrap();
JsFuture::from(web_tree_sitter_sys::Parser::init())
.await
.expect("failed to initialize tree-sitter");
let input = JsStream::from(into_server);
let input = input

View file

@ -9,8 +9,8 @@ anyhow = "1.0"
futures = "0.3"
thiserror = "1.0"
js-sys = "0.3.57"
tree-sitter = { version = "*", package = "tree-sitter-facade" }
wasm-bindgen = { version = "=0.2.80", features = ["strict-macro"] }
tree-sitter = { version = "0.9", package = "tree-sitter-facade" }
wasm-bindgen = { version = "=0.2.81", features = ["strict-macro"] }
wasm-bindgen-futures = "0.4"
web-sys = "0.3.57"
web-tree-sitter-sys = "*"
web-tree-sitter-sys = "1.3"

View file

@ -1,15 +1,9 @@
use anyhow::anyhow;
pub async fn javascript() -> anyhow::Result<tree_sitter::Language> {
use wasm_bindgen::JsCast;
use wasm_bindgen_futures::JsFuture;
let bytes: &[u8] = include_bytes!("../../../node_modules/tree-sitter-javascript/tree-sitter-javascript.wasm");
let promise = web_tree_sitter_sys::Language::load_bytes(&bytes.into());
let future = JsFuture::from(promise);
let value = future
let result = web_tree_sitter_sys::Language::load_bytes(&bytes.into())
.await
.map_err(|_| anyhow!("failed to load tree-sitter-javascript.wasm"))?;
let inner = value.unchecked_into::<web_tree_sitter_sys::Language>();
let result = inner.into();
.map(Into::into)
.map_err(Into::<tree_sitter::LanguageError>::into)?;
Ok(result)
}

View file

@ -21,16 +21,16 @@ indoc = "1.0"
js-sys = "0.3.57"
log = "0.4"
lsp = { version = "0.93", package = "lsp-types" }
lsp-text = { version = "0.5", features = ["tree-sitter"] }
lsp-text = { version = "0.9", features = ["tree-sitter"] }
ropey = "1.5.0"
serde_json = "1.0"
thiserror = "1.0"
tower-lsp = { version = "0.17.0", default-features = false }
tree-sitter = { package = "tree-sitter-facade", version = "0.4" }
wasm-bindgen = "0.2.80"
tree-sitter = { version = "0.9", package = "tree-sitter-facade" }
wasm-bindgen = "0.2.81"
wasm-bindgen-futures = { version = "0.4.30", features = ["futures-core-03-stream"] }
wasm-streams = "0.2.3"
web-tree-sitter-sys = "0.6"
web-tree-sitter-sys = "1.3"
[dependencies.web-sys]
version = "0.3.57"

3969
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -5,6 +5,6 @@
],
"dependencies": {
"tree-sitter-javascript": "^0.19.0",
"web-tree-sitter": "https://gitpkg.now.sh/silvanshade/tree-sitter/lib/binding_web?web-tree-sitter-sys@v0.20.6"
"web-tree-sitter-wasm-bindgen": "silvanshade/web-tree-sitter-wasm-bindgen"
}
}