Coder Social home page Coder Social logo

emacs-lsp / lsp-haskell Goto Github PK

View Code? Open in Web Editor NEW
227.0 16.0 56.0 1.21 MB

lsp-mode :heart: haskell

Home Page: https://emacs-lsp.github.io/lsp-haskell

License: GNU General Public License v3.0

Emacs Lisp 98.34% Makefile 1.66%
haskell lsp-haskell hie melpa lsp emacs-lsp

lsp-haskell's Introduction

lsp-haskell

MELPA Build Status

An Emacs Lisp library for interacting with a Haskell language server such as haskell-language-server using Microsoft's Language Server Protocol.

The library acts as a client for lsp-mode.

Functionality

This main functionality of lsp-haskell is:

  • Finding and launching the haskell-language-server binary
  • Providing configuration options to haskell-language-server

If you would like to know about how LSP functionality is provided in Emacs and how to use it, please consult lsp-mode. If you would like to know about the LSP functionality which is provided by the Haskell language server, please consult haskell-language-server.

Installation

Follow the lsp-mode installation instructions. Do not skip this! It has important information.

lsp-mode automatically requires the lsp-haskell package , so you do not need to require lsp-haskell unless you like being explicit. Similarly, lsp-haskell automatically requires the haskell-mode package, so you do not need to require haskell-mode.

You will need to set some hooks to ensure that lsp-mode is triggered when the haskell-mode major mode is entered.

(add-hook 'haskell-mode-hook #'lsp)
(add-hook 'haskell-literate-mode-hook #'lsp)

Configuration

HLS has some configuration you can modify using either the lsp-haskell or lsp customization groups:

(customize-group 'lsp-haskell)

; or

(customize-group 'lsp)

If you want to modify some configuration that this project doesn't support yet you can customize things explicitly yourself using lsp--set-configuration. For example:

(add-hook 'lsp-after-initialize-hook
          '(lambda ()
             (lsp--set-configuration
              '(:haskell (:plugin (:tactics (:config (:timeout_duration 5)))))
              )))

Language server installation

Follow the instructions on the haskell-language-server repositories to install the server binaries.

If you have installed the binaries to a location that is not on your PATH, or you are not using the haskell-language-server-wrapper, then you will need to customize the lsp-haskell-server-path variable to point to the executable you want to launch.

Server configuration

lsp-haskell provides a few options for for setting the server executable and arguments, and numerous settings for configuring the server itself (hlint, choice of formatting provider, etc.).

Note that server configuration settings will currently not be applied until the server is restarted.

Troubleshooting

lsp-haskell is just the glue between lsp-mode and haskell-language-server.

If you have an issue with Emacs, it is probably a lsp-mode issue. If you have an issue with the Haskell functionality itself, it is probably a haskell-language-server issue. If you have an issue specifically with how the two are joined together, then it belongs here!

If you're not sure what the problem is, the haskell-language-server README provides some troubleshooting instructions.

lsp-haskell's People

Contributors

ailrun avatar alanz avatar amesgen avatar ericdallo avatar freckletonj avatar gdevanla avatar glyn avatar gmittert avatar hpdeifel avatar jasagredo avatar jason5lee avatar jcs090218 avatar kamoii avatar kurnevsky avatar laurencewarne avatar luigy avatar maskray avatar michaelpj avatar nasyxx avatar ncaq avatar notogawa avatar peterbecich avatar robbert-vdh avatar serhiip avatar thkoch2001 avatar tristancacqueray avatar trivialfis avatar vibhavp avatar wpcarro avatar yyoncho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lsp-haskell's Issues

Timeouts while waiting for responses

Hi, I'm trying to integrate HIE/LSP with Spacemacs. The server is starting and communicating with Emacs (in particular hlint suggestions and refactor buttons are showing, presumably via LSP-UI). However, meaningful edits such as rename and lift cause:

Timed out while waiting for a response from the language server [2 times]

I'm using Emacs 26.1 on NixOS.

> hie --version
Version 0.2.2.0 x86_64 ghc-8.4.3

Full log here: hie.log

Any idea what might be happening? Any help is appreciated!

eldoc support?

I'm having difficulty getting eldoc to show type hints in the echo area? I'm not really that familliar with haskell as a language, but I'd expect anything the built in haskell mode can show type hints for, the lsp-haskell wrapper should do so as well. For example, if I create a simple haskell file like this in an empty directory:

module Main (main) where

main :: IO ()
main = putStrLn "Hello, World!"

when I hover over putStrLn nothing is echoed. If I type M-: (lsp-eldoc-function) nil is printed to the messages buffer so I can only surmise HIE/the-language-server doesn't know what the definition or declaration of putStrLn is. but if I do M-x lsp-describe-thing-at-point a new buffer pops up and displays


putStrLn :: String -> IO ()
putStrLn :: String -> IO ()


The same as putStr, but adds a newline character.



base System.IO

so the server does know what the definition is, it just doesn't seem willing to echo it. (Notice the leading empty line in the response, I suspect it may have something to do with this but I can't be sure). What's more, if I use the built in haskell-mode doc function by typing M-: (haskell-doc-current-info) putStrLn :: String -> IO () is echoed out.

my value of eldoc-documentation-function is:

#[128 "\300\301�\"\206�\0\300\302�\"\207" [apply lsp-eldoc-function
      haskell-doc-current-info nil] 4 nil]

and I have no idea how to decipher it, but I don't think that's the reason lsp-eldoc-function returns nil anyways. I've got lsp-mode setup and working with kotlin so I know it can work with eldoc... I'm just not sure how to get it working with haskell. Any help would be appreciated here.

I'm running hie Version 0.12.0.0, Git revision 098b1800c16ec1348fe9d380b946ec4ffa884f38 (3005 commits) x86_64 ghc-8.6.5.

Suppress minibuffer messages?

My stack project is currently having trouble building, hie.log keeps showing some error like below:

2020-06-19 18:00:29.309127386 [ThreadId 4844] - Source error on cradle initialisation: `gcc' failed in phase `C pre-processor'. (Exit code: 1)

However here the error message isn't my point, I want to emphasis on the plugin behavior: as the plugin retries* to build the project indefintely, my minibuffer is flooded with "Initializing Stack project...done", making it incredibly annoying and distracting:
2020-06-19_180820_4480x1440_scrot

I want to see if there's a way that max retry times can be set, or this message can be suppressed so that it doesn't constantly show up.

*: actually I'm not sure if this retry behavior is in lsp-haskell, hie or something else.

Enables flymake (for me)

Hello, thanks for lsp-haskell, it is pretty cool!

For some reason requiring ((use-package lsp-haskell)) enables the flymake mode for me. This is annoying because it creates an additional "Foo_flymake.hs" file for each ".hs" file that I edit.

