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

[question] how to tell bashls to analyze zsh filetype

Open alexzanderr opened this issue 3 years ago • 1 comments

im using neovim and its configured with lua

i tried:

in my init.lua

require"lspconfig".bashls.setup {
  filetypes = {"sh", "bash", "zsh"}
}

but it doesnt work

i also tried this

require"lspconfig".bashls.setup {
  settings = {
    bash = {
	filetypes = {"sh", "zsh", "bash"}
  },
}

doesnt work.

is there a way to specifiy for the server to analyze zsh filetypes?

i also tried to set the file type to bash:

autocmd FileType zsh setl filetype=bash

still doesnt work.

alexzanderr avatar Sep 26 '21 22:09 alexzanderr

You can set the GLOB_PATTERN env variable to override the default pattern. This worked for me:

export GLOB_PATTERN="**/*@(.sh|.inc|.bash|.command|.zsh|zshrc|zsh_*)"

jguenther avatar Jan 25 '22 19:01 jguenther

hello, I modified the config.ts and changed the glob pattern to the given pattern above but still the bashls lsp wont recognise .zshrc file

i have checked the output of :LspInfo in nvim normal more and found that although the bashls lsp is installed, it is not attached to the .zshrc file

pal-ayan avatar Dec 24 '22 19:12 pal-ayan

I think the following config for nvim-lspconfig works as of now:

lspconfig.bashls.setup {
  filetypes = { 'sh', 'zsh', },
}

See https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#bashls

I didn't need to configure bashIde.globPattern for some reason.. and it also recognizes zshrc (if its filetype is zsh).

BTW I don't think using an environment variable GLOB_PATTERN is a good idea.

wookayin avatar Apr 19 '23 17:04 wookayin