Added support for more file types for clang-format. (#4367)

This commit is contained in:
Matheus
2022-11-25 14:16:16 +01:00
committed by GitHub
parent b8de4ac96d
commit 5ce2bf84ca
11 changed files with 138 additions and 65 deletions

View File

@@ -263,8 +263,8 @@ let s:default_registry = {
\ }, \ },
\ 'clang-format': { \ 'clang-format': {
\ 'function': 'ale#fixers#clangformat#Fix', \ 'function': 'ale#fixers#clangformat#Fix',
\ 'suggested_filetypes': ['c', 'cpp', 'cuda'], \ 'suggested_filetypes': ['c', 'cpp', 'cs', 'cuda', 'java', 'javascript', 'json', 'objc', 'proto'],
\ 'description': 'Fix C/C++ and cuda files with clang-format.', \ 'description': 'Fix C, C++, C#, CUDA, Java, JavaScript, JSON, ObjectiveC and Protobuf files with clang-format.',
\ }, \ },
\ 'cmakeformat': { \ 'cmakeformat': {
\ 'function': 'ale#fixers#cmakeformat#Fix', \ 'function': 'ale#fixers#cmakeformat#Fix',

View File

@@ -6,6 +6,13 @@ In addition to the linters that are provided with ALE, C# code can be checked
with the OmniSharp plugin. See here: https://github.com/OmniSharp/omnisharp-vim with the OmniSharp plugin. See here: https://github.com/OmniSharp/omnisharp-vim
===============================================================================
clang-format *ale-cs-clangformat*
See |ale-c-clangformat| for information about the available options.
Note that the C options are also used for C#.
=============================================================================== ===============================================================================
csc *ale-cs-csc* csc *ale-cs-csc*

View File

@@ -2,6 +2,32 @@
ALE CUDA Integration *ale-cuda-options* ALE CUDA Integration *ale-cuda-options*
===============================================================================
clang-format *ale-cuda-clangformat*
See |ale-c-clangformat| for information about the available options.
Note that the C options are also used for CUDA.
===============================================================================
clangd *ale-cuda-clangd*
g:ale_cuda_clangd_executable *g:ale_cuda_clangd_executable*
*b:ale_cuda_clangd_executable*
Type: |String|
Default: `'clangd'`
This variable can be changed to use a different executable for clangd.
g:ale_cuda_clangd_options *g:ale_cuda_clangd_options*
*b:ale_cuda_clangd_options*
Type: |String|
Default: `''`
This variable can be changed to modify flags given to clangd.
=============================================================================== ===============================================================================
nvcc *ale-cuda-nvcc* nvcc *ale-cuda-nvcc*
@@ -21,30 +47,6 @@ g:ale_cuda_nvcc_options *g:ale_cuda_nvcc_options*
This variable can be changed to modify flags given to nvcc. This variable can be changed to modify flags given to nvcc.
===============================================================================
clangd *ale-cuda-clangd*
g:ale_cuda_clangd_executable *g:ale_cuda_clangd_executable*
*b:ale_cuda_clangd_executable*
Type: |String|
Default: `'clangd'`
This variable can be changed to use a different executable for clangd.
g:ale_cuda_clangd_options *g:ale_cuda_clangd_options*
*b:ale_cuda_clangd_options*
Type: |String|
Default: `''`
This variable can be changed to modify flags given to clangd.
===============================================================================
clang-format *ale-cuda-clangformat*
See |ale-c-clangformat| for information about the available options.
Note that the C options are also used for cuda.
=============================================================================== ===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@@ -41,6 +41,13 @@ g:ale_java_checkstyle_options *g:ale_java_checkstyle_options*
configuration files set with |g:ale_java_checkstyle_config|. configuration files set with |g:ale_java_checkstyle_config|.
===============================================================================
clang-format *ale-java-clangformat*
See |ale-c-clangformat| for information about the available options.
Note that the C options are also used for Java.
=============================================================================== ===============================================================================
cspell *ale-java-cspell* cspell *ale-java-cspell*

View File

@@ -17,12 +17,21 @@ You should change the structure of your project from this: >
/path/foo/.eslintrc.js # root: true /path/foo/.eslintrc.js # root: true
/path/foo/bar/.eslintrc.js # root: false /path/foo/bar/.eslintrc.js # root: false
< <
To this: > To this: >
/path/foo/.base-eslintrc.js # Base configuration here /path/foo/.base-eslintrc.js # Base configuration here
/path/foo/.eslintrc.js # extends: ["/path/foo/.base-eslintrc.js"] /path/foo/.eslintrc.js # extends: ["/path/foo/.base-eslintrc.js"]
/path/foo/bar/.eslintrc.js # extends: ["/path/foo/.base-eslintrc.js"] /path/foo/bar/.eslintrc.js # extends: ["/path/foo/.base-eslintrc.js"]
< <
===============================================================================
clang-format *ale-javascript-clangformat*
See |ale-c-clangformat| for information about the available options.
Note that the C options are also used for JavaScript.
=============================================================================== ===============================================================================
cspell *ale-javascript-cspell* cspell *ale-javascript-cspell*

View File

@@ -2,6 +2,13 @@
ALE JSON Integration *ale-json-options* ALE JSON Integration *ale-json-options*
===============================================================================
clang-format *ale-json-clangformat*
See |ale-c-clangformat| for information about the available options.
Note that the C options are also used for JSON.
=============================================================================== ===============================================================================
cspell *ale-json-cspell* cspell *ale-json-cspell*

View File

@@ -2,42 +2,6 @@
ALE Objective-C Integration *ale-objc-options* ALE Objective-C Integration *ale-objc-options*
===============================================================================
clang *ale-objc-clang*
g:ale_objc_clang_options *g:ale_objc_clang_options*
*b:ale_objc_clang_options*
Type: |String|
Default: `'-std=c11 -Wall'`
This variable can be changed to modify flags given to clang.
===============================================================================
clangd *ale-objc-clangd*
g:ale_objc_clangd_executable *g:ale_objc_clangd_executable*
*b:ale_objc_clangd_executable*
Type: |String|
Default: `'clangd'`
This variable can be changed to use a different executable for clangd.
g:ale_objc_clangd_options *g:ale_objc_clangd_options*
*b:ale_objc_clangd_options*
Type: |String|
Default: `''`
This variable can be changed to modify flags given to clangd.
===============================================================================
uncrustify *ale-objc-uncrustify*
See |ale-c-uncrustify| for information about the available options.
=============================================================================== ===============================================================================
ccls *ale-objc-ccls* ccls *ale-objc-ccls*
@@ -69,5 +33,48 @@ g:ale_objc_ccls_init_options *g:ale_objc_ccls_init_options*
available options and explanations. available options and explanations.
===============================================================================
clang *ale-objc-clang*
g:ale_objc_clang_options *g:ale_objc_clang_options*
*b:ale_objc_clang_options*
Type: |String|
Default: `'-std=c11 -Wall'`
This variable can be changed to modify flags given to clang.
===============================================================================
clang-format *ale-objc-clangformat*
See |ale-c-clangformat| for information about the available options.
Note that the C options are also used for Objective-C.
===============================================================================
clangd *ale-objc-clangd*
g:ale_objc_clangd_executable *g:ale_objc_clangd_executable*
*b:ale_objc_clangd_executable*
Type: |String|
Default: `'clangd'`
This variable can be changed to use a different executable for clangd.
g:ale_objc_clangd_options *g:ale_objc_clangd_options*
*b:ale_objc_clangd_options*
Type: |String|
Default: `''`
This variable can be changed to modify flags given to clangd.
===============================================================================
uncrustify *ale-objc-uncrustify*
See |ale-c-uncrustify| for information about the available options.
=============================================================================== ===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@@ -9,12 +9,15 @@ To enable `.proto` file linting, update |g:ale_linters| as appropriate:
> >
" Enable linter for .proto files " Enable linter for .proto files
let g:ale_linters = {'proto': ['buf-lint', 'protoc-gen-lint', 'protolint']} let g:ale_linters = {'proto': ['buf-lint', 'protoc-gen-lint', 'protolint']}
<
To enable `.proto` file fixing, update |g:ale_fixers| as appropriate: To enable `.proto` file fixing, update |g:ale_fixers| as appropriate:
> >
" Enable linter for .proto files " Enable linter for .proto files
let b:ale_fixers = {'proto': ['buf-format', 'protolint']} let b:ale_fixers = {'proto': ['buf-format', 'protolint']}
< <
=============================================================================== ===============================================================================
buf-format *ale-proto-buf-format* buf-format *ale-proto-buf-format*
@@ -29,6 +32,7 @@ g:ale_proto_buf_format_executable *g:ale_proto_buf_format_executable*
This variable can be changed to modify the executable used for buf. This variable can be changed to modify the executable used for buf.
=============================================================================== ===============================================================================
buf-lint *ale-proto-buf-lint* buf-lint *ale-proto-buf-lint*
@@ -53,6 +57,14 @@ g:ale_proto_buf_lint_config *g:ale_proto_buf_lint_config*
The path to the configuration file can be an absolute path or a relative The path to the configuration file can be an absolute path or a relative
path. ALE will search for the relative path in parent directories. path. ALE will search for the relative path in parent directories.
===============================================================================
clang-format *ale-proto-clangformat*
See |ale-c-clangformat| for information about the available options.
Note that the C options are also used for Proto.
=============================================================================== ===============================================================================
protoc-gen-lint *ale-proto-protoc-gen-lint* protoc-gen-lint *ale-proto-protoc-gen-lint*
@@ -68,6 +80,7 @@ g:ale_proto_protoc_gen_lint_options *g:ale_proto_protoc_gen_lint_options*
directory of the linted file is always passed as an include path with '-I' directory of the linted file is always passed as an include path with '-I'
before any user-supplied options. before any user-supplied options.
=============================================================================== ===============================================================================
protolint *ale-proto-protolint* protolint *ale-proto-protolint*
@@ -94,5 +107,6 @@ g:ale_proto_protolint_config *g:ale_proto_protolint_config*
The path to the configuration file can be an absolute path or a relative The path to the configuration file can be an absolute path or a relative
path. ALE will search for the relative path in parent directories. path. ALE will search for the relative path in parent directories.
=============================================================================== ===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl: vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@@ -76,6 +76,7 @@ Notes:
* `gcc` (`cc`) * `gcc` (`cc`)
* `uncrustify` * `uncrustify`
* C# * C#
* `clang-format`
* `csc`!! * `csc`!!
* `cspell` * `cspell`
* `dotnet-format` * `dotnet-format`
@@ -129,6 +130,7 @@ Notes:
* Cucumber * Cucumber
* `cucumber` * `cucumber`
* CUDA * CUDA
* `clang-format`
* `clangd` * `clangd`
* `nvcc`!! * `nvcc`!!
* Cypher * Cypher
@@ -271,6 +273,7 @@ Notes:
* Java * Java
* `PMD` * `PMD`
* `checkstyle`!! * `checkstyle`!!
* `clang-format`
* `cspell` * `cspell`
* `eclipselsp` * `eclipselsp`
* `google-java-format` * `google-java-format`
@@ -278,6 +281,7 @@ Notes:
* `javalsp` * `javalsp`
* `uncrustify` * `uncrustify`
* JavaScript * JavaScript
* `clang-format`
* `cspell` * `cspell`
* `deno` * `deno`
* `dprint` * `dprint`
@@ -294,6 +298,7 @@ Notes:
* `xo` * `xo`
* JSON * JSON
* `VSCode JSON language server` * `VSCode JSON language server`
* `clang-format`
* `cspell` * `cspell`
* `dprint` * `dprint`
* `eslint` * `eslint`
@@ -384,6 +389,7 @@ Notes:
* Objective-C * Objective-C
* `ccls` * `ccls`
* `clang` * `clang`
* `clang-format`
* `clangd` * `clangd`
* `uncrustify` * `uncrustify`
* Objective-C++ * Objective-C++
@@ -450,6 +456,7 @@ Notes:
* proto * proto
* `buf-format`!! * `buf-format`!!
* `buf-lint`!! * `buf-lint`!!
* `clang-format`
* `protoc-gen-lint`!! * `protoc-gen-lint`!!
* `protolint`!! * `protolint`!!
* Pug * Pug

View File

@@ -2834,6 +2834,7 @@ documented in additional help files.
flawfinder............................|ale-cpp-flawfinder| flawfinder............................|ale-cpp-flawfinder|
uncrustify............................|ale-cpp-uncrustify| uncrustify............................|ale-cpp-uncrustify|
c#......................................|ale-cs-options| c#......................................|ale-cs-options|
clang-format..........................|ale-cs-clangformat|
csc...................................|ale-cs-csc| csc...................................|ale-cs-csc|
cspell................................|ale-cs-cspell| cspell................................|ale-cs-cspell|
dotnet-format.........................|ale-cs-dotnet-format| dotnet-format.........................|ale-cs-dotnet-format|
@@ -2848,9 +2849,9 @@ documented in additional help files.
stylelint.............................|ale-css-stylelint| stylelint.............................|ale-css-stylelint|
vscodecss.............................|ale-css-vscode| vscodecss.............................|ale-css-vscode|
cuda....................................|ale-cuda-options| cuda....................................|ale-cuda-options|
nvcc..................................|ale-cuda-nvcc|
clangd................................|ale-cuda-clangd|
clang-format..........................|ale-cuda-clangformat| clang-format..........................|ale-cuda-clangformat|
clangd................................|ale-cuda-clangd|
nvcc..................................|ale-cuda-nvcc|
d.......................................|ale-d-options| d.......................................|ale-d-options|
dfmt..................................|ale-d-dfmt| dfmt..................................|ale-d-dfmt|
dls...................................|ale-d-dls| dls...................................|ale-d-dls|
@@ -2975,6 +2976,7 @@ documented in additional help files.
ispc..................................|ale-ispc-ispc| ispc..................................|ale-ispc-ispc|
java....................................|ale-java-options| java....................................|ale-java-options|
checkstyle............................|ale-java-checkstyle| checkstyle............................|ale-java-checkstyle|
clang-format..........................|ale-java-clangformat|
cspell................................|ale-java-cspell| cspell................................|ale-java-cspell|
javac.................................|ale-java-javac| javac.................................|ale-java-javac|
google-java-format....................|ale-java-google-java-format| google-java-format....................|ale-java-google-java-format|
@@ -2983,6 +2985,7 @@ documented in additional help files.
eclipselsp............................|ale-java-eclipselsp| eclipselsp............................|ale-java-eclipselsp|
uncrustify............................|ale-java-uncrustify| uncrustify............................|ale-java-uncrustify|
javascript..............................|ale-javascript-options| javascript..............................|ale-javascript-options|
clang-format..........................|ale-javascript-clangformat|
cspell................................|ale-javascript-cspell| cspell................................|ale-javascript-cspell|
deno..................................|ale-javascript-deno| deno..................................|ale-javascript-deno|
dprint................................|ale-javascript-dprint| dprint................................|ale-javascript-dprint|
@@ -2998,6 +3001,7 @@ documented in additional help files.
standard..............................|ale-javascript-standard| standard..............................|ale-javascript-standard|
xo....................................|ale-javascript-xo| xo....................................|ale-javascript-xo|
json....................................|ale-json-options| json....................................|ale-json-options|
clang-format..........................|ale-json-clangformat|
cspell................................|ale-json-cspell| cspell................................|ale-json-cspell|
dprint................................|ale-json-dprint| dprint................................|ale-json-dprint|
eslint................................|ale-json-eslint| eslint................................|ale-json-eslint|
@@ -3065,10 +3069,11 @@ documented in additional help files.
nroff...................................|ale-nroff-options| nroff...................................|ale-nroff-options|
write-good............................|ale-nroff-write-good| write-good............................|ale-nroff-write-good|
objc....................................|ale-objc-options| objc....................................|ale-objc-options|
ccls..................................|ale-objc-ccls|
clang.................................|ale-objc-clang| clang.................................|ale-objc-clang|
clang-format..........................|ale-objc-clangformat|
clangd................................|ale-objc-clangd| clangd................................|ale-objc-clangd|
uncrustify............................|ale-objc-uncrustify| uncrustify............................|ale-objc-uncrustify|
ccls..................................|ale-objc-ccls|
objcpp..................................|ale-objcpp-options| objcpp..................................|ale-objcpp-options|
clang.................................|ale-objcpp-clang| clang.................................|ale-objcpp-clang|
clangd................................|ale-objcpp-clangd| clangd................................|ale-objcpp-clangd|
@@ -3127,6 +3132,7 @@ documented in additional help files.
proto...................................|ale-proto-options| proto...................................|ale-proto-options|
buf-format............................|ale-proto-buf-format| buf-format............................|ale-proto-buf-format|
buf-lint..............................|ale-proto-buf-lint| buf-lint..............................|ale-proto-buf-lint|
clang-format..........................|ale-proto-clangformat|
protoc-gen-lint.......................|ale-proto-protoc-gen-lint| protoc-gen-lint.......................|ale-proto-protoc-gen-lint|
protolint.............................|ale-proto-protolint| protolint.............................|ale-proto-protolint|
pug.....................................|ale-pug-options| pug.....................................|ale-pug-options|

View File

@@ -85,6 +85,7 @@ formatting.
* [gcc](https://gcc.gnu.org/) * [gcc](https://gcc.gnu.org/)
* [uncrustify](https://github.com/uncrustify/uncrustify) * [uncrustify](https://github.com/uncrustify/uncrustify)
* C# * C#
* [clang-format](https://clang.llvm.org/docs/ClangFormat.html)
* [csc](http://www.mono-project.com/docs/about-mono/languages/csharp/) :floppy_disk: see:`help ale-cs-csc` for details and configuration * [csc](http://www.mono-project.com/docs/about-mono/languages/csharp/) :floppy_disk: see:`help ale-cs-csc` for details and configuration
* [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell)
* [dotnet-format](https://github.com/dotnet/format) * [dotnet-format](https://github.com/dotnet/format)
@@ -138,6 +139,7 @@ formatting.
* Cucumber * Cucumber
* [cucumber](https://cucumber.io/) * [cucumber](https://cucumber.io/)
* CUDA * CUDA
* [clang-format](https://clang.llvm.org/docs/ClangFormat.html)
* [clangd](https://clang.llvm.org/extra/clangd.html) * [clangd](https://clang.llvm.org/extra/clangd.html)
* [nvcc](http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html) :floppy_disk: * [nvcc](http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html) :floppy_disk:
* Cypher * Cypher
@@ -280,6 +282,7 @@ formatting.
* Java * Java
* [PMD](https://pmd.github.io/) * [PMD](https://pmd.github.io/)
* [checkstyle](http://checkstyle.sourceforge.net) :floppy_disk: * [checkstyle](http://checkstyle.sourceforge.net) :floppy_disk:
* [clang-format](https://clang.llvm.org/docs/ClangFormat.html)
* [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell)
* [eclipselsp](https://github.com/eclipse/eclipse.jdt.ls) * [eclipselsp](https://github.com/eclipse/eclipse.jdt.ls)
* [google-java-format](https://github.com/google/google-java-format) * [google-java-format](https://github.com/google/google-java-format)
@@ -287,6 +290,7 @@ formatting.
* [javalsp](https://github.com/georgewfraser/vscode-javac) * [javalsp](https://github.com/georgewfraser/vscode-javac)
* [uncrustify](https://github.com/uncrustify/uncrustify) * [uncrustify](https://github.com/uncrustify/uncrustify)
* JavaScript * JavaScript
* [clang-format](https://clang.llvm.org/docs/ClangFormat.html)
* [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell)
* [deno](https://deno.land/) * [deno](https://deno.land/)
* [dprint](https://dprint.dev/) * [dprint](https://dprint.dev/)
@@ -303,6 +307,7 @@ formatting.
* [xo](https://github.com/sindresorhus/xo) * [xo](https://github.com/sindresorhus/xo)
* JSON * JSON
* [VSCode JSON language server](https://github.com/hrsh7th/vscode-langservers-extracted) * [VSCode JSON language server](https://github.com/hrsh7th/vscode-langservers-extracted)
* [clang-format](https://clang.llvm.org/docs/ClangFormat.html)
* [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) :warning: * [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell) :warning:
* [dprint](https://dprint.dev) * [dprint](https://dprint.dev)
* [eslint](http://eslint.org/) :warning: * [eslint](http://eslint.org/) :warning:
@@ -393,6 +398,7 @@ formatting.
* Objective-C * Objective-C
* [ccls](https://github.com/MaskRay/ccls) * [ccls](https://github.com/MaskRay/ccls)
* [clang](http://clang.llvm.org/) * [clang](http://clang.llvm.org/)
* [clang-format](https://clang.llvm.org/docs/ClangFormat.html)
* [clangd](https://clang.llvm.org/extra/clangd.html) * [clangd](https://clang.llvm.org/extra/clangd.html)
* [uncrustify](https://github.com/uncrustify/uncrustify) * [uncrustify](https://github.com/uncrustify/uncrustify)
* Objective-C++ * Objective-C++
@@ -459,6 +465,7 @@ formatting.
* proto * proto
* [buf-format](https://github.com/bufbuild/buf) :floppy_disk: * [buf-format](https://github.com/bufbuild/buf) :floppy_disk:
* [buf-lint](https://github.com/bufbuild/buf) :floppy_disk: * [buf-lint](https://github.com/bufbuild/buf) :floppy_disk:
* [clang-format](https://clang.llvm.org/docs/ClangFormat.html)
* [protoc-gen-lint](https://github.com/ckaznocha/protoc-gen-lint) :floppy_disk: * [protoc-gen-lint](https://github.com/ckaznocha/protoc-gen-lint) :floppy_disk:
* [protolint](https://github.com/yoheimuta/protolint) :floppy_disk: * [protolint](https://github.com/yoheimuta/protolint) :floppy_disk:
* Pug * Pug