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 debug codelens action #5474

Merged
merged 3 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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 @@ -154,35 +156,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
Loading