Skip to content

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

Merged

Conversation

adamint
Copy link
Member

@adamint adamint commented Jun 4, 2025

13 of the files are just updated nls files.

  • Removes the old aspire run and aspire add command logic
  • Shows an error when commands are run outside of a workspace
  • Runs commands in terminal with the switch --language (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)
  • Sets ASPIRE_EXTENSION_ENDPOINT_URL, ASPIRE_EXTENSION_TOKEN, and ASPIRE_EXTENSION_PROMPT_ENABLED environment variables before running cli commands

@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jun 4, 2025
@adamint adamint changed the title Launch cli with proper params, remove unused strings Launch cli with proper params, remove unused strings and old command logic Jun 4, 2025
@adamint adamint requested a review from danmoseley June 4, 2025 16:15
terminal.sendText(`aspire run --project "${selectedProject}"`);
terminal.show();
}
terminal.sendText(`aspire run --language ${vscode.env.language}`);
Copy link
Member

Choose a reason for hiding this comment

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

What's --language?

Copy link
Member Author

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

Copy link
Member

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?

Copy link
Member Author

@adamint adamint Jun 4, 2025

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

Copy link
Member Author

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

Copy link
Member

@davidfowl davidfowl Jun 4, 2025

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]

Copy link
Member Author

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

Copy link
Member

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.

Copy link
Member Author

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

Copy link
Contributor

@Copilot Copilot AI left a 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.

@adamint adamint added area-extension and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Jun 4, 2025
terminal.sendText(`aspire run --project "${selectedProject}"`);
terminal.show();
}
terminal.sendText(`aspire --language ${vscode.env.language} run`);
Copy link
Member

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.

Copy link
Member

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

const addressInfo = rpcServer?.address();
if (typeof addressInfo === 'object' && addressInfo?.port) {
outputChannelWriter.appendLine(rpcServerListening(addressInfo.port));
const fullAddress = `http://localhost:${addressInfo.port}`;
Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

@mitchdenny mitchdenny left a 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).

@adamint adamint enabled auto-merge (squash) June 6, 2025 18:18
@adamint adamint merged commit f0edddc into dotnet:main Jun 6, 2025
496 of 498 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants