From 89dd2f98a420e7ce45904e2f59f73de197c32fdf Mon Sep 17 00:00:00 2001 From: Peter Steidel Date: Tue, 14 Jan 2020 14:18:52 -0500 Subject: [PATCH 1/2] Add LSP Support to Erlang --- modules/lang/erlang/config.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/lang/erlang/config.el b/modules/lang/erlang/config.el index 5c6779aad..1934344c2 100644 --- a/modules/lang/erlang/config.el +++ b/modules/lang/erlang/config.el @@ -22,4 +22,8 @@ (use-package! company-erlang :when (featurep! :completion company) + :unless (featurep! +lsp) :hook (erlang-mode . company-erlang-init)) + +(when (featurep! +lsp) + (add-hook 'erlang-mode-hook #'lsp!)) From 1d91d9c6d6415502c93d75b28692b688f541ba25 Mon Sep 17 00:00:00 2001 From: Peter Steidel Date: Tue, 14 Jan 2020 19:09:38 -0500 Subject: [PATCH 2/2] Erlang LSP module improvements - Add README.org - Make it so other completion frameworks don't compete with the lsp module - load lsp via erlang-local-vars-hook --- modules/lang/erlang/README.org | 39 +++++++++++++++++++++++++++++++++ modules/lang/erlang/config.el | 2 +- modules/lang/erlang/packages.el | 6 +++-- 3 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 modules/lang/erlang/README.org diff --git a/modules/lang/erlang/README.org b/modules/lang/erlang/README.org new file mode 100644 index 000000000..b5b540c97 --- /dev/null +++ b/modules/lang/erlang/README.org @@ -0,0 +1,39 @@ +#+TITLE: lang/erlang +#+DATE: January 14, 2020 +#+SINCE: {replace with next tagged release version} +#+STARTUP: inlineimages nofold + +* Table of Contents :TOC_3:noexport: +- [[#description][Description]] + - [[#maintainers][Maintainers]] + - [[#module-flags][Module Flags]] + - [[#plugins][Plugins]] +- [[#prerequisites][Prerequisites]] +- [[#features][Features]] + +* Description + +This module provides support [[https://www.erlang.org/][Erlang programming language]]. Support for the +[[https://github.com/erlang/sourcer][sourcer]] language server is optional. + +** Maintainers +This module has no dedicated maintainers. + +** Module Flags ++ ~+lsp~ Enable LSP Support. Requires [[https://github.com/erlang/sourcer][sourcer]]. + + +** Plugins ++ Erlang Mode (bundled with Erlang installations) ++ [[https://github.com/joedevivo/flycheck-rebar3][flycheck-rebar3]] ++ [[https://github.com/s-kostyaev/ivy-erlang-complete][ivy-erlang-complete]] + +* Prerequisites +You should have Erlang installed. Check your distribution's package manager or a +version management tool such as [[https://github.com/kerl/kerl][kerl]]. + +If you want LSP support, install [[https://github.com/erlang/sourcer][sourcer]]. + +* Features +- Code completion (~+lsp~, ~:completion company~, and ~:completion ivy~) +- Syntax checking (~:checkers syntax~) diff --git a/modules/lang/erlang/config.el b/modules/lang/erlang/config.el index 1934344c2..2c0773b5d 100644 --- a/modules/lang/erlang/config.el +++ b/modules/lang/erlang/config.el @@ -26,4 +26,4 @@ :hook (erlang-mode . company-erlang-init)) (when (featurep! +lsp) - (add-hook 'erlang-mode-hook #'lsp!)) + (add-hook 'erlang-mode-local-vars-hook #'lsp!)) diff --git a/modules/lang/erlang/packages.el b/modules/lang/erlang/packages.el index a40b52568..b519fa358 100644 --- a/modules/lang/erlang/packages.el +++ b/modules/lang/erlang/packages.el @@ -6,8 +6,10 @@ (when (featurep! :checkers syntax) (package! flycheck-rebar3)) -(when (featurep! :completion ivy) +(when (and (featurep! :completion ivy) + (not (featurep! +lsp))) (package! ivy-erlang-complete)) -(when (featurep! :completion company) +(when (and (featurep! :completion company) + (not (featurep! +lsp))) (package! company-erlang))