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

Create Visual Studio Code extension #142

Closed
wants to merge 3 commits into from
Closed

Create Visual Studio Code extension #142

wants to merge 3 commits into from

Conversation

leftstick
Copy link
Contributor

@leftstick leftstick commented Sep 16, 2019

implement vscode extension, see below:

partial

@snicoll snicoll mentioned this pull request Feb 6, 2020
@cirelli94
Copy link

Sadly it doesn't compile to me using ./mvnw clean package on the root of the repository:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:testCompile (default-testCompile) on project spring-javaformat-checkstyle: Compilation failure: Compilation failure: 
[ERROR] /home/cirelli/Projects/open-mind/spring-javaformat/spring-javaformat/spring-javaformat-checkstyle/src/test/java/io/spring/javaformat/checkstyle/AssertionsAuditListener.java:[78,25] reference to assertThat is ambiguous
[ERROR]   both method <T>assertThat(T) in org.assertj.core.api.Assertions and method assertThat(java.lang.CharSequence) in org.assertj.core.api.Assertions match
[ERROR] /home/cirelli/Projects/open-mind/spring-javaformat/spring-javaformat/spring-javaformat-checkstyle/src/test/java/io/spring/javaformat/checkstyle/AssertionsAuditListener.java:[78,65] cannot find symbol
[ERROR]   symbol:   method contains(java.lang.String)
[ERROR]   location: class org.assertj.core.api.AbstractComparableAssert<capture#1 of ?,java.lang.StringBuilder>
[ERROR] /home/cirelli/Projects/open-mind/spring-javaformat/spring-javaformat/spring-javaformat-checkstyle/src/test/java/io/spring/javaformat/checkstyle/AssertionsAuditListener.java:[81,25] reference to assertThat is ambiguous
[ERROR]   both method <T>assertThat(T) in org.assertj.core.api.Assertions and method assertThat(java.lang.CharSequence) in org.assertj.core.api.Assertions match
[ERROR] /home/cirelli/Projects/open-mind/spring-javaformat/spring-javaformat/spring-javaformat-checkstyle/src/test/java/io/spring/javaformat/checkstyle/AssertionsAuditListener.java:[81,65] cannot find symbol
[ERROR]   symbol:   method doesNotContain(java.lang.String)
[ERROR]   location: class org.assertj.core.api.AbstractComparableAssert<capture#2 of ?,java.lang.StringBuilder>

@cirelli94
Copy link

Hi @snicoll, is there any plan to merge this?

@snicoll
Copy link
Contributor

snicoll commented Feb 7, 2020

@cirelli94 I don't know. We're lacking time to review this one and make up our mind about it, sorry.

@philwebb philwebb closed this Apr 23, 2021
@philwebb philwebb deleted the branch spring-io:main April 23, 2021 00:06
@philwebb philwebb reopened this Apr 23, 2021
@lfvjimisola
Copy link

Any updates on this?

Can't seem to find a decentformatter/validator that integrates nicely with VS Code and Maven. Google Style Guide, Spring Java Format and others do not handle lambdas good enough. Palantir is an alternative but spotless VS Code extension is based on gradle (we use maven).

@wilkinsona
Copy link
Contributor

I'm afraid not. We do not use vscode so it's difficult to find the time to review the proposal.

Spring Java Format and others do not handle lambdas good enough

This confuses me a little. If you don't like how Spring Java Format handles lambdas why are you interested in its integration with vscode?

@lfvjimisola
Copy link

Regarding the review, ok I understand.

Not trying to confuse you on purpose but I can see that :) We have to decide on something and VS Code integration is a deciding factor. It could also be that we could use Spring Java Format as a baseline for an lambda adaption.

@lfvjimisola
Copy link

@wilkinsona With the updates on #124 spring-javaformat would fit our needs. Our team uses VS Code. Is there anything I/we can do to assist with this PR, e.g. test?

@lfvjimisola
Copy link

lfvjimisola commented Feb 10, 2023

@leftstick Would it be possible for you to update this PR to match the latest on main? I would gladly test it afterwards if needed.

UPDATE: I tried building this PR but it failed due to an issue with an Eclipse repo. I therefore merged the latest origin/main into this PR. There where two minor conflicts (.gitignore and a README) that were easily resolved. Trying to build it now again. Having issues with connections. Suspecting our company proxy. Will try from private computer later.

@philwebb
Copy link
Contributor

I've rebased the PR onto the latest main and I'm reviewing it again to see if we can consider merging it. It's going to take me a few days.

@lfvjimisola
Copy link

lfvjimisola commented Feb 13, 2023

@philwebb Thank you! Please let me know if I can assist in any way.

@philwebb philwebb mentioned this pull request Feb 15, 2023
@philwebb philwebb changed the title Create vscode extension for spring-javaformat Create Visual Studio Code extension Feb 15, 2023
@philwebb philwebb added this to the 0.0.36 milestone Feb 15, 2023
philwebb pushed a commit that referenced this pull request Feb 15, 2023
Add Visual Studio Code extension to apply spring-javaformat
conventions.

See gh-142
philwebb added a commit that referenced this pull request Feb 15, 2023
Refine extension to use stdin/stdout to communicate with the Java
code rather than using an HTTP endpoint.

This commit also restructures the way that the extension is built
and reduces the number of Maven projects. It also drops Markdown
formatting support.

See gh-142
@philwebb philwebb closed this in 6cbfe7c Feb 15, 2023
philwebb added a commit that referenced this pull request Feb 15, 2023
@philwebb
Copy link
Contributor

Thanks very much for the PR @leftstick. I've merged this into main with some modifications. The main change I've made is to switch from an HTTP application to one that uses stdin/stdout to format the code. I realize that this might end up being slower, but I think it's a simpler approach that we'll have an easier time maintaining.

We don't have a lot of vscode expertise in the team, so we're going to need to rely on the community quite a bit for this extension. If anyone watching the issue wants to kick the tires the SNAPSHOT release is available at https://repo.spring.io/ui/native/snapshot/io/spring/javaformat/spring-javaformat-vscode-extension/0.0.36-SNAPSHOT/

@lfvjimisola
Copy link

@leftstick @philwebb Thank you very much. I just installed the extension and so far, so good.
The rest of our team will install it during this week.

@leftstick How much work would it be to upload it to the VS Code Extension Market place (here)? And is that something that the Spring team would approve? It would make it a lot easier to adopt and also the risk of having a mismatch between versions (Maven and VS Code) is reduced greatly.

I spotted a small error with a link here, see DocumentFormattingEditProvider.

@leftstick
Copy link
Contributor Author

@lfvjimisola it is quick simple to publish the extension to vscode market place, you will refer to the guide publish-extension.

@philwebb
Copy link
Contributor

I spotted a small error with a link

Thanks! Fixed that one now.

@philwebb
Copy link
Contributor

If we want to publish the extension I think we should do it as part of our CI release process. For now, I suggest we try the manual install approach to make sure the extension works as expected.

@philwebb philwebb self-assigned this Feb 17, 2023
@lfvjimisola
Copy link

@philwebb Yes, I agree. My thought was not to set it up now but rather curious on how much work it would be. We'll make sure to try it properly manually before adding it to CI release process.

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.

None yet

6 participants