google-java-format
Reformats Java source code to comply with Google Java Style. (by google)
vscode-java
Java Language Support for Visual Studio Code (by redhat-developer)
google-java-format | vscode-java | |
---|---|---|
21 | 35 | |
5,416 | 2,038 | |
0.5% | 0.3% | |
8.6 | 9.0 | |
3 days ago | 6 days ago | |
Java | TypeScript | |
GNU General Public License v3.0 or later | Eclipse Public License 2.0 |
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
google-java-format
Posts with mentions or reviews of google-java-format.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2023-04-12.
-
How to automatically format Java code similar to Rust (rustfmt)?
The code block you pasted is not at all what the Google Java Format utility would do. Don't use VSCode to handle IntelliJ's job :P
-
After a few attempts I'm officially a programmer :^)
Follow a style guide, doesnโt really matter which you choose, youโll thank me later. This one will work automatically https://github.com/google/google-java-format
-
For Contributors to my OpenSSG
Like Prettier and ESLint in Javascript, I needed to add Java formatting and linting tools. For formatting, I looked at google-java-format, codestyle, and spotless. Since I'm not using Java framework, I can only use plugin to format my code. Although google-java-format does not support configurability, I just chose to follow Google Java format as I believe they have most common language format standard. To use google-java-format in MacOS, go to IntelliJ IDEA -> Preference (Windows: File -> Setting) and search "plugin" menu. Then, find google-java-format using search bar. Now all you need to do is to install the plugin. I didn't have to enable it, I think it needs to be enabled in some cases. You can refer to the documentation. To format your code, go to Code menu and select Reformat code or Reformat file. It will format your code.
-
Coding standards
I cloned a Maven plug-in that enforces Google code style guidelines (modifying a few things, like nesting depth): https://github.com/google/google-java-format
-
I declare as "final" every single variable whose value doesn't change. I also use "this" every time that I'm referring to an attribute, even when there's no ambiguity in not using it
They follow a rectangle rule, which is easy to follow, but can lead to ugly formatting due to excessive indentation in nested statements (which are common using protobuffers). The dart formatter was a lot nicer, and considered human friendly style instead of blindly following the rectangle rule.
-
Creating custom formatter for Java
I spent most of my development career writing simple CRUD applications, recently I read a fascinating article: http://journal.stuffwithstuff.com/2015/09/08/the-hardest-program-ive-ever-written/. It looks like a nice challenge to try creating such a tool. For sure I need first to understand how to build AST etc. I could reuse existing solutions like https://github.com/google/google-java-format, or eclipse fmt, but I would like to understand the whole process, to be able to debug all cases.
- I am about to start a war
-
Zero Config Code Formatter?
Eventually it was clear that google-java-format was pulling ahead, and it was clear that the primary reason for that was The Rectangle Rule -- a principle I'd vomited forth one day that somehow had gone the distance. Structure-revealing code turns out to be readable code, and our users kept preferring it.
- Black, the Uncompromising (Python) Code Formatter Is Stable
-
google-java-format -> Diferences, how to sync with eclipse / stream format
Looks like this was changed in version 1.7.
vscode-java
Posts with mentions or reviews of vscode-java.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2023-04-12.
-
language support for java client couldn't create connection to server
Can this issue on github help?
-
Java compiler problem with enums using windows1252 encoding
More details about the problem over this issue on github: https://github.com/redhat-developer/vscode-java/issues/3060
-
How to automatically format Java code similar to Rust (rustfmt)?
I've tried Google Java Format, following the settings here,
-
Problem with genSources
It seems I actually got it to work in vscode. I found this thread, in which one person told to add: "java.eclipse.downloadSources": true, "java.maven.downloadSources": true, to the settings.json and it seems to work just fine now. Still thanks for your responses :)
-
Java Intellisense keeps breaking, every few minutes. Need to Clean Java Language Server Workspace to restore. MacOS, 1.75.0
Can the retirement version solve the problem? If you are convinced that it is a version of BUG, you can submit a report on GitHub to get official personnel responses.
-
Plz Microsoft could you finally give YOUR OWN PLATFORM the care it deserves?
Good news :) https://github.com/redhat-developer/vscode-java/wiki/Formatter-settings
-
Child Folders that contains a java file in them is requiring a package statement how do I disable that feature
There is currently no configuration to turn off. If you really need it, you can submit a feature request on GitHub.
-
Help setting up jdtls for java
-- ๐ "/usr/lib/jvm/java-11-openjdk/", -- or '/path/to/java11_or_newer/bin/java' -- depends on if `java` is in your $PATH env variable and if it points to the right version. "-Declipse.application=org.eclipse.jdt.ls.core.id1", "-Dosgi.bundles.defaultStartLevel=4", "-Declipse.product=org.eclipse.jdt.ls.core.product", "-Dlog.protocol=true", "-Dlog.level=ALL", "-javaagent:" .. home .. "/.local/share/nvim/mason/packages/jdtls/lombok.jar", "-Xms1g", "--add-modules=ALL-SYSTEM", "--add-opens", "java.base/java.util=ALL-UNNAMED", "--add-opens", "java.base/java.lang=ALL-UNNAMED", -- ๐ "-jar", vim.fn.glob( home .. "/.local/share/nvim/mason/packages/jdtls/plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar" ), -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ -- Must point to the Change this to -- eclipse.jdt.ls installation the actual version -- ๐ "-configuration", home .. "/.local/share/nvim/mason/packages/jdtls/config_" .. CONFIG, -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^ -- Must point to the Change to one of `linux`, `win` or `mac` -- eclipse.jdt.ls installation Depending on your system. -- ๐ -- See `data directory configuration` section in the README "-data", workspace_dir, }, on_attach = { require("jdtls").setup_dap({ hotcodereplace = "auto" }), require("jdtls.dap").setup_dap_main_class_configs(), }, capabilities = capabilities, -- ๐ -- This is the default if not provided, you can remove it. Or adjust as needed. -- One dedicated LSP server & client will be started per unique root_dir root_dir = root_dir, -- Here you can configure eclipse.jdt.ls specific settings -- See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request -- or https://github.com/redhat-developer/vscode-java#supported-vs-code-settings -- for a list of options settings = { java = { eclipse = { downloadSources = true, }, configuration = { updateBuildConfiguration = "interactive", }, maven = { downloadSources = true, }, implementationsCodeLens = { enabled = true, }, referencesCodeLens = { enabled = true, }, references = { includeDecompiledSources = true, }, inlayHints = { parameterNames = { enabled = "all", -- literals, all, none }, }, format = { enabled = false, }, }, signatureHelp = { enabled = true }, completion = { favoriteStaticMembers = { "org.hamcrest.MatcherAssert.assertThat", "org.hamcrest.Matchers.*", "org.hamcrest.CoreMatchers.*", "org.junit.jupiter.api.Assertions.*", "java.util.Objects.requireNonNull", "java.util.Objects.requireNonNullElse", "org.mockito.Mockito.*", }, }, contentProvider = { preferred = "fernflower" }, extendedClientCapabilities = extendedClientCapabilities, sources = { organizeImports = { starThreshold = 9999, staticStarThreshold = 9999, }, }, codeGeneration = { toString = { template = "${object.className}{${member.name()}=${member.value}, ${otherMembers}}", }, useBlocks = true, }, }, flags = { allow_incremental_sync = true, }, -- Language server `initializationOptions` -- You need to extend the `bundles` with paths to jar files -- if you want to use additional eclipse.jdt.ls plugins. -- -- See https://github.com/mfussenegger/nvim-jdtls#java-debug-installation -- -- If you don't plan on using the debugger or other eclipse.jdt.ls plugins you can remove this
-
No Syntax Highlighting for Java
This is the officially provided extension. if you follow this documentation, still no syntax highlighting, may really be a bug, suggest you file an issue on GitHub.
-
Java on Visual Studio Code Update โ June 2022
Try this fix but don't forget VS Code Lombok extension project has not been maintained for long timeใ
What are some alternatives?
When comparing google-java-format and vscode-java you can also consider the following projects:
spotless - Keep your code spotless
lsp-java - lsp-mode :heart: java
palantir-java-format - A modern, lambda-friendly, 120 character Java formatter.
eclipse.jdt.ls - Java language server
spring-javaformat
bash-language-server - A language server for Bash
formatter-maven-plugin - Formatter Maven Plugin
vscode-haskell - VS Code extension for Haskell, powered by haskell-language-server
black - The uncompromising Python code formatter
vscode-yaml - YAML support for VS Code with built-in kubernetes syntax support
fmt-maven-plugin - Opinionated Maven Plugin that formats your Java code.
styleguide - Style guides for Google-originated open-source projects
google-java-format vs spotless
vscode-java vs lsp-java
google-java-format vs palantir-java-format
vscode-java vs eclipse.jdt.ls
google-java-format vs spring-javaformat
vscode-java vs bash-language-server
google-java-format vs formatter-maven-plugin
vscode-java vs vscode-haskell
google-java-format vs black
vscode-java vs vscode-yaml
google-java-format vs fmt-maven-plugin
vscode-java vs styleguide