## Coc is an intellisense engine for Vim/Neovim.

# http://github.com/neoclide/coc.nvim
# http://github.com/neoclide/coc-snippets
# http://github.com/neoclide/coc-python
# http://github.com/neoclide/coc-rls
# 
# http://github.com/rcjsuen/dockerfile-language-server-nodejs
# http://github.com/mads-hartmann/bash-language-server
# http://github.com/palantir/python-language-server

# http://github.com/golang/tools/tree/master/gopls

DEST=/etc/skel
NEOVIM_HOME=${DEST}/.config/neovim
LANGSERVER_CONF=${NEOVIM_HOME}/coc-settings.json

declare -A COC_OPT

# FIXME: Convert the following heredocs to jq

#cat > ${LANGSERVER_CONF} <<EOF
#"languageserver": {
#    "golang": {
#      "command": "gopls",
#      "rootPatterns": ["go.mod"],
#      "filetypes": ["go"]
#	}
#}
#EOF

COC_OPT[1]='.["languageserver"] = {"golang": {"command": "gopls", "rootPatterns" = ["go.mod"] , "filetypes" = ["go"] }' 

## http://github.com/rcjsuen/dockerfile-language-server-nodejs
#cat > ${LANGSERVER_CONF} <<EOF
#"languageserver": {
#    "dockerfile": {
#      "command": "docker-langserver",
#      "filetypes": ["dockerfile"],
#      "args": ["--stdio"]
#    }
#}
#EOF

COC_OPT[2]='.["languageserver"] = {"dockerfile": {"command": "docker-langserver", "filetypes" = ["dockerfile"], "args" = ["--stdio"] }' 


## h# http://github.com/palantir/python-language-serverttps://github.com/mads-hartmann/bash-language-server
#cat > ${LANGSERVER_CONF} <<EOF
#"languageserver": {
#    "bash": {
#      "command": "bash-language-server",
#      "args": ["start"],
#      "filetypes": ["sh"],
#      "ignoredRootPaths": ["~"]
#    }
#}
COC_OPT[3]='.["languageserver"] = {"bash": {"command": "bash-language-server", "filetypes" = ["sh"], "args" = ["start"], "ignoredRootPaths" = ["~"] }' 

## Python
# http://github.com/palantir/python-language-server
#cat > ${LANGSERVER_CONF} <<EOF
#"languageserver": {
#  "python": {
#    "command": "python",
#    "args": [
#      "-mpyls",
#      "-vv",
#      "--log-file",
#      "/tmp/lsp_python.log"
#    ],
#    "trace.server": "verbose",
#    "filetypes": [
#      "python"
#    ],
#    "settings": {
#      "pyls": {
#        "enable": true,
#        "trace": {
#          "server": "verbose"
#        },
#        "commandPath": "",
#        "configurationSources": [
#          "pycodestyle"
#        ],
#        "plugins": {
#          "jedi_completion": {
#            "enabled": true
#          },
#          "jedi_hover": {
#            "enabled": true
#          },
#          "jedi_references": {
#            "enabled": true
#          },
#          "jedi_signature_help": {
#            "enabled": true
#          },
#          "jedi_symbols": {
#            "enabled": true,
#            "all_scopes": true
#          },
#          "mccabe": {
#            "enabled": true,
#            "threshold": 15
#          },
#          "preload": {
#            "enabled": true
#          },
#          "pycodestyle": {
#            "enabled": true
#          },
#          "pydocstyle": {
#            "enabled": false,
#            "match": "(?!test_).*\\.py",
#            "matchDir": "[^\\.].*"
#          },
#          "pyflakes": {
#            "enabled": true
#          },
#          "rope_completion": {
#            "enabled": true
#          },
#          "yapf": {
#            "enabled": true
#          }
#        }
#      }
#    }
#  }
#}
#EOF

COC_OPT[4]='.["languageserver"] = {"python": {"command": "python", "filetypes" = ["py"], "args" = ["-mpyls", "-vv", "--log-file", "/tmp/lsp_python.log"], "ignoredRootPaths" = ["~"] }' 

pip install -U setuptools
pip install 'python-language-server[all]'
