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

Improve the behavior of run and debug code lens #9

Open
faceair opened this issue Apr 12, 2023 · 5 comments
Open

Improve the behavior of run and debug code lens #9

faceair opened this issue Apr 12, 2023 · 5 comments

Comments

@faceair
Copy link

faceair commented Apr 12, 2023

Feature request:

The current behavior of the run and debug code lens is to run directly. However, in my project, it is generally necessary to add additional command-line parameters when running, and running directly will result in an error.

This feature is implemented in Goland as follows:

  1. Click run or debug.
  2. Add a launch config with a default name.
  3. Run this launch config. If this launch config is renamed later, clicking run again will add a launch config with a default name and run it.

Therefore, I think Tooltitude can implement this feature with a similar approach. Automatically adding a launch config can help me save some trouble, and I can add command-line parameters myself.

@tooltitude-support
Copy link
Member

Go plugin for vscode has run configuration functionality. Do you use it? We could try to find relevant run configuration for the file, and run it instead of running in the plain way. What do you think?

@faceair
Copy link
Author

faceair commented Apr 12, 2023

Yes, I am currently using the launch config (launch.json) for vscode.

Now I need to manually add the path of the main package, which is a bit inconvenient. It would be great if a new configuration item could be automatically added for me when I click "run" code len.

@tooltitude-support
Copy link
Member

@faceair Ok. We will think how it could be done without making the feature harder to use. Thanks again for the feedback!

@tooltitude-support
Copy link
Member

@faceair I have an idea. What if you provide a comment before the main method like:
// tt:run-with: [arg1, arg2, arg3]. Will it work for you? Do you need some local path there?

@faceair
Copy link
Author

faceair commented Apr 14, 2023

Hi, according to my previous description, there is no need to add specific command-line parameters in tooltitude.

Here's an example:

  1. Click on the "run code len" file in cmd/cli/main.go.
  2. Tooltitude looks for a configuration with the name "launch cmd/cli/main.go" in .vscode/launch.json. If found, it launches it directly.
  3. If not found, Tooltitude adds the configuration with the above name, helps me fill in the full address of the program, and launches it.

In most cases where command line arguments are not required, the program can be launched directly.

If my CLI program cannot be launched, I would modify the "args" parameter in launch.json manually, but usually, there's no need to modify the configuration name. When I manually add the "args" parameter and click "run code len" again, Tooltitude will find the "launch cmd/cli/main.go" configuration and launch it correctly.

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

No branches or pull requests

2 participants