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

Feature request: Improve output console color scheme #1127

Open
cslobodan opened this issue Dec 8, 2022 · 10 comments
Open

Feature request: Improve output console color scheme #1127

cslobodan opened this issue Dec 8, 2022 · 10 comments

Comments

@cslobodan
Copy link

For Spring Boot projects, the debug output console should have a nice coloring theme by default, which is not the case currently.
With default settings, all text is a single color which is not very readable.
There is a related StackOverflow question regarding this: https://stackoverflow.com/questions/62280290/provide-color-theme-to-the-java-process-console-in-the-terminal-of-vscode-whil

Currently, there are two (easy, but not scalable) ways how to achieve the desired coloring:

  1. Add spring.output.ansi.enabled=ALWAYS to application.properties file -> The issue with this approach is that it has to be set up for each project and it just adds unnecessary complexity to application.properties.
  2. Add "args": "--spring.output.ansi.enabled=ALWAYS" in launch.json -> This issue with this approach is that it also needs to be set up per-project basis and it is not so easy to share configuration as .vscode directory is not within version control scope.

Proposed Solution
I suggest a solution that VS Code pass "args": "--spring.output.ansi.enabled=ALWAYS" by default for Spring Boot projects. There should be an option to control it (on/off) maybe within settings.json

Before
before
After
after

@nickzhums Please review.

@cslobodan cslobodan changed the title Feature request Feature request: Improve output console color scheme Dec 8, 2022
@nickzhums
Copy link
Member

This user is a long-time Spring developer on VS Code and I have interviewed him previously. He has provided valuable information back then.

@Eskibear do you know this is something we can achieve, and is this something more like for the central VS Code team to do than us?

@testforstephen
Copy link
Contributor

I think SpringBoot Dashboard can automatically append "--spring.output.ansi.enabled=ALWAYS" to the launch args when launching spring app from spring dashboard view.

@Eskibear
Copy link
Member

Eskibear commented Dec 9, 2022

I suggest a solution that VS Code pass "args": "--spring.output.ansi.enabled=ALWAYS" by default for Spring Boot projects.

I think SpringBoot Dashboard can automatically append "--spring.output.ansi.enabled=ALWAYS" to the launch args when launching spring app from spring dashboard view.

Technically it's feasible, but it looks a bit strange to me, as I want the extension to be as transparent as possible. What if I have non-Spring projects and I want to add args for multiple projects in batch? Can it be a setting of Java debugger extension, something like "java.debug.extra.args.to.append", and users can set explicitly by their own.

@testforstephen
Copy link
Contributor

Java debugger is more generic, not for spring only. That's why I suggest doing it in SpringBoot Dashboard extension because it's dedicated for spring app. And SpringBoot Dashboard is using programmatic way to launch app, it's doable to auto append some extra args.

@nickzhums
Copy link
Member

nickzhums commented Dec 9, 2022

One possible way is to have a global setting for this in Spring Boot dashboard and make it disabled by default. People who need it can turn it on and make it enabled.

@Eskibear
Copy link
Member

Eskibear commented Dec 9, 2022

Java debugger is more generic, not for spring only.

What if I have non-Spring projects and I want to add args for multiple projects in batch?

That's why I'm thinking about the possibility doing it in debugger, if there's such use case.

One possible way is to have a global setting for this in Spring Boot dashboard and make it disabled by default.

Yes, technically no problem, as I mentioned above. What I'm concerning about is, this is too specific. Now we add a setting to always append "--spring.output.ansi.enabled=ALWAYS" for all projects, what if someone else coming to request adding another arg, e.g. "--whatever.other.property=value"? Do we add one more setting just dedicating for that? I doubt it.

something like "java.debug.extra.args.to.append", and users can set explicitly by their own.

What I prefer is this, in this case you can set it to "--spring.output.ansi.enabled=ALWAYS", and it also has good extensibility, that you can set whatever args as you wish. The setting can be implemented in Spring extensions of course, but what if non-spring developers also need this feature (aka. adding args for all projects instead of set up for each)? That's why I'm thinking whether Java debugger is the final proper place to go.

@testforstephen
Copy link
Contributor

The setting can be implemented in Spring extensions of course, but what if non-spring developers also need this feature (aka. adding args for all projects instead of set up for each)? That's why I'm thinking whether Java debugger is the final proper place to go.

I understand your point. The debugger currently supports customizing args in launch.json per project. And I never heard someone is requesting a global program arguments for all projects before. I'm cautious to add such a global setting. The program args will be parsed to a String array args[] and could break a program if it doesn't support the unexpected args. In contrast, we currently support global vmArgs since vmArgs are parsed to a Map in JVM, that won't break the program even if it doesn't support the vmArgs.

For me, it's safe to do this in Spring tools since "--spring.output.ansi.enabled=ALWAYS" is a common argument for all spring projects.

@testforstephen
Copy link
Contributor

Had a quick search, STS provides such an option ANSI console output for spring boot project.

image

@testforstephen
Copy link
Contributor

@slobodanc93 Another workaround is to add spring.output.ansi.enabled=ALWAYS to your machine's Environment Variables, which VS Code will read and then automatically enable ANSI console output for all your spring projects. This way, there is no need of code change in VS Code Java extensions.

@cslobodan
Copy link
Author

Thank you all for your suggestions.
Is it possible that the Spring Boot dashboard has "Settings" that can be used to change the behavior of the run button? Another way would be to add "Run with arguments..." which is common in other IDEs. Both options would support the ability to add some more options in the future, as IntelliJ has (e.g. option to hide a banner). They are actually passing a lot of options by default, e.g. -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants