-
Notifications
You must be signed in to change notification settings - Fork 21
[INIT] install VSCode extension #699
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
base: main
Are you sure you want to change the base?
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
codeflash/cli_cmds/cmd_init.py
Outdated
error = e.stderr or "Unknown error." | ||
|
||
if error: | ||
click.echo("❌ Failed to install Codeflash for VSCode.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than failed msg, we can suggest user to install VSC extension and error msg can go to our telemetry for our own logs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done 👍
@@ -802,6 +805,41 @@ def install_github_actions(override_formatter_check: bool = False) -> None: # n | |||
apologize_and_exit() | |||
|
|||
|
|||
def install_vscode_extension() -> None: | |||
vscode_path = shutil.which("code") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does vscode automatically install the "code" cli or does the user have to install it manually by following this step?
my question is that is it justified to always assume that code
exists? If not , is there a more robust way to discover the installation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on linux systems, if you use your package manager like apt or pacman ...
you will get the cli in your path without doing extra step.
for macos users they need to add it to their path manually after the installation
https://code.visualstudio.com/docs/setup/mac#_configure-the-path-with-vs-code
another workaround, without using the cli is to manually download the vsix file, unzip it, place it in the vscode installation path, in linux it would be:
- ~/.vscode/extensions (official vscode)
- ~/.vscode-oss/extensions (codium)
- ~/.windsurf/extensions
- ~/.cursor/extensions
(not sure about macos but it should be in Application Support dir)
then manually add the codeflash identifier to the extensions.json file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but I guess we would need this workaround eventually specially for cursor: https://forum.cursor.com/t/command-line-list-extensions/103565/13
so I'll add this manual installation as a fallback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but we still need to download the vsix file from somewhere, and it's a bit tricky to do that from the official marketplace, that's why we need to push this to the open vsx registery @Saga4 as they have an api for that
[vscode_path, "--install-extension", "codeflash.codeflash", "--force"], | ||
check=True, | ||
text=True, | ||
timeout=60, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it really takes that much time, i am also thinking that we can run it in parallel with the other init steps and only print that successfully installed the vs code extension
.
I am concerned about the blocking experience here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it doesn't the extension is around 250kb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it takes 2 seconds to initialize the cli and install the extension
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but yeah let's run it in parallel, if we are going to manually download and and install the extension #699 (comment)
return | ||
|
||
error = "" | ||
with progress_bar("Installing Codeflash for VSCode…"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one more thing - what if they have cursor installed? we should also support installing codeflash there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I think for cursor we would need to manually add it because the cli is not working for many people (including me) #699 (comment)
…stall-vscode-extension
PR Type
Enhancement
Description
Introduce
vscode-install
CLI subcommandImplement VSCode extension installer with progress bar
Invoke extension install in
init
command flowDiagram Walkthrough
File Walkthrough
cli.py
Add VSCode install subcommand
codeflash/cli_cmds/cli.py
install_vscode_extension
in CLIvscode-install
subparser and handlercmd_init.py
Implement VSCode extension installation
codeflash/cli_cmds/cmd_init.py
shutil
andprogress_bar
install_vscode_extension
functioninit_codeflash
flow