bash-language-server icon indicating copy to clipboard operation
bash-language-server copied to clipboard

Support formatting

Open realtica opened this issue 4 years ago • 5 comments

I tried to format the buffer, but nothing happen..

:lua vim.lsp.buf.formatting()

NVIM v0.5.1
Build type: Debug
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -DNVIM_TS_HAS_SET_MATCH_LIMIT -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=1 -I/home/pi/Downloads/neovim/build/config -I/home/pi/Downloads/neovim/src -I/home/pi/Downloads/neovim/.deps/usr/include -I/usr/include -I/home/pi/Downloads/neovim/build/src/nvim/auto -I/home/pi/Downloads/neovim/build/include
Compiled by pi@raspberrypi

Features: +acl +iconv +tui

realtica avatar Jan 06 '22 23:01 realtica

Looking for this feature too

prgres avatar May 26 '22 10:05 prgres

This article explains how to get formatting work with shell scripts: https://smarttech101.com/nvim-lsp-set-up-null-ls-for-beginners/

Basically you need shfmt and null-ls configured to use it.

(I have no affiliation with the site, just found it to solve my problem.)

raine avatar Nov 19 '22 10:11 raine

Ideally we want to integrate a formatter into the server, but currently this is not supported.

skovhus avatar Nov 28 '22 14:11 skovhus

If you want formatting in Helix you can use the shfmt binary out of the box with this setting: https://github.com/helix-editor/helix/wiki/External-binary-formatter-configuration#shfmt

David-Else avatar Dec 30 '22 15:12 David-Else

Using null-ls you can get formatting via shfmt. Would be really cool to just integrate shfmt into the bash-language server so we don't need to use null-ls

klnusbaum avatar Feb 08 '24 03:02 klnusbaum