Here is my emacs config: https://github.com/vyorkin/emacs.d

Server hie status:starting exited with status exit

Whenever I open a Haskell source file, I see a prompt on the bottom:

Server hie:<pid> status:starting exited with status exit. Do you want to restart it? (y or n)

Also, I have an LSP(Disconnected) in the mode list. However, it seems that I do get diagnostic messages in the buffer. But when I check the task manager, I really don't have a hie process running. Below is a screenshot:

image

hie fails to launch if ghc is not on PATH (but stack is)

I use stack to handle all of my Haskell versioning, so I don't have a system GHC installed. I'm using spacemacs develop.

The lsp-haskell stderr buffer contains

/bin/sh: ghc: command not found
hie: readCreateProcess: ghc --version (exit 127): failed

Process lsp-haskell stderr finished

A workaround is to set lsp-haskell-process-path-hie to hie-wrapper (described here).

Edit: Would it be a good idea for hie-wrapper to become the default instead of hie?

lsp-doc markdown broken ?

I am not sure if this issue is caused by lsp-haskell or lsp-ui-doc. But the markdown seems to be broken.

-> The last sentence is attached to Documentation link.
screen shot 2018-06-20 at 20 36 28

-> Also the foldl signature and start of documentation string are on the same line. It would be nice if the documentation string starts from the next line, like in vs-code.

Emacs 27.1 - set-formatter commands error: (wrong-type-argument json-value-p :brittany)

Hello, I just upgraded to Emacs 27.1, and it seems that there was some change to the handling of JSON serialization. When trying the various lsp-set-formatter commands:
lsp-set-formatter-ormolu
lsp-set-formatter-brittany
lsp-set-formatter-floskell
I get a: (wrong-type-argument json-value-p :ormolu), (wrong-type-argument json-value-p :brittany), or (wrong-type-argument json-value-p :floskell), respectively.

Here's a Backtrace from trying lsp-set-formatter-brittany:

