Skip to content

Commit

Permalink
feat: add debug codelens action (#5474)
Browse files Browse the repository at this point in the history
# Description
Give more visibility to debugger

## Summary\*

- Add a new `Debug` codelens action to main functions
- Unhid the `debug` command from nargo_cli


https://github.com/noir-lang/vscode-noir/assets/13237343/6e83d28c-126a-41ff-a23b-bc7ce9a50ccb

## Additional Context

This PR has its sibling in vscode-noir repo noir-lang/vscode-noir#85

## Documentation\*

Check one:
- [X] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.

# PR Checklist\*

- [X] I have tested the changes locally.
- [X] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
  • Loading branch information
anaPerezGhiglia authored Jul 15, 2024
1 parent 1346e67 commit 246b1a0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 30 deletions.
47 changes: 18 additions & 29 deletions tooling/lsp/src/requests/code_lens_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ const INFO_COMMAND: &str = "nargo.info";
const INFO_CODELENS_TITLE: &str = "Info";
const EXECUTE_COMMAND: &str = "nargo.execute";
const EXECUTE_CODELENS_TITLE: &str = "Execute";
const DEBUG_COMMAND: &str = "nargo.debug.dap";
const DEBUG_CODELENS_TITLE: &str = "Debug";

const PROFILE_COMMAND: &str = "nargo.profile";
const PROFILE_CODELENS_TITLE: &str = "Profile";
Expand Down Expand Up @@ -158,35 +160,22 @@ pub(crate) fn collect_lenses_for_package(

lenses.push(compile_lens);

let info_command = Command {
title: INFO_CODELENS_TITLE.to_string(),
command: INFO_COMMAND.into(),
arguments: Some(package_selection_args(workspace, package)),
};

let info_lens = CodeLens { range, command: Some(info_command), data: None };

lenses.push(info_lens);

let execute_command = Command {
title: EXECUTE_CODELENS_TITLE.to_string(),
command: EXECUTE_COMMAND.into(),
arguments: Some(package_selection_args(workspace, package)),
};

let execute_lens = CodeLens { range, command: Some(execute_command), data: None };

lenses.push(execute_lens);

let profile_command = Command {
title: PROFILE_CODELENS_TITLE.to_string(),
command: PROFILE_COMMAND.into(),
arguments: Some(package_selection_args(workspace, package)),
};

let profile_lens = CodeLens { range, command: Some(profile_command), data: None };

lenses.push(profile_lens);
let internal_command_lenses = [
(INFO_CODELENS_TITLE, INFO_COMMAND),
(EXECUTE_CODELENS_TITLE, EXECUTE_COMMAND),
(PROFILE_CODELENS_TITLE, PROFILE_COMMAND),
(DEBUG_CODELENS_TITLE, DEBUG_COMMAND),
]
.map(|(title, command)| {
let command = Command {
title: title.to_string(),
command: command.into(),
arguments: Some(package_selection_args(workspace, package)),
};
CodeLens { range, command: Some(command), data: None }
});

lenses.append(&mut Vec::from(internal_command_lenses));
}
}

Expand Down
1 change: 0 additions & 1 deletion tooling/nargo_cli/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ enum NargoCommand {
Execute(execute_cmd::ExecuteCommand),
#[command(hide = true)] // Hidden while the feature is being built out
Export(export_cmd::ExportCommand),
#[command(hide = true)] // Hidden while the feature is being built out
Debug(debug_cmd::DebugCommand),
Test(test_cmd::TestCommand),
Info(info_cmd::InfoCommand),
Expand Down

0 comments on commit 246b1a0

Please sign in to comment.