Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add noir_lsp_wasm as a WASI implementation of the LSP #2769

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
7d2280f
feat: Add noir_lsp_wasm as a WASI implementation of the LSP
phated Sep 20, 2023
5836927
align rustix version with async-lsp
phated Sep 21, 2023
73fd403
upgrade rust toolchain to build WASI correctly
phated Sep 21, 2023
733d824
regen lock
phated Sep 21, 2023
23f8f49
normalize the vscode-test-web scheme
phated Sep 21, 2023
05b2af6
msrv to 1.67.0
phated Sep 21, 2023
4781f10
Merge branch 'master' into phated/lsp-wasm
TomAFrench Sep 29, 2023
abd0ec0
chore: clippy
TomAFrench Sep 29, 2023
e1c37ad
Merge branch 'master' into phated/lsp-wasm
TomAFrench Sep 29, 2023
420e25e
chore: move dependencies down into `noir_lsp_wasm`
TomAFrench Sep 29, 2023
859423e
Merge branch 'master' into phated/lsp-wasm
TomAFrench Sep 29, 2023
7d31a7a
chore: remove unused dependencies
TomAFrench Sep 29, 2023
4901267
chore: push stdio implementation upstream
TomAFrench Sep 29, 2023
627c390
Merge branch 'master' into phated/lsp-wasm
TomAFrench Sep 29, 2023
b7997e3
Merge branch 'master' into phated/lsp-wasm
TomAFrench Sep 29, 2023
43ec9dc
Merge branch 'master' into phated/lsp-wasm
TomAFrench Oct 18, 2023
c584fdd
Merge branch 'master' into phated/lsp-wasm
TomAFrench Oct 25, 2023
02f58c7
Merge branch 'master' into phated/lsp-wasm
TomAFrench Oct 31, 2023
10561d5
chore: fix `rust-version` field
TomAFrench Oct 31, 2023
b3de1bf
chore: fix merge
TomAFrench Oct 31, 2023
1a9a5b4
chore: enforce consistent version on noir_lsp_wasm
TomAFrench Oct 31, 2023
43a15b7
chore: use upstream async-lsp
TomAFrench Oct 31, 2023
c0f8f67
Merge branch 'master' into phated/lsp-wasm
TomAFrench Nov 2, 2023
7337352
Merge branch 'master' into phated/lsp-wasm
TomAFrench Nov 2, 2023
a8a6fc2
Merge branch 'master' into phated/lsp-wasm
TomAFrench Nov 14, 2023
88b44e8
Merge branch 'master' into phated/lsp-wasm
TomAFrench Nov 17, 2023
a1a4310
chore: remove unused patch
TomAFrench Nov 17, 2023
3cd3da0
Merge branch 'master' into phated/lsp-wasm
TomAFrench Jan 12, 2024
73a26a1
Merge branch 'master' into phated/lsp-wasm
TomAFrench Apr 21, 2024
389b7a0
chore: fix build
TomAFrench Apr 21, 2024
ee07c58
chore: fix CI
TomAFrench Apr 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
168 changes: 144 additions & 24 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ members = [
"tooling/backend_interface",
"tooling/bb_abstraction_leaks",
"tooling/lsp",
"tooling/lsp_wasm",
"tooling/debugger",
"tooling/nargo",
"tooling/nargo_fmt",
Expand Down Expand Up @@ -75,6 +76,7 @@ nargo = { path = "tooling/nargo" }
nargo_fmt = { path = "tooling/nargo_fmt" }
nargo_toml = { path = "tooling/nargo_toml" }
noir_lsp = { path = "tooling/lsp" }
noir_lsp_wasm = { path = "tooling/lsp_wasm" }
noir_debugger = { path = "tooling/debugger" }
noirc_abi = { path = "tooling/noirc_abi" }
bb_abstraction_leaks = { path = "tooling/bb_abstraction_leaks" }
Expand Down
2 changes: 1 addition & 1 deletion tooling/lsp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ license.workspace = true
[dependencies]
acvm.workspace = true
codespan-lsp.workspace = true
lsp-types.workspace = true
nargo.workspace = true
nargo_fmt.workspace = true
nargo_toml.workspace = true
Expand All @@ -21,6 +20,7 @@ noirc_frontend.workspace = true
serde.workspace = true
serde_json.workspace = true
tower.workspace = true
lsp-types.workspace = true
async-lsp = { workspace = true, features = ["omni-trait"] }
serde_with = "3.2.0"
thiserror.workspace = true
Expand Down
11 changes: 11 additions & 0 deletions tooling/lsp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,15 @@ impl LspService for NargoLspService {
}
}

// This smooths over `vscode-test-web://` or other schemes that may be sent from a browser client
fn uri_to_file_path(uri: &Url) -> Result<PathBuf, ()> {
if uri.scheme() == "vscode-test-web" {
Ok(PathBuf::from("/").join(uri.path()))
} else {
uri.to_file_path()
}
}

fn get_package_tests_in_crate(
context: &Context,
crate_id: &CrateId,
Expand All @@ -170,6 +179,8 @@ fn get_package_tests_in_crate(
let file_path = fm.path(file_id).expect("file must exist to contain tests");
let range =
byte_span_to_range(files, file_id, location.span.into()).unwrap_or_default();
// These `file://` URIs are currently normalized inside of the vscode extension
// TODO: Do proper normalization inside the LSP instead of at the extension
let file_uri = Url::from_file_path(file_path)
.expect("Expected a valid file path that can be converted into a URI");

Expand Down
Loading
Loading