Debugger entered--Lisp error: (wrong-type-argument json-value-p :brittany)
  json-serialize((:jsonrpc "2.0" :method "workspace/didChangeConfiguration" :params (:settings (:languageServerHaskell #<hash-table eql 3/65 0x1ff4d46f7b2d>))) :null-object nil :false-object :json-false)
  (let ((body (json-serialize params :null-object nil :false-object :json-false))) (concat "Content-Length: " (number-to-string (1+ (string-bytes body))) "\15\n\15\n" body "\n"))
  lsp--make-message((:jsonrpc "2.0" :method "workspace/didChangeConfiguration" :params (:settings (:languageServerHaskell #<hash-table eql 3/65 0x1ff4d46f7b2d>))))
  (lsp--send-no-wait (lsp--make-message body) (progn (or (and (memq (type-of lsp--cur-workspace) cl-struct-lsp--workspace-tags) t) (signal 'wrong-type-argument (list 'lsp--workspace lsp--cur-workspace))) (aref lsp--cur-workspace 7)))
  (let ((lsp--cur-workspace it)) (if lsp-print-io (progn (lsp--log-entry-new (lsp--make-log-entry (plist-get body :method) nil (plist-get body :params) 'outgoing-notif) lsp--cur-workspace))) (lsp--send-no-wait (lsp--make-message body) (progn (or (and (memq (type-of lsp--cur-workspace) cl-struct-lsp--workspace-tags) t) (signal 'wrong-type-argument (list 'lsp--workspace lsp--cur-workspace))) (aref lsp--cur-workspace 7))))
  (closure ((body :jsonrpc "2.0" :method "workspace/didChangeConfiguration" :params (:settings (:languageServerHaskell #<hash-table eql 3/65 0x1ff4d46f7b2d>))) cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode t) (it) (let ((lsp--cur-workspace it)) (if lsp-print-io (progn (lsp--log-entry-new (lsp--make-log-entry (plist-get body :method) nil (plist-get body :params) 'outgoing-notif) lsp--cur-workspace))) (lsp--send-no-wait (lsp--make-message body) (progn (or (and (memq ... cl-struct-lsp--workspace-tags) t) (signal 'wrong-type-argument (list ... lsp--cur-workspace))) (aref lsp--cur-workspace 7)))))(#s(lsp--workspace :ewoc nil :server-capabilities #<hash-table equal 17/17 0x1ff4d6363c41> :registered-server-capabilities (... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) :root "/Users/shaun/workspa..." :client #s(lsp--client :language-id nil :add-on? nil :new-connection ... :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 0/65 0x1ff4d377d0c1> :request-handlers #<hash-table equal 0/65 0x1ff4d37d6cb1> :response-handlers #<hash-table eql 3/65 0x1ff4d37d6fa9> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x1ff4d37d7281> :action-handlers #<hash-table equal 0/65 0x1ff4d37d72a1> :major-modes ... :activation-fn nil :priority 0 :server-id hie :multi-root nil :initialization-options nil :custom-capabilities nil :library-folders-fn nil :before-file-open-fn nil ...) :host-root nil :proc #<process hie> :cmd-proc #<process hie> :buffers (#<buffer Scenes.hs> #<buffer Lib.hs> #<buffer Random.hs> #<buffer Main.hs>) :semantic-highlighting-faces nil :semantic-highlighting-modifier-faces nil :extra-client-capabilities nil :status initialized :metadata #<hash-table equal 0/65 0x1ff4d6518a55> :watches #<hash-table equal 0/65 0x1ff4d6518d2d> :workspace-folders nil :last-id 0 :status-string nil :shutdown-action nil :diagnostics #<hash-table equal 1/65 0x1ff4d6518dd1> ...))
  mapcar((closure ((body :jsonrpc "2.0" :method "workspace/didChangeConfigu..." :params ...) cl-struct-lsp--log-entry-tags cl-struct-lsp-session-tags cl-struct-lsp--workspace-tags cl-struct-lsp--registered-capability-tags lsp-mode-menu cl-struct-lsp--folding-range-tags cl-struct-lsp-watch-tags cl-struct-lsp--client-tags lsp--log-lines dap-ui-menu-items dap-auto-configure-mode t) (it) (let (...) (if lsp-print-io ...) (lsp--send-no-wait ... ...))) (#s(lsp--workspace :ewoc nil :server-capabilities #<hash-table equal 17/17 0x1ff4d6363c41> :registered-server-capabilities (... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) :root "/Users/shaun/workspace/ray..." :client #s(lsp--client :language-id nil :add-on? nil :new-connection ... :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 0/65 0x1ff4d377d0c1> :request-handlers #<hash-table equal 0/65 0x1ff4d37d6cb1> :response-handlers #<hash-table eql 3/65 0x1ff4d37d6fa9> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x1ff4d37d7281> :action-handlers #<hash-table equal 0/65 0x1ff4d37d72a1> :major-modes ... :activation-fn nil :priority 0 :server-id hie :multi-root nil :initialization-options nil :custom-capabilities nil :library-folders-fn nil :before-file-open-fn nil :initialized-fn ... :remote? nil :completion-in-comments? nil :path->uri-fn nil :uri->path-fn nil :environment-fn nil ...) :host-root nil :proc #<process hie> :cmd-proc #<process hie> :buffers (#<buffer Scenes.hs> #<buffer Lib.hs> #<buffer Random.hs> #<buffer Main.hs>) :semantic-highlighting-faces nil :semantic-highlighting-modifier-faces nil :extra-client-capabilities nil :status initialized :metadata #<hash-table equal 0/65 0x1ff4d6518a55> :watches #<hash-table equal 0/65 0x1ff4d6518d2d> :workspace-folders nil :last-id 0 :status-string nil :shutdown-action nil :diagnostics #<hash-table equal 1/65 0x1ff4d6518dd1> :work-done-tokens #<hash-table equal 0/65 0x1ff4d64fd4c1>)))
  lsp--send-notification((:jsonrpc "2.0" :method "workspace/didChangeConfiguration" :params (:settings (:languageServerHaskell #<hash-table eql 3/65 0x1ff4d46f7b2d>))))
  lsp-notify("workspace/didChangeConfiguration" (:settings (:languageServerHaskell #<hash-table eql 3/65 0x1ff4d46f7b2d>)))
  lsp--set-configuration((:languageServerHaskell #<hash-table eql 3/65 0x1ff4d46f7b2d>))
  lsp-haskell--set-configuration()
  lsp-haskell-set-formatter-brittany()
  funcall-interactively(lsp-haskell-set-formatter-brittany)
  call-interactively(lsp-haskell-set-formatter-brittany record nil)
  command-execute(lsp-haskell-set-formatter-brittany record)
  execute-extended-command(nil "lsp-haskell-set-formatter-brittany" "lsp-haskell-set-formatter-brit")
  funcall-interactively(execute-extended-command nil "lsp-haskell-set-formatter-brittany" "lsp-haskell-set-formatter-brit")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

As an experiment, modifying the lsp-haskell-set-formatter functions to use strings seems to solve the issue:

(defun lsp-haskell-set-formatter-brittany ()
  "Use brittany."
  (interactive)
  (lsp-haskell-set-formatter "brittany")
  (lsp-haskell--set-configuration))

(defun lsp-haskell-set-formatter-floskell ()
  "Use floskell."
  (interactive)
  (lsp-haskell-set-formatter "floskell")
  (lsp-haskell--set-configuration))

(defun lsp-haskell-set-formatter-ormolu ()
  "Use ormolu."
  (interactive)
  (lsp-haskell-set-formatter "ormolu")
  (lsp-haskell--set-configuration))

However, I don't know if this breaks compatibility with prior versions of Emacs.

Edit: Using strings instead of symbols, as shown above, also works on Emacs 26.3.

Warnings pop up

I keep getting warning pop ups in the "Warnings" buffer with the following warning:

Warning (lsp-mode): Unknown request method: window/workDoneProgress/create
Warning (lsp-mode): Unknown request method: window/workDoneProgress/create
Warning (lsp-mode): Unknown request method: window/workDoneProgress/create

Any idea what's going on here?

Not getting any HIE functionality

My init.el:

(setq inhibit-startup-screen t)

(add-to-list 'default-frame-alist '(fullscreen . maximized))

(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
                    (not (gnutls-available-p))))
       (proto (if no-ssl "http" "https")))
  (when no-ssl
    (warn "\
Your version of Emacs does not support SSL connections,
which is unsafe because it allows man-in-the-middle attacks.
There are two things you can do about this warning:
1. Install an Emacs version that does support SSL and be safe.
2. Remove this warning from your init file so you won't see it again."))
  ;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
  (add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
  ;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
  (when (< emacs-major-version 24)
    ;; For important compatibility libraries like cl-lib
    (add-to-list 'package-archives (cons "gnu" (concat proto "://elpa.gnu.org/packages/")))))
(package-initialize)

(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")

;; Haskell packages setup:
(require 'lsp-mode)
(require 'lsp-ui)
(require 'lsp-haskell)

(add-hook 'lsp-mode-hook 'lsp-ui-mode)
(add-hook 'haskell-mode-hook #'lsp-haskell-enable)
(add-hook 'haskell-mode-hook 'flycheck-mode)
 
;; -----------------------------------------------------
;; emacs generated
 
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(package-selected-packages (quote (lsp-haskell lsp-ui lsp-mode))))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

The only thing that happens when I open a Haskell file is getting syntax highlighting.

Autocomplete does not work, types on hover does not work, type check errors do not appear, etc. Basically no HIE features works

(macOS)Flycheck doesnt work

Flycheck results flashes and disappears.(with [M-x flycheck-list-errors])
I hooked flycheck-mode to lsp-mode-hook. All components up-to-date.

Ran into problem following OSX instructions

I followed the instructions under the "Hie Installation (OSX)" heading and got the following error:

Timas-MacBook-Air:Developer timoffex$ git clone https://github.com/haskell/haskell-ide-engine
Cloning into 'haskell-ide-engine'...
remote: Enumerating objects: 107, done.
remote: Counting objects: 100% (107/107), done.
remote: Compressing objects: 100% (62/62), done.
remote: Total 28008 (delta 51), reused 72 (delta 36), pack-reused 27901
Receiving objects: 100% (28008/28008), 6.66 MiB | 974.00 KiB/s, done.
Resolving deltas: 100% (15112/15112), done.
Timas-MacBook-Air:Developer timoffex$ cd haskell-ide-engine
Timas-MacBook-Air:haskell-ide-engine timoffex$ ./install.hs build-all
Error when running Shake build system:
  at want, called at src/Development/Shake/Internal/Args.hs:83:69 in shake-0.18.5-44KSA7uQF2VObxzEvLYZx:Development.Shake.Internal.Args
* Depends on: build-all
  at error, called at src/Development/Shake/Internal/Rules/File.hs:179:58 in shake-0.18.5-44KSA7uQF2VObxzEvLYZx:Development.Shake.Internal.Rules.File
* Raised the exception:
Error, file does not exist and no rule available:
  build-all

I've never used Shake (at least not directly). What am I missing here? Is there a typo in the instructions or do the instructions need to be amended?

Thanks!

Error applying HLint suggestions

Enter Recursive editing using [M-x lsp-apply-commands], after pressing [C-c C-c], Error Invalid function: lsp--intero-with-temp-buffer
OS: Fedora 27 in Hyper-V VM
Emacs: 25.3 in terminal

lsp fails to start

I have problem starting the lsp server. lsp-mode fails with error

Following servers support current file .....
.... if you have already installed server check *lsp-log*

image

But I don't even see any buffer with name `lsp-log at all.

When I open eshel I'm able to call hie --lsp manually which works.

To Reroduce:

setup environment using nix:

$ git clone https://github.com/Infinisil/all-hies /tmp/all-hies
$ cd /tmp/all-hies/templates/nixpkgs-cabal
$ nix-shell
$ emacs Main.hs

within Emacs M-x lsp

Am I'm doing something wrong or is this a some sort of bug? I also tried flow with direnv-mode with same result.

Meta

$  uname -a
Linux nixos-mainframe 5.4.66 #1-NixOS SMP Thu Sep 17 11:47:56 UTC 2020 x86_64 GNU/Linux
$ emacs --version
GNU Emacs 26.3
Copyright (C) 2019 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

Hovering on the parameter of a lambda shows the type of the lambda not the parameter

I would expect to get the type of the parameter rather then the type of the full lambda when highlighting the parameter specifically. Here are a couple examples where it happens:

data Cont r a = Cont ((a -> r) -> r)
instance Functor (Cont r) where
  fmap f (Cont g) = Cont $ \br -> g (br . f)

f :: Int -> ()
f = \i -> ()

g = (\p -> ()) :: Bool -> ()

I'm using spacemacs with the LSP layer, Haskell layer, LSP-haskell, and ghcide.

Syntax highlighting in popups does not work

First of all, thanks for the great project, I'm enjoying lsp-haskell. I don't know if this is the right place file this issue. I successfully installed lsp-mode lsp-ui and lsp-haskell, but the pop ups that appear on hovering over code are not properly formatted:
2019-06-06-093116_1069x157_scrot

I'm running emacs on nixos. Here is my emacs config:

(req-package haskell-mode
  :require lsp lsp-haskell flycheck smartparens
  :init
    (setq haskell-process-type 'stack-ghci
          haskell-tags-on-save t)
    (add-hook 'haskell-mode-hook 'flycheck-mode)
    (add-hook 'haskell-mode-hook 'smartparens-strict-mode)
    (add-hook 'haskell-mode-hook 'haskell-indent-mode)
    (add-hook 'haskell-mode-hook 'linum-mode)
    (add-hook 'haskell-mode-hook 'lsp))

(req-package lsp-mode
  :require lsp-ui
  :config
    (add-hook 'lsp-mode-hook 'lsp-ui-mode))

Any ideas?

Regards,
Sven

Can not use different major-mode other than haskell-mode

The :major-mode parameter for make-lsp--client is hardcoded as haskell-mode.
So, even if I push (custom-haskell-mode . "haskell") to lsp-language-id-configuration
lsp-mode still complains that custom-haskell-mode is not registered.

It would be nice if we have defcustom for major-mode parameter of the make-lsp--client.

Persistent and comprehensive server configuraiton

We have formatter configuration now, which is nice, but it's a little bit clunky:

  • It only covers formatters, and not all of them (missing "stylish-haskell").
  • It's not persistent: you have to redo it every time your server starts. I haven't figured out a way to set it persistently (but I'm an emacs noob).

I would guess we want a bunch of defcustom variables for all the relevant configuration. Maybe we should go through the list of options the vscode extension provides and copy them over?

Support for literate-haskell-mode.

Have a bunch of projects in literate Haskell. The most bare-bones variant:

  • .lhs file extensions
  • \begin{code} & \end{code} blocks inside them.
    Having a highlighting support, Haskell toolkits handle projects/code ordinary.

Configured Emacs with HIE. .hs project work fully. .lhs projects recieving:

LSP :: No LSP server for literate-haskell-mode.

Tried to add hooks to literate-haskell-mode in two forms:

(add-hook 'literate-haskell-mode-hook #'lsp-haskell-enable)
(add-hook 'literate-haskell-mode-hook #'lsp)

So far not got any progress.
Seems like should be a sure simple thing. Do not know is it Emacs lsp-haslell or HIE issue.

Configuration parse error

I see the following logs in the *lsp-log* buffer:

haskell-lsp:configuration parse error. RequestMessage {_jsonrpc = "2.0", _id = IdInt 233, _method = Initialize, _params = InitializeParams {_processId = Just 24529, _rootPath = Just "/home/ashesh/code/centralapp/transactor/", _rootUri = Just (Uri {getUri = "file:///home/ashesh/code/centralapp/transactor/"}), _initializationOptions = Just (String "lsp-haskell--make-init-options"), _capabilities = ClientCapabilities {_workspace = Just (WorkspaceClientCapabilities {_applyEdit = Just True, _workspaceEdit = Just (WorkspaceEditClientCapabilities {_documentChanges = Just True}), _didChangeConfiguration = Nothing, _didChangeWatchedFiles = Just (DidChangeWatchedFilesClientCapabilities {_dynamicRegistration = Just True}), _symbol = Just (SymbolClientCapabilities {_dynamicRegistration = Nothing, _symbolKind = Just (SymbolKindClientCapabilities {_valueSet = Just (List [SkFile,SkModule,SkNamespace,SkPackage,SkClass,SkMethod,SkProperty,SkField,SkConstructor,SkEnum,SkInterface,SkFunction,SkVariable,SkConstant,SkString,SkNumber,SkBoolean,SkArray,SkObject,SkKey,SkNull,SkEnumMember,SkStruct,SkEvent,SkOperator,SkTypeParameter])})}), _executeCommand = Just (ExecuteClientCapabilities {_dynamicRegistration = Just False}), _workspaceFolders = Just True, _configuration = Just True}), _textDocument = Just (TextDocumentClientCapabilities {_synchronization = Just (SynchronizationTextDocumentClientCapabilities {_dynamicRegistration = Nothing, _willSave = Just True, _willSaveWaitUntil = Just True, _didSave = Just True}), _completion = Just (CompletionClientCapabilities {_dynamicRegistration = Nothing, _completionItem = Just (CompletionItemClientCapabilities {_snippetSupport = Just True, _commitCharactersSupport = Nothing, _documentationFormat = Just (List [MkMarkdown]), _deprecatedSupport = Nothing, _preselectSupport = Nothing}), _completionItemKind = Nothing, _contextSupport = Just True}), _hover = Just (HoverClientCapabilities {_dynamicRegistration = Nothing, _contentFormat = Just (List [MkMarkdown,MkPlainText])}), _signatureHelp = Just (SignatureHelpClientCapabilities {_dynamicRegistration = Nothing, _signatureInformation = Just (SignatureInformationClientCapabilities {documentationFormat = Nothing})}), _references = Nothing, _documentHighlight = Nothing, _documentSymbol = Just (DocumentSymbolClientCapabilities {_dynamicRegistration = Nothing, _symbolKind = Just (DocumentSymbolKindClientCapabilities {_valueSet = Just (List [SkFile,SkModule,SkNamespace,SkPackage,SkClass,SkMethod,SkProperty,SkField,SkConstructor,SkEnum,SkInterface,SkFunction,SkVariable,SkConstant,SkString,SkNumber,SkBoolean,SkArray,SkObject,SkKey,SkNull,SkEnumMember,SkStruct,SkEvent,SkOperator,SkTypeParameter])}), _hierarchicalDocumentSymbolSupport = Just True}), _formatting = Just (FormattingClientCapabilities {_dynamicRegistration = Just True}), _rangeFormatting = Nothing, _onTypeFormatting = Nothing, _definition = Just (DefinitionClientCapabilities {_dynamicRegistration = Nothing}), _typeDefinition = Just (TypeDefinitionClientCapabilities {_dynamicRegistration = Nothing}), _implementation = Just (ImplementationClientCapabilities {_dynamicRegistration = Nothing}), _codeAction = Just (CodeActionClientCapabilities {_dynamicRegistration = Just True, _codeActionLiteralSupport = Just (CodeActionLiteralSupport {_codeActionKind = CodeActionKindClientCapabilities {_valueSet = List [CodeActionUnknown "",CodeActionQuickFix,CodeActionRefactor,CodeActionRefactorExtract,CodeActionRefactorInline,CodeActionRefactorRewrite,CodeActionSource,CodeActionSourceOrganizeImports]}})}), _codeLens = Nothing, _documentLink = Just (DocumentLinkClientCapabilities {_dynamicRegistration = Just True}), _colorProvider = Nothing, _rename = Nothing, _publishDiagnostics = Nothing, _foldingRange = Just (FoldingRangeClientCapabilities {_dynamicRegistration = Just True, _rangeLimit = Nothing, _lineFoldingOnly = Just False})}), _window = Nothing, _experimental = Nothing}, _trace = Nothing, _workspaceFolders = Nothing}} "expected Config, encountered String"

Following which lsp-ui completely stops working for me: code warnings / type information etc. stops working.


PS:
What I also see is that I'm hitting the hie process pretty hard after every keystroke. This overall makes typing really laggy.


What could be going on here?


System information:

GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.5) of 2019-09-13

Emacs lsp related packages:

lsp-mode           6.1           
lsp-ui             20191030.1350
lsp-haskell        20190602.825  dependency            Haskell support for lsp-mode

Relevant Bindings are stripped out of the type hole warning popup

When I hover on a type hole, I get a popup on the right side of the window with the type hole's shape, however the relevant bindings are stripped out of the popup. There is plenty of room on the screen to display the full warning.

To be honest, i'm not totally sure if this is an issue with LSP-Haskell or some other package in this tool chain.

I'm using spacemacs, LSP-Layer, Haskell-Layer, LSP-Haskell, and GHCIDE.

Can not complete?

haskell-lsp:no handler for. Object (fromList [("jsonrpc",String "2.0"),("params",Object (fromList [("textDocument",Object (fromList [("uri",String "file:///home/firstlove/tmp/a.hs")])),("position",Object (fromList [("line",Number 1.0),("character",Number 11.0)]))])),("method",String "textDocument/signatureHelp"),("id",Number 15.0)])

Here is the error message when complete. How can I deal with it?

Error when opening a .hs file(with lsp-ui)

The following message is added to *Messages* buffer :Error running timer ‘lsp-ui-sideline--run’: (wrong-type-argument hash-table-p nil) [2 times]
I'm havn't tracked down the problem, so I'm not sure if this problem is with lsp-haskell or lsp-ui.
Required init expressions are added to init.el
BTW, in GUI EMACS, the hover requests are not handled properly, whereas in terminal EMACS they show up normally.
OS: macOS High Sierra
EMACS version: emacs-mac 25.
hie built with master branch:Version 0.1.0.0, Git revision 9ad6d0c29ae1559202edba824453031fbc76ef8a (1170 commits) x86_64
Stack used system ghc 8.2.2

Install from melpa - no match

I have tried to install using package-install but it returns no match.
I used package-refresh-contents but lsp-haskell still doesn't seem present.

haskell-mode errors mix with lcp-haskell errors?

It seems that even when lcp-haskell has no errors to report, I am getting errors directly from haskell-mode (which reports errors that are not really there, since it does not care about stack project and extensions and similar).

I describe my situation more here: haskell/haskell-ide-engine#1544 .

I have to admit, I am not sure cause of the problem is what I mentioned above, but it is my best guess at the moment. I am going crazy here trying to debug this - if you could help me eliminate this as a cause or help me fix it, that would mean a lot! Thanks.

`lsp-haskell-server-wrapper-function` not being used?

Hello!

First, thanks for putting up this library! 🍻

I'm trying to use this with haskell-language-server inside a nix sandbox. I tried to set some wrappers (following along the lines of this gist). But, according to *lsp-haskell::stderr*, I was always getting the haskell-language-server-wrapper that is in my path, not inside my sandbox. Which fails due to GHC version mismatch.

Searching lsp-haskell.el, I could not find any places that are using lsp-haskell-server-wrapper-function, which is supposedly the key piece here.

The only way I got it working was to alter the :new-connection from lsp-register-client:

(lsp-register-client
  (make-lsp--client
   :new-connection (lsp-stdio-connection (lambda ()
                                           (apply
                                            lsp-haskell-server-wrapper-function ;; <--- had to add this
                                            (list (lsp-haskell--server-command)))))
    ...
    ))

... and then it correctly used the executable from inside my sandbox.

Is there something I'm missing? Or does this patch make sense?

Shouldn't hie-wrapper be started in the root directory?

I have a setup where my project looks like:

`- project
  `- backend
    `- project.cabal
    `- stack.yaml
  `- frontend
    `- stuff.js

Sadly, LSP Haskell fails to start in this setting, because hie-wrapper is started in the project directory, rather than in the backend directory.

lsp-haskell--get-root correctly returns the backend directory, but this function does not seem to be used, as much as it seems to be provided as a convenience for lsp-haskell-process-wrapper-function.

However, I wonder whether it would not always be preferrable to start hie-wrapper in the project returned by lsp-haskell--get-root. It would readily solve my issue, and I believe it would also work correctly for the "simpler" setup where the project directory is also the root directory.

Drop legacy lsp-mode?

Since there is no lsp-define-stdio-client in lsp-mode.el, when I (require 'lsp-mode) an error will raise.

lsp-haskell.el:172:26:Warning: reference to free variable ‘lsp-haskell’

In lsp-haskell--make-init-options:
lsp-haskell.el:203:29:Warning: reference to free variable
    ‘lsp-haskell--config-options’

In end of data:
lsp-haskell.el:299:1:Warning: the following functions are not known to be defined: lsp-get-start-position,
    lsp-get-end-position, lsp-define-stdio-client,
    lsp-haskell-set-completionSnippets
Wrote /Users/Nasy/.emacs.d/straight/build/lsp-haskell/lsp-haskell.elc
Recompiling /Users/Nasy/.emacs.d/straight/build/lsp-haskell/lsp-haskell.el...done
Error: (error (void-variable lsp-haskell))
  (byte-code "\302\10\303\304\11\305 !$\207" [lsp-haskell lsp-haskell-process-wrapper-function lsp-define-stdio-client "haskell" lsp-haskell--get-root lsp--haskell-hie-command] 6)
  (#<subr require> lsp-haskell nil t)
  (ad-Advice-require #<subr require> lsp-haskell nil t)
  (apply ad-Advice-require #<subr require> (lsp-haskell nil t))
  (require lsp-haskell nil t)
  (not (require 'lsp-haskell nil t))
  (if (not (require 'lsp-haskell nil t)) (display-warning 'use-package (format "Cannot load %s" 'lsp-haskell) :error))
  (progn (if (not (require 'lsp-haskell nil t)) (display-warning 'use-package (format "Cannot load %s" 'lsp-haskell) :error)) (add-hook 'haskell-mode-hook #'lsp) (add-hook 'lsp-after-open-hook #'(lambda nil (add-hook 'before-save-hook #'lsp-format-buffer nil t))))
  (condition-case err (progn (if (not (require 'lsp-haskell nil t)) (display-warning 'use-package (format "Cannot load %s" 'lsp-haskell) :error)) (add-hook 'haskell-mode-hook #'lsp) (add-hook 'lsp-after-open-hook #'(lambda nil (add-hook 'before-save-hook #'lsp-format-buffer nil t)))) ((debug error) (funcall use-package--warning88 :catch err)))
  (eval-buffer #<buffer  *load*> nil "/Users/Nasy/.emacs.d/init.el" nil t)
  (load-with-code-conversion "/Users/Nasy/.emacs.d/init.el" "/Users/Nasy/.emacs.d/init.el" t t)
  (load "/Users/Nasy/.emacs.d/init" noerror nomessage)
  (load-user-init-file #[0 "\10\303=\203\13\0\304\11\305Q\207\10\306=\204\26\0\304\11\307Q\207\310\304\311\312#\203 \0\313\207\310\304\311\314#\2032\0\315\316\317!D\nB\22\320\207\313\207" [system-type init-file-user delayed-warnings-list ms-dos "~" "/_emacs" windows-nt "/.emacs" directory-files nil "^\\.emacs\\(\\.elc?\\)?$" "~/.emacs" "^_emacs\\(\\.elc?\\)?$" initialization format-message "`_emacs' init file is deprecated, please use `.emacs'" "~/_emacs"] 4] #[0 "\301\302\303\304\10\305Q!\"\207" [init-file-user expand-file-name "init" file-name-as-directory "~" "/.emacs.d"] 6] t)
  (command-line)
  (normal-top-level)
Error (use-package): lsp-haskell/:catch: Symbol’s value as variable is void: lsp-haskell

Doesn't work with native json (which also means emacs 27 if correctly built)

Emacs 27 comes with fast native json support. However if emacs is built with this (check system-configuration-features for "JSON" entry) and lsp-use-native-json is t, starting the server results in an error and then nothing happens. This is the backtrace I got from having backtrace on error set to t.

Debugger entered--Lisp error: (wrong-type-argument json-value-p lsp-haskell--make-init-options)
  json-serialize((:jsonrpc "2.0" :method "initialize" :params (:processId 27696 :rootPath "/home/admin/TestProject/" :rootUri "file:///home/admin/TestProject/" :capabilities ((workspace (workspaceEdit (documentChanges . t) (resourceOperations . ["create" "rename" "delete"])) (applyEdit . t) (symbol (symbolKind (valueSet . ...))) (executeCommand (dynamicRegistration . :json-false)) (didChangeWatchedFiles (dynamicRegistration . t)) (workspaceFolders . t) (configuration . t)) (textDocument (declaration (linkSupport . t)) (definition (linkSupport . t)) (implementation (linkSupport . t)) (typeDefinition (linkSupport . t)) (synchronization (willSave . t) (didSave . t) (willSaveWaitUntil . t)) (documentSymbol (symbolKind (valueSet . ...)) (hierarchicalDocumentSymbolSupport . t)) (formatting (dynamicRegistration . t)) (codeAction (dynamicRegistration . t) (codeActionLiteralSupport (codeActionKind ...))) (completion (completionItem (snippetSupport . t) (documentationFormat . ...)) (contextSupport . t)) (signatureHelp (signatureInformation (parameterInformation ...))) (documentLink (dynamicRegistration . t)) (hover (contentFormat . ["markdown" "plaintext"])) (foldingRange (dynamicRegistration . t) (rangeLimit) (lineFoldingOnly)))) :initializationOptions lsp-haskell--make-init-options) :id 11) :null-object nil :false-object :json-false)
  lsp--make-message((:jsonrpc "2.0" :method "initialize" :params (:processId 27696 :rootPath "/home/admin/TestProject/" :rootUri "file:///home/admin/TestProject/" :capabilities ((workspace (workspaceEdit (documentChanges . t) (resourceOperations . ["create" "rename" "delete"])) (applyEdit . t) (symbol (symbolKind (valueSet . ...))) (executeCommand (dynamicRegistration . :json-false)) (didChangeWatchedFiles (dynamicRegistration . t)) (workspaceFolders . t) (configuration . t)) (textDocument (declaration (linkSupport . t)) (definition (linkSupport . t)) (implementation (linkSupport . t)) (typeDefinition (linkSupport . t)) (synchronization (willSave . t) (didSave . t) (willSaveWaitUntil . t)) (documentSymbol (symbolKind (valueSet . ...)) (hierarchicalDocumentSymbolSupport . t)) (formatting (dynamicRegistration . t)) (codeAction (dynamicRegistration . t) (codeActionLiteralSupport (codeActionKind ...))) (completion (completionItem (snippetSupport . t) (documentationFormat . ...)) (contextSupport . t)) (signatureHelp (signatureInformation (parameterInformation ...))) (documentLink (dynamicRegistration . t)) (hover (contentFormat . ["markdown" "plaintext"])) (foldingRange (dynamicRegistration . t) (rangeLimit) (lineFoldingOnly)))) :initializationOptions lsp-haskell--make-init-options) :id 11))
  lsp--send-request-async((:jsonrpc "2.0" :method "initialize" :params (:processId 27696 :rootPath "/home/admin/TestProject/" :rootUri "file:///home/admin/TestProject/" :capabilities ((workspace (workspaceEdit (documentChanges . t) (resourceOperations . ["create" "rename" "delete"])) (applyEdit . t) (symbol (symbolKind (valueSet . ...))) (executeCommand (dynamicRegistration . :json-false)) (didChangeWatchedFiles (dynamicRegistration . t)) (workspaceFolders . t) (configuration . t)) (textDocument (declaration (linkSupport . t)) (definition (linkSupport . t)) (implementation (linkSupport . t)) (typeDefinition (linkSupport . t)) (synchronization (willSave . t) (didSave . t) (willSaveWaitUntil . t)) (documentSymbol (symbolKind (valueSet . ...)) (hierarchicalDocumentSymbolSupport . t)) (formatting (dynamicRegistration . t)) (codeAction (dynamicRegistration . t) (codeActionLiteralSupport (codeActionKind ...))) (completion (completionItem (snippetSupport . t) (documentationFormat . ...)) (contextSupport . t)) (signatureHelp (signatureInformation (parameterInformation ...))) (documentLink (dynamicRegistration . t)) (hover (contentFormat . ["markdown" "plaintext"])) (foldingRange (dynamicRegistration . t) (rangeLimit) (lineFoldingOnly)))) :initializationOptions lsp-haskell--make-init-options) :id 11) #f(compiled-function (response) #<bytecode 0x1778579>) detached nil nil)
  lsp-request-async("initialize" (:processId 27696 :rootPath "/home/admin/TestProject/" :rootUri "file:///home/admin/TestProject/" :capabilities ((workspace (workspaceEdit (documentChanges . t) (resourceOperations . ["create" "rename" "delete"])) (applyEdit . t) (symbol (symbolKind (valueSet . [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26]))) (executeCommand (dynamicRegistration . :json-false)) (didChangeWatchedFiles (dynamicRegistration . t)) (workspaceFolders . t) (configuration . t)) (textDocument (declaration (linkSupport . t)) (definition (linkSupport . t)) (implementation (linkSupport . t)) (typeDefinition (linkSupport . t)) (synchronization (willSave . t) (didSave . t) (willSaveWaitUntil . t)) (documentSymbol (symbolKind (valueSet . [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26])) (hierarchicalDocumentSymbolSupport . t)) (formatting (dynamicRegistration . t)) (codeAction (dynamicRegistration . t) (codeActionLiteralSupport (codeActionKind (valueSet . ...)))) (completion (completionItem (snippetSupport . t) (documentationFormat . ["markdown"])) (contextSupport . t)) (signatureHelp (signatureInformation (parameterInformation (labelOffsetSupport . t)))) (documentLink (dynamicRegistration . t)) (hover (contentFormat . ["markdown" "plaintext"])) (foldingRange (dynamicRegistration . t) (rangeLimit) (lineFoldingOnly)))) :initializationOptions lsp-haskell--make-init-options) #f(compiled-function (response) #<bytecode 0x1778579>) :mode detached)
  lsp--start-workspace(#s(lsp-session :folders ("/home/admin/TestProject/") :folders-blacklist nil :server-id->folders #<hash-table equal 0/65 0x1886889> :folder->servers #<hash-table equal 1/65 0x191ae8d> :metadata #<hash-table equal 1/65 0x194ae7d>) #s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name) #<bytecode 0x1319171>) :test\? #f(compiled-function () #<bytecode 0x1319189>)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 0/65 0x1319195> :request-handlers #<hash-table equal 0/65 0x13192bd> :response-handlers #<hash-table eql 0/65 0x13192dd> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x13218c5> :action-handlers #<hash-table equal 0/65 0x1321f39> :major-modes (haskell-mode) :activation-fn nil :priority 0 :server-id hie :multi-root nil :initialization-options lsp-haskell--make-init-options :library-folders-fn nil :before-file-open-fn nil :initialized-fn nil :remote? nil :completion-in-comments? nil) "/home/admin/TestProject/" lsp-haskell--make-init-options)
  lsp--start-connection(#s(lsp-session :folders ("/home/admin/TestProject/") :folders-blacklist nil :server-id->folders #<hash-table equal 0/65 0x1886889> :folder->servers #<hash-table equal 1/65 0x191ae8d> :metadata #<hash-table equal 1/65 0x194ae7d>) #s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name) #<bytecode 0x1319171>) :test\? #f(compiled-function () #<bytecode 0x1319189>)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 0/65 0x1319195> :request-handlers #<hash-table equal 0/65 0x13192bd> :response-handlers #<hash-table eql 0/65 0x13192dd> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x13218c5> :action-handlers #<hash-table equal 0/65 0x1321f39> :major-modes (haskell-mode) :activation-fn nil :priority 0 :server-id hie :multi-root nil :initialization-options lsp-haskell--make-init-options :library-folders-fn nil :before-file-open-fn nil :initialized-fn nil :remote? nil :completion-in-comments? nil) "/home/admin/TestProject/")
  #f(compiled-function (client) #<bytecode 0x15b6d71>)(#s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name) #<bytecode 0x1319171>) :test\? #f(compiled-function () #<bytecode 0x1319189>)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 0/65 0x1319195> :request-handlers #<hash-table equal 0/65 0x13192bd> :response-handlers #<hash-table eql 0/65 0x13192dd> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x13218c5> :action-handlers #<hash-table equal 0/65 0x1321f39> :major-modes (haskell-mode) :activation-fn nil :priority 0 :server-id hie :multi-root nil :initialization-options lsp-haskell--make-init-options :library-folders-fn nil :before-file-open-fn nil :initialized-fn nil :remote? nil :completion-in-comments? nil))
  mapcar(#f(compiled-function (client) #<bytecode 0x15b6d71>) (#s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name) #<bytecode 0x1319171>) :test\? #f(compiled-function () #<bytecode 0x1319189>)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 0/65 0x1319195> :request-handlers #<hash-table equal 0/65 0x13192bd> :response-handlers #<hash-table eql 0/65 0x13192dd> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x13218c5> :action-handlers #<hash-table equal 0/65 0x1321f39> :major-modes (haskell-mode) :activation-fn nil :priority 0 :server-id hie :multi-root nil :initialization-options lsp-haskell--make-init-options :library-folders-fn nil :before-file-open-fn nil :initialized-fn nil :remote? nil :completion-in-comments? nil)))
  -map(#f(compiled-function (client) #<bytecode 0x15b6d71>) (#s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name) #<bytecode 0x1319171>) :test\? #f(compiled-function () #<bytecode 0x1319189>)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 0/65 0x1319195> :request-handlers #<hash-table equal 0/65 0x13192bd> :response-handlers #<hash-table eql 0/65 0x13192dd> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x13218c5> :action-handlers #<hash-table equal 0/65 0x1321f39> :major-modes (haskell-mode) :activation-fn nil :priority 0 :server-id hie :multi-root nil :initialization-options lsp-haskell--make-init-options :library-folders-fn nil :before-file-open-fn nil :initialized-fn nil :remote? nil :completion-in-comments? nil)))
  lsp--ensure-lsp-servers(#s(lsp-session :folders ("/home/admin/TestProject/") :folders-blacklist nil :server-id->folders #<hash-table equal 0/65 0x1886889> :folder->servers #<hash-table equal 1/65 0x191ae8d> :metadata #<hash-table equal 1/65 0x194ae7d>) (#s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name) #<bytecode 0x1319171>) :test\? #f(compiled-function () #<bytecode 0x1319189>)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 0/65 0x1319195> :request-handlers #<hash-table equal 0/65 0x13192bd> :response-handlers #<hash-table eql 0/65 0x13192dd> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x13218c5> :action-handlers #<hash-table equal 0/65 0x1321f39> :major-modes (haskell-mode) :activation-fn nil :priority 0 :server-id hie :multi-root nil :initialization-options lsp-haskell--make-init-options :library-folders-fn nil :before-file-open-fn nil :initialized-fn nil :remote? nil :completion-in-comments? nil)) "/home/admin/TestProject/" nil)
  lsp--try-project-root-workspaces(nil nil)
  lsp()
  run-hooks(change-major-mode-after-body-hook prog-mode-hook haskell-mode-hook)
  apply(run-hooks (change-major-mode-after-body-hook prog-mode-hook haskell-mode-hook))
  run-mode-hooks(haskell-mode-hook)
  haskell-mode()
  set-auto-mode-0(haskell-mode nil)
  set-auto-mode()
  normal-mode(t)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer Main.hs> "~/TestProject/src/Main.hs" nil nil "~/TestProject/src/Main.hs" (2805026 2049))
  find-file-noselect("/home/admin/TestProject/src/Main.hs" nil nil nil)
  find-file("/home/admin/TestProject/src/Main.hs")
  dired-find-file()
  funcall-interactively(dired-find-file)
  call-interactively(dired-find-file nil nil)
  command-execute(dired-find-file)

Implement 21444:eval:evalCommand

Describe the bug
The haskell-language-server eval feature is unsupported.

To Reproduce
Attempt to evaluate the code lens appearing over
-- >>> 1 + 1

in a Haskell file with a working lsp session.

Expected behavior
The evaluation result should appear as a comment under the expression line

Which Language Server did you use
haskell-language-server

OS
NixOS

Error callstack
(error "BadDependency "GhcSessionDeps"")
LSP :: Please open an issue in lsp-mode for implementing `21444:eval:evalCommand'.

release first version of lsp-haskell

There has not yet been a tagged release of lsp-haskell. I'll update lsp and lsp-ui for Debian to 6.0 the next days. Is the current lsp-haskell master branch expected to work with this versions?

lsp fails to start

When I try to start lsp following error message pops up:
image

Eval: lsp-haskell-server-path
"haskell-language-server-wrapper"

I am using doom Emacs with
:tools
lsp
:lang
(haskell +lsp +dante)

dante works fine, but I would like to have the lsp functionality too.

According to the README following should be sufficient
:tools
lsp
:lang
(haskell +lsp)

I have installed the server with ghcup.
Executing haskell-language-server-wrapper in the terminal gives some output, which I assume looks like it works.

I would appreciate some advice on this topic.

Enable hlint on multi projects by default

Is there a way of enabling hlint by default? I could not figure out how.
It seems there is no way of setting this within my .emacs file.
I know that I can call lsp-haskell-set-hlint-on on every file or setting file-local-variables (maybe even dir-local-variables?, though being unable to setting it up); but I want hlint being enabled always anyway.

Confusion on setting `lsp-haskell-server-wrapper-function`

Hello,

I've been trying to get doom + haskell language server working with nix and cabal. I need the language server to start in the nix-shell, so I made the following change to config.el:

;; suggested at https://github.com/emacs-lsp/lsp-haskell/blob/4d85cb3693d893ec34d8a0be9794d468a0a28b7b/lsp-haskell.el#L110
(setq lsp-haskell-server-wrapper-function
      (lambda (argv)
        (append
         (append (list \"nix-shell\" \"-I\" \".\" \"--command\" )
                 (list (mapconcat 'identity argv \" \"))
                 )
         (list (concat (lsp-haskell--get-root) \"/shell.nix\")))))

Note that executing nix-shell works fine. However, I'm still getting the following error in *lsp-haskell::stderr*:

"Error when calling cabal v2-exec ghc -v0 -- --numeric-version"

Which executes fine in nix-shell from the command line:

$ nix-shell -I . --command "cabal v2-exec ghc -v0 -- --numeric-version"
8.8.4

tried various different things to get this working, so far no luck. Any suggestions? Thanks!

Support Language Server Index Format files

Since GHC 8.8+ can now generate Language Server Index Format files via hie-lsif, lsp-haskell supporting them would allow performant lsp features without having to install language servers or having potentially slow language servers running.

This is especially great since Haskell IDE Engine has had performance issues according to many and in my own experience trying to use it. Though there are work arounds such as killing it when it goes over 2GB of memory, that can cause system slowdowns that are a liability to workday productivity.

I believe this is the proper place for supporting these files in emacs, let me know if not.

As a starting point, I guess looking at the vscode blog post for lsif, the LSIF specification, and potentially the vscode-lsif-extension forked to add Haskell support by @mpickering.

Any direction in implementing this or what would be involved in implementing it is much appreciated.

emacs freeze or slow

Hi,
When I use emacs with hie and haskell-lsp then I get an error message (only just Db.hs file):
2017-11-28 06:47:30.437606502 [ThreadId 8] - <--2--{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":1,"message":"haskell-lsp:no handler for. Object (fromList [("jsonrpc",String "2.0"),("params",Object (fromList [("reason",Number 2.0),("textDocument",Object (fromList [("uri",String "file:///home/lbodnar/Projects/Haskell/WebAdmin.haskell/src/Db.hs")]))])),("method",String "textDocument/willSave")])"}}
Sometimes emacs is freezy and I have to restart it.
What causes the problem ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.