vscode-gradle-language icon indicating copy to clipboard operation
vscode-gradle-language copied to clipboard

Add document formatter for build.gradle

Open somejeff opened this issue 6 years ago • 4 comments

It would be great if we could auto-format the build.gradle file.

When executing formatDocument on the build.gradle file, an alert pops up indicating: There is no document formatter for 'gradle'-files installed.

Keyboard mapping:

{
  "key": "shift+alt+f",
  "command": "editor.action.formatDocument",
  "when": "editorTextFocus && !editorReadonly"
}

somejeff avatar Nov 12 '18 15:11 somejeff

This issue is even worse because when we click on Install formatter..., it searches for category:formatters gradle, and naco-siren.gradle-language is the only result.

Don't categorize your extension as a formatter if it's not a formatter!

NatoBoram avatar Jul 12 '19 00:07 NatoBoram

You can have a look at Vs Code Groovy Lint , it also formats .gradle files :)

nvuillam avatar May 27 '20 23:05 nvuillam

You can have a look at Vs Code Groovy Lint , it also formats .gradle files :)

groovy lint can format build.gradle,but you have to change the language mode to groovy.

cdslily avatar Jan 11 '22 09:01 cdslily

You can have a look at Vs Code Groovy Lint , it also formats .gradle files :)

groovy lint can format build.gradle,but you have to change the language mode to groovy.

Maybe i can find a way to auto-detect it as gradle file ^^

Gradle extension could also implement it by calling npm-groovy-lint under the hood (there is a --format option, and it can be used as a module)

nvuillam avatar Jan 11 '22 17:01 nvuillam