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

Debug: new button to export log #3256

Merged
merged 11 commits into from
Feb 28, 2024
Merged

Debug: new button to export log #3256

merged 11 commits into from
Feb 28, 2024

Conversation

abeatrix
Copy link
Contributor

@abeatrix abeatrix commented Feb 24, 2024

proof of concept: Add functionality to export Cody output logs using VS Code API

This PR introduces the ability to export Cody output as log file in the VS Code extension by utilizing the VS Code API. It provides a seamless log export experience that is compatible with all VS Code client types that supports the VS Code API.

  • Added a new command 'cody.debug.export.logs' to export Cody output logs in the VS Code extension.
  • Updated main.ts to include the import of 'exportOutputLog' function.
  • Registered the 'cody.debug.export.logs' command in the extension.
  • Added a new command 'cody.sidebar.logs' in SidebarCommands.ts to export logs from the sidebar.
  • Updated treeViewItems.ts to include an 'Export Logs' option in the sidebar tree view.

Updated:

Moved to the ... menu

image

Follow-up

We should enable debugs by default.

Test plan

Click on the "Export logs" icon in the sidebar to export the text from output channel.

export.mov

Copy link
Contributor

@philipp-spiess philipp-spiess left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

// search for the file name that ends with 'Cody by Sourcegraph.log' inside the outputdir
const outputDir = vscode.Uri.joinPath(logDir, outputDirStat[0])
const outputFiles = await vscode.workspace.fs.readDirectory(outputDir)
const logFile = outputFiles.find(file => file[0].endsWith('Cody by Sourcegraph.log'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting! is there a way we can avoid hardcoding these values and use the ones that are currently defined for the extension name etc?

Want to avoid breaking it if we decide to change the name

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, let me check on this!

)

if (!outputDirStat) {
return
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe if this fails here or below, we can just open the output channel as a fallback?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea!

@toolmantim
Copy link
Contributor

Can we move it behind the “…” menu, out of the treeview? Thanks!

@abeatrix
Copy link
Contributor Author

Can we move it behind the “…” menu, out of the treeview? Thanks!

for sure! What is ... menu though 😆

@toolmantim
Copy link
Contributor

toolmantim commented Feb 24, 2024

When you hover over “Settings & Support” there’s the “…” button, and it opens an OS popover menu. From memory the getting started guide is there (that’s actually probably a better candidate for the treeview). If we could have the export action appear in the “…” popover menu, instead of the treeview, I think that would be best.

Copy link
Contributor

@arafatkatze arafatkatze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙇

@abeatrix
Copy link
Contributor Author

When you hover over “Settings & Support” there’s the “…” button, and it opens an OS popover menu. From memory the getting started guide is there (that’s actually probably a better candidate for the treeview). If we could have the export action appear in the “…” popover menu, instead of the treeview, I think that would be best.

Moved the item to the ... menu 🙂
image

@abeatrix abeatrix changed the title Debug: sidebar item to export log Debug: new button to export log Feb 27, 2024
Copy link
Contributor

@toolmantim toolmantim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it! One tiny thing about the action labeling, given it’s not atomic (opens the file save dialog)

Can we mention in the changelog/PR that it’s also available in the standard VS Code command palette? I feel like the easiest instructions for support people is to tell people to type Cmd-Shift-P and type “Cody export logs”

vscode/package.json Outdated Show resolved Hide resolved
@abeatrix abeatrix merged commit c4f38f7 into main Feb 28, 2024
16 checks passed
@abeatrix abeatrix deleted the bee/export-log branch February 28, 2024 16:23
steveyegge pushed a commit that referenced this pull request Mar 13, 2024
Co-authored-by: Tim Lucas <t@toolmantim.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants