diff --git a/doc/rst/tools/chpl-language-server/chpl-language-server.rst b/doc/rst/tools/chpl-language-server/chpl-language-server.rst index 08a7e9b2bc74..4594a6dc4068 100644 --- a/doc/rst/tools/chpl-language-server/chpl-language-server.rst +++ b/doc/rst/tools/chpl-language-server/chpl-language-server.rst @@ -62,6 +62,41 @@ VSCode Install the ``chapel`` extension from the `Visual Studio Code marketplace `_. +Emacs +^^^^^ + +With Emacs 29.1, support has been added for language server protocols via `Eglot +`_ + +To utilize the Chapel language server with Eglot, add the following to your +``.emacs`` file (note that this assumes you have already followed the +instructions in ``$CHPL_HOME/highlight/emacs/README.rst`` to install Chapel +syntax highlighting in Emacs): + +.. code-block:: lisp + + (with-eval-after-load 'eglot + (add-to-list 'eglot-server-programs + '(chpl-mode . ("chpl-language-server")))) + +This will enable using the language server with a particular ``.chpl`` file by +calling ``M-x eglot``. + +To automatically use Eglot and the language server with every ``.chpl`` file, +additionally add the following to your ``.emacs`` file: + +.. code-block:: lisp + + (add-hook 'chpl-mode-hook 'eglot-ensure) + +.. note:: + + There is currently a limitation with Eglot that only one language server can + be registered per language. We are investigating merging the support for + :ref:`readme-chplcheck` such that both can be used in Emacs at the same time, + stay tuned! + + Supported Features ------------------ diff --git a/doc/rst/tools/chplcheck/chplcheck.rst b/doc/rst/tools/chplcheck/chplcheck.rst index 57b743cc109a..b59f17c7b1e7 100644 --- a/doc/rst/tools/chplcheck/chplcheck.rst +++ b/doc/rst/tools/chplcheck/chplcheck.rst @@ -141,6 +141,42 @@ VSCode Install the ``chapel`` extension from the `Visual Studio Code marketplace `_. +Emacs +~~~~~ + +With Emacs 29.1, support has been added for language server protocols via `Eglot +`_ + +To utilize the linter via Eglot, add the following to your ``.emacs`` file (note +that this assumes you have already followed the instructions in +``$CHPL_HOME/highlight/emacs/README.rst`` to install Chapel syntax highlighting +in Emacs): + +.. code-block:: lisp + + (with-eval-after-load 'eglot + (add-to-list 'eglot-server-programs + '(chpl-mode . ("chplcheck" "--lsp")))) + +This will enable using the linter with a particular ``.chpl`` file by calling +``M-x eglot``. + +To automatically use Eglot and the linter with every ``.chpl`` file, +additionally add the following to your ``.emacs`` file: + +.. code-block:: lisp + + (add-hook 'chpl-mode-hook 'eglot-ensure) + +.. note:: + + There is currently a limitation with Eglot that only one language server can + be registered per language. We are investigating merging the support for + :ref:`readme-chpl-language-server` such that both can be used in Emacs at the + same time, stay tuned! + + + Writing New Rules -----------------