naco-siren / vscode-gradle-language

A VSCode extension to provide Gradle language support
MIT License
16 stars 5 forks source link

Add document formatter for build.gradle #6

Open somejeff opened 5 years ago

somejeff commented 5 years ago

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"
}
NatoBoram commented 5 years ago

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!

nvuillam commented 4 years ago

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

cdslily commented 2 years ago

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.

nvuillam commented 2 years ago

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)