Programming Languages

Haskell

The haskell-language-server should be built for the specific GHC version it will be used with. So, usually you download a bunch of haskell-language-server binaries, then use haskell-language-server-wrapper to appropriately choose the right version.

Python

Goals

  • Each project has its own virtual environment.
  • Different projects use different versions of Python.
  • Each python project can define its own formatting rules. Some projects may use black, while others use yapf. Each project might define, say, different maximum line lengths.
  • Each project can define its own linting rules (using say pylint).

Debugging with dap-mode

Install debugpy - how can I install this globally?

Emacs installs pyright automatically

Emacs ran:

/usr/local/bin/npm -g --prefix /Users/chris.clark/emacs/cfclrk/.cache/lsp/npm/pyright install pyright

Questions

Is there a way to conditionally load either the black or yapf lsp plugins depending on project config?

Bash

Install bash-language-server:

yarn global add bash-language-server

Deprecated Notes

I don't use pyls anymore, I've switched to pyright.

PATH

pyls, pyls-mypy, etc must be on your $PATH. There are a few ways to accomplish this.

  1. Install pyls (etc) into every virtual environment. Perhaps, add it to the pyenv default packages list.
  2. Create a pyenv virtual env specifically for pyls etc. Then in each project, do pyenv local $PROJECTVENV $PYLSVENV. With pyenv you can set multiple active virtual environments, so always activate the environment with pyls.
  3. Install pyls etc. somewhere else on your $PATH, and do not install it into any pyenv virtual environment.

    I used (2) for a while. Now I'm going with (3). To install it in a globally-accessible place:

    /usr/local/opt/python3/libexec/bin/pip install pyls
    /usr/local/opt/python3/libexec/bin/pip install pyls-mypy
    /usr/local/opt/python3/libexec/bin/pip install pyls-isort
    /usr/local/opt/python3/libexec/bin/pip install pyls-black
    

    Note that if any of pyls, pyls-mypy, etc are installed in any pyenv virtual environment, things will start going wrong unless you really know what you're doing. That shouldn't be a problem: no python package should be requiring pyls or LSP plugins (even as development dependencies). Different developers use different things, and not everyone uses LSP, so requiring it would be silly.

    NOTE: I ALSO NEEDED TO INSTALL mypy and isort into the top-level pip. HOW CAN I MAKE LSP use the versions of mypy and isort in the virtual environment?

    /usr/local/opt/python3/libexec/bin/pip install isort
    /usr/local/opt/python3/libexec/bin/pip install mypy