-
Notifications
You must be signed in to change notification settings - Fork 22
[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
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 👍
codeflash/cli_cmds/cmd_init.py
Outdated
|
|
||
|
|
||
| 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
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.
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:
as someone who has continuously had issues with the code cli over the years on basically all platforms, if we can place the VSIX archive where it belongs directly, and it work out of the box, I much prefer to do that.
codeflash/cli_cmds/cmd_init.py
Outdated
| [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)
codeflash/cli_cmds/cmd_init.py
Outdated
| 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)
|
@mohammedahmed18 whats the status with this? |
|
@misrasaurabh1 going to manually download the extension in .vscode dir as a fallback if the cli not found Will start on thet tomorrow |
…stall-vscode-extension
…ai/codeflash into init/install-vscode-extension
|
@Saga4 to review |
|
@mohammedahmed18 whats going on here? |
|
@misrasaurabh1 after the windows support I still need to make sure this still works on windows, |
|
@mohammedahmed18 if this works for mac then lets merge it, unless you have a quick windows machine. After that you can ensure that this works for windows. We should not let PRs get stale. |
|
let's just merge it, I'll test it on windows later and merge any necessary fixes. |
|
@KRRT7 okay it should be ready then |
PR Type
Enhancement
Description
Introduce
vscode-installCLI subcommandImplement VSCode extension installer with progress bar
Invoke extension install in
initcommand flowDiagram Walkthrough
File Walkthrough
cli.py
Add VSCode install subcommandcodeflash/cli_cmds/cli.py
install_vscode_extensionin CLIvscode-installsubparser and handlercmd_init.py
Implement VSCode extension installationcodeflash/cli_cmds/cmd_init.py
shutilandprogress_barinstall_vscode_extensionfunctioninit_codeflashflow