Skip to content

Commit

Permalink
Use bool vars
Browse files Browse the repository at this point in the history
  • Loading branch information
asterite committed Jul 22, 2024
1 parent 7831672 commit dc1ea33
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 6 deletions.
36 changes: 32 additions & 4 deletions tooling/lsp/src/notifications/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,15 @@ pub(super) fn on_did_open_text_document(
state.input_files.insert(params.text_document.uri.to_string(), params.text_document.text);

let document_uri = params.text_document.uri;
let only_process_document_uri_package = false;
let output_diagnostics = true;

match process_workspace_for_noir_document(state, document_uri, false, true) {
match process_workspace_for_noir_document(
state,
document_uri,
only_process_document_uri_package,
output_diagnostics,
) {
Ok(_) => {
state.open_documents_count += 1;
ControlFlow::Continue(())
Expand All @@ -55,8 +62,15 @@ pub(super) fn on_did_change_text_document(
state.input_files.insert(params.text_document.uri.to_string(), text.clone());

let document_uri = params.text_document.uri;
let only_process_document_uri_package = true;
let output_diagnotics = false;

Check warning on line 66 in tooling/lsp/src/notifications/mod.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (diagnotics)

match process_workspace_for_noir_document(state, document_uri, true, false) {
match process_workspace_for_noir_document(
state,
document_uri,
only_process_document_uri_package,
output_diagnotics,

Check warning on line 72 in tooling/lsp/src/notifications/mod.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (diagnotics)
) {
Ok(_) => ControlFlow::Continue(()),
Err(err) => ControlFlow::Break(Err(err)),
}
Expand All @@ -76,8 +90,15 @@ pub(super) fn on_did_close_text_document(
}

let document_uri = params.text_document.uri;
let only_process_document_uri_package = true;
let output_diagnotics = false;

Check warning on line 94 in tooling/lsp/src/notifications/mod.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (diagnotics)

match process_workspace_for_noir_document(state, document_uri, true, false) {
match process_workspace_for_noir_document(
state,
document_uri,
only_process_document_uri_package,
output_diagnotics,

Check warning on line 100 in tooling/lsp/src/notifications/mod.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (diagnotics)
) {
Ok(_) => ControlFlow::Continue(()),
Err(err) => ControlFlow::Break(Err(err)),
}
Expand All @@ -88,8 +109,15 @@ pub(super) fn on_did_save_text_document(
params: DidSaveTextDocumentParams,
) -> ControlFlow<Result<(), async_lsp::Error>> {
let document_uri = params.text_document.uri;
let only_process_document_uri_package = false;
let output_diagnotics = true;

Check warning on line 113 in tooling/lsp/src/notifications/mod.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (diagnotics)

match process_workspace_for_noir_document(state, document_uri, false, true) {
match process_workspace_for_noir_document(
state,
document_uri,
only_process_document_uri_package,
output_diagnotics,
) {
Ok(_) => ControlFlow::Continue(()),
Err(err) => ControlFlow::Break(Err(err)),
}
Expand Down
7 changes: 5 additions & 2 deletions tooling/lsp/src/requests/references.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,14 @@ mod references_tests {
let two_lib = Url::from_file_path(workspace_dir.join("two/src/lib.nr")).unwrap();

// We call this to open the document, so that the entire workspace is analyzed
let only_process_document_uri_package = false;
let output_diagnostics = true;

notifications::process_workspace_for_noir_document(
&mut state,
one_lib.clone(),
false,
true,
only_process_document_uri_package,
output_diagnostics,
)
.unwrap();

Expand Down

0 comments on commit dc1ea33

Please sign in to comment.