-
Notifications
You must be signed in to change notification settings - Fork 647
Launch cli with proper params, remove unused strings and old command logic #9684
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
Launch cli with proper params, remove unused strings and old command logic #9684
Conversation
extension/src/commands/run.ts
Outdated
terminal.sendText(`aspire run --project "${selectedProject}"`); | ||
terminal.show(); | ||
} | ||
terminal.sendText(`aspire run --language ${vscode.env.language}`); |
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.
What's --language?
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.
CLI needs to know the vs code user’s current locale so that when it sends text back, that text is localized. —language is a switch that will need to be added to the cli to enable that, but for now can do nothing
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.
Why is this a command line option instead of an environment variable?
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’s mentioned in the description
this shouldn't be an environment variable because the language can change over the extension lifetime, we cannot update existing terminal environment variables, and should not create another terminal after language changes
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.
we should reuse the same terminal for the entire lifetime of the extension, but you can’t update the env of an existing vsc terminal, so it shouldn’t be an env variable at all
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.
aspire run delegates to the apphost, the application owns the argument list. We will need to split application args from aspire cli args to make this work. It might be aspire [args] run [app args]
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.
Gotcha, we should consider doing that then
@mitchdenny
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.
I think for extension to CLI option passing we should just use environment variables since its not a mechanism that we would expect anything other than the extension to use.
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.
Gotcha, wll convert to env variable. We just need to be aware of the small tradeoff we make doing 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.
Pull Request Overview
This PR updates the CLI launch behavior by removing deprecated command logic and using a proper terminal language parameter. It removes unused project file helper functions, updates the RPC server to include a full address, and revises the run and add commands to check for a workspace before executing commands.
Reviewed Changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
extension/src/utils/projects.ts | Removed unused functions that handled project file retrieval and selection. |
extension/src/server/rpcServer.ts | Added a new fullAddress property to the RPC server information. |
extension/src/extension.ts | Changed rpcServerInfo to be exported for broader access. |
extension/src/constants/strings.ts | Removed outdated command strings and added a noWorkspaceOpen message. |
extension/src/commands/run.ts | Updated run command to use --language; added a workspace check but without error messaging. |
extension/src/commands/add.ts | Simplified add command by removing package selection logic and including a workspace check. |
Various package.nls.*.json files | Updated localization files to remove old command strings and include the noWorkspaceOpen message. |
extension/src/commands/run.ts
Outdated
terminal.sendText(`aspire run --project "${selectedProject}"`); | ||
terminal.show(); | ||
} | ||
terminal.sendText(`aspire --language ${vscode.env.language} run`); |
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.
Not sure we'll need --language
? But maybe I haven't thought about it enough.
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.
Let’s just make it work without language for now @adamint
extension/src/server/rpcServer.ts
Outdated
const addressInfo = rpcServer?.address(); | ||
if (typeof addressInfo === 'object' && addressInfo?.port) { | ||
outputChannelWriter.appendLine(rpcServerListening(addressInfo.port)); | ||
const fullAddress = `http://localhost:${addressInfo.port}`; |
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 the RPC have the mechanism to use unix sockets or is only http possible?
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.
Yes, just the address here is wrong. Removed the protocol
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.
Happy to get this in and then we can work on the CLI side (pending changing the language to an environment variable).
13 of the files are just updated nls files.
ASPIRE_EXTENSION_ENDPOINT_URL
,ASPIRE_EXTENSION_TOKEN
, andASPIRE_EXTENSION_PROMPT_ENABLED
environment variables before running cli commands