Comments (9)
Fixed by:
(add-hook! 'haskell-mode-hook
(setq lsp-haskell-process-args-hie (list "-d" "-l" "/tmp/hie.log" "-r" (haskell-cabal-find-dir))))
I feel like this could be the default value.
from lsp-haskell.
Had the same issue.
I also had to clear the .emacs.d/.lsp-session-v1 cache to remove prior incorrect root information.
from lsp-haskell.
Looking in lsp-mode
, it seems that this issue comes up frequently. Their position seems to be:
- You should get an interactive choice of root, which gives you the option to pick where the right root is.
- As far as
lsp-mode
guessing the root goes, they delegate toprojectile
which apparently has hooks for configuring that.
So I think we shouldn't implement logic ourselves for this.
from lsp-haskell.
Note: this was harder than I thought.
Essentially you need to modify lsp-haskell-process-wrapper-function
before the Haskell mode starts, so that the command sent to the server is correct.
But the value of lsp-haskell--get-root
is .
until the Haskell mode has started.
My personal workaround is to have a hook to set lsp-haskell-process-wrapper-function
before the Haskell mode starts, defining it as:
(lambda (argv)
(append argv (list "-r" (haskell-cabal-find-dir default-directory))))
from lsp-haskell.
Somehow things seem worse now. When I enter a Haskell buffer, lsp-haskell--hie-command
seems to be called twice:
- once from the file that I opened (in which case my workaround works)
- then, a second time, from my project directory (which is bad: I no longer know which file is being processed)
from lsp-haskell.
The following repository lets one reproduce the issue:
https://github.com/Ptival/mock-haskell-project-02/tree/7b3e875347bae083ec5975e1b32dfea9373c439d
If you try to open a Haskell file from this repository, HIE will be started in the root directory, rather than in the not-root
directory, and thus will fail to figure out which GHC to use and crash.
from lsp-haskell.
The main issue I see is that LSP runs commands from the projectile project root, but hie-wrapper needs to be ran either from the directory that contains the cabal file, or be given such directory with the -r
option.
from lsp-haskell.
The behaviour in hie/ghcide/hls changed, it used to detect from the root directory given in the LSP protocol initialisation, but now expects to be in the given directory. Will update.
from lsp-haskell.
I'm using hls 0.3.0 and there seems no "-r" option but the following worked for me:
(add-hook 'haskell-mode-hook
(lambda ()
(setq lsp-haskell-process-args-hie (list "-d" "-l" "/tmp/hie.log" "--cwd" (haskell-cabal-find-dir)))))
from lsp-haskell.
Related Issues (20)
- Symbol’s function definition is void: lsp-haskell-completion-in-comments HOT 1
- Installation issue HOT 3
- Document (?) how to change the `eldoc` signature HOT 10
- Headscratching class plugin experience HOT 9
- haskell-language-server-wrapper from emacs behaviors is different from command line HOT 3
- Hlint HOT 3
- (void-variable lsp-haskell-formatting-provider) HOT 2
- lsp haskell incredibly slow on latest emacs git HOT 12
- lsp-server exits with status 'exit' HOT 1
- Error in $.params.processId: parsing Int32 failed, expected Number, but encountered Object HOT 5
- README missing a step? HOT 3
- Symbol’s value as variable is void: haskell-debug-mode-map HOT 6
- Question: how can I get rid of "Processing" message from modeline HOT 3
- Timeout while waiting for response Method: textDocument/codeAction HOT 2
- Activate on haskell-cabal mode also HOT 1
- Try both `haskell-language-server-wrapper` and `haskell-language-server` by default
- Lisp error: (void-variable fourmolu) HOT 10
- [QUESTION] Line breaker after constraints for type lenses HOT 1
- Don't use the debug flag by default. HOT 3
- How to make lsp-haskell more loosely tied to haskell-mode? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lsp-haskell.