dense-analysis / ale

Check syntax in Vim/Neovim asynchronously and fix files, with Language Server Protocol (LSP) support
BSD 2-Clause "Simplified" License
13.48k stars 1.43k forks source link

Add support for forgefmt #4280

Open pyk opened 2 years ago

pyk commented 2 years ago

Name: forgefmt URL: https://github.com/foundry-rs/foundry/tree/master/fmt

Solidity formatter that respects (some parts of) the Style Guide

chrisfarms commented 1 year ago

For anyone else arriving here before this is put into ale proper, you can get forge fmt working with a custom fixer:

function! FormatSolidity(buffer) abort
    return {
    \   'command': 'forge fmt --raw -'
    \}
endfunction

execute ale#fix#registry#Add('forgefmt', 'FormatSolidity', ['solidity'], 'forge fmt for solidity')

let g:ale_fixers = {}
let g:ale_fixers.solidity = ['forgefmt']