replace pyls with pyright

This commit is contained in:
siduck76 2021-04-08 07:29:39 +05:30
parent 58443f6d97
commit f5c59c574a
2 changed files with 18 additions and 28 deletions

View file

@ -7,14 +7,12 @@ lsp_langs=""
choose_langs() { choose_langs() {
read -p "Would you like to install $1 lsp?(y/n)" lang read -p "Would you like to install $1 lsp?(y/n)" lang
if [ "$lang" = "y" ] if [ "$lang" = "y" ]; then
then
lsp_langs+="$1 " lsp_langs+="$1 "
fi fi
} }
for lang in $default_lsp_langs for lang in $default_lsp_langs; do
do
choose_langs $lang choose_langs $lang
done done
@ -26,11 +24,11 @@ heading() {
get_platform() { get_platform() {
case "$(uname -s)" in case "$(uname -s)" in
Linux*) platform=Linux;; Linux*) platform=Linux ;;
Darwin*) platform=Mac;; Darwin*) platform=Mac ;;
CYGWIN*) platform=Cygwin;; CYGWIN*) platform=Cygwin ;;
MINGW*) platform=MinGw;; MINGW*) platform=MinGw ;;
*) platform="UNKNOWN:${unameOut}" *) platform="UNKNOWN:${unameOut}" ;;
esac esac
echo $platform echo $platform
} }
@ -39,17 +37,17 @@ heading "installing packer"
if [[ ! -e ~/.local/share/nvim/site/pack/packer/start/packer.nvim ]]; then if [[ ! -e ~/.local/share/nvim/site/pack/packer/start/packer.nvim ]]; then
heading "Installing packer" heading "Installing packer"
git clone https://github.com/wbthomason/packer.nvim\ git clone https://github.com/wbthomason/packer.nvim \
~/.local/share/nvim/site/pack/packer/start/packer.nvim ~/.local/share/nvim/site/pack/packer/start/packer.nvim
fi fi
heading "Linking config" heading "Linking config"
heading "old nvim config will be deleted so watchout :0" heading "old nvim config will be deleted so watchout :0"
# copying config # copying config
rm -rf ~/.config/nvim/ && mkdir -p ~/.config/nvim rm -rf ~/.config/nvim/ && mkdir -p ~/.config/nvim
cp -r init.lua ~/.config/nvim && cp -r lua ~/.config/nvim cp -r init.lua ~/.config/nvim && cp -r lua ~/.config/nvim
# change shell for nvim # change shell for nvim
read -p "which shell do you use?: " shellname read -p "which shell do you use?: " shellname
@ -72,10 +70,10 @@ echo "shell changed to $shellname on nvim successfully!"
#nvim --headless +TSUpdate +qa #nvim --headless +TSUpdate +qa
echo echo
fn_exists() { declare -F "$1" > /dev/null; } fn_exists() { declare -F "$1" >/dev/null; }
warn_path=false warn_path=false
install_node_deps () { install_node_deps() {
if [[ -z $(which npm) ]]; then if [[ -z $(which npm) ]]; then
echo "npm not installed" echo "npm not installed"
return return
@ -83,14 +81,6 @@ install_node_deps () {
sudo npm install -g $@ sudo npm install -g $@
} }
install_python_deps () {
if [[ -z $(which pip) && -z $(which pip3) ]]; then
echo "python/pip not installed"
return
fi
sudo python3 -m pip install $@
}
install_ts() { install_ts() {
install_node_deps typescript typescript-language-server prettier install_node_deps typescript typescript-language-server prettier
} }
@ -114,21 +104,21 @@ install_rust() {
fi fi
} }
install_python(){ install_python() {
install_python_deps 'python-language-server[all]' install_node_deps pyright
} }
for lang in ${lsp_langs}; do for lang in ${lsp_langs}; do
if fn_exists install_$lang ; then if fn_exists install_$lang; then
heading "Installing $lang language server" heading "Installing $lang language server"
install_$lang install_$lang
else else
echo $lang setup not implemented echo $lang setup not implemented
echo echo
fi fi
done done
if [[ ${warn_path} = true ]]; then if [[ ${warn_path} == true ]]; then
echo "" echo ""
echo "Ensure ${LSP_BIN_PATH} is available in your \$PATH variable" echo "Ensure ${LSP_BIN_PATH} is available in your \$PATH variable"
fi fi

View file

@ -39,7 +39,7 @@ function on_attach(client)
end end
end end
local servers = {"tsserver", "cssls", "html" , "pyls"} local servers = {"tsserver", "cssls", "html" , "pyright"}
for _, lsp in ipairs(servers) do for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup {on_attach = on_attach} nvim_lsp[lsp].setup {on_attach = on_attach}
end end