iquiw / company-ghc Goto Github PK
View Code? Open in Web Editor NEWCompany-mode completion back-end for haskell-mode via ghc-mod
Company-mode completion back-end for haskell-mode via ghc-mod
If I’m typing a word, and the Company-Mode completions pop-up appears,
and the active completion back-end is company-ghc
, the completions
pop-up appears to be properly populated, but it disappears soon after
appearing, and the following error message is logged:
Company: An error occurred in post-command
Company: Front-end company-echo-metadata-frontend error "Company: Back-end company-ghc error "Wrong type argument: stringp, nil" with args (meta putChar)" on command post-command
company-ghc-diagnose
’s output seems fine:
* company-ghc backend found: company-ghc
* automatic scan module is enabled
* ghc-boot process has been done
Module Alias Candidates
-------------------------------------------------------------------------------
Prelude - 212
Hi there,
I'm not sure if this is exactly company-ghc's fault but I don't know where else to go, so feel free to point me somewhere else if needed :)
I'm working on the scheme48hours and interactive haskell hangs on me when I start a scheme repl from within the cabal repl. I have to kill ghc and then I either see this in Messages
Company: An error occurred in auto-begin
Wrong type argument: stringp, nil
or I get 1k lines of completions shown in the haskell process log. Either way I have to kill ghc and emacs starts responding only afterwards.
Steps to reproduce (on my machine at least):
C-c C-l
to load the file in the REPLrunRepl
to start the scheme replIn case you really go down testing this and want the code I have then here it is, the current master [0fc2d53] is the one you should clone.
To make the listing full, here are my versions:
Hi,
company-ghc
works great for autocompleting candidates in Prelude and other modules I import, but for some reason doesn't autocomplete candidates in the file I'm working in. To make a contrived example, when I have the code:
lastDigit :: Integer -> Integer
lastDigit n = n `mod` 10
When I write "las", there's no completion for lastDigit
:
getLastDigit :: Integer -> Integer
getLastDigit n = las...
Is this by design or am I doing something wrong? Thanks in advance for the help, other than with this problem I'm loving company-ghc
:)
Since ghc-modi browse
now supports -o
option to browse operators, it can be achieved.
Upon running company-ghc-diagnose
all modules get loaded, but no candidates appear, and ghc-mod
reports no errors either:
Further investigation shows that ghc-mod browse
can see the symbols exported without problems:
On a side-note, ghc-mod boot
shows all modules but very few names compared to what ghc-mod browse
does. However, none of those functions show up as candidates in the diagnose!
You can use the repository https://github.com/kerscher/preliminaries to try to reproduce.
The library is not on Hackage, yet.
I am a new emacs user trying to get along with spacemacs. I have ghc-mod
installed. When I run company-ghc-diagnose
, I see this output:
* company-ghc backend not found
* automatic scan module is disabled.
You need to run either 'M-x company-ghc-turn-on-autoscan' once
or 'M-x company-ghc-scan-modules' when it is necessary.
* ghc-boot process has not been done
I am hoping some documentation can be added to the Diagnostic section of the README for a next step to resolve this issue.
Hi,
company-ghc
is constantly Loading symbols for XX ...
while I type. Always the same modules (below).
company-ghc-diagnose
:
* company-ghc backend found: (company-ghc :with company-dabbrev-code)
* automatic scan module is enabled
* ghc-boot process has been done
Module Alias Candidates
-------------------------------------------------------------------------------
Types.Plan - nil
Types.MobNet - nil
Types.Invoice - nil
Types.Event - nil
StdImports - 1250
MobNets.Extract - nil
Prelude - 212
diagnose shows several modules with nil
for candidates. Is it my config?
br,
vlatko
A crosspost: company-mode/company-mode#226
Hi,
company-ghc-diagnose
shows no items when invoked first and suggests:
* company-ghc backend found: company-ghc
* automatic scan module is disabled.
You need to run either 'M-x company-ghc-turn-on-autoscan' once
or 'M-x company-ghc-scan-modules' when it is necessary.
* ghc-boot process has been done
However, :f1 v company-ghc-autoscan
gives:
company-ghc-autoscan is a variable defined in `company-ghc.el'.
Its value is t
After manually invoking company-ghc-scan-modules
, company-ghc-diagnose
shows found modules and candidates.
Emacs 24.5.1 on Arch, current company-ghc from gitHub
br,
vlatko
In spacemacs
with stack
(I don't know if this is related to how ghc-mod
integrates stack
), the completion will be unbearably slow as soon as the import list is too big (~ 25 items).
Is there any known trick to avoid the problem (apart from disabling company-ghc
) at that point ?
Thanks for your help.
Hi there, I am trying to set up company-ghc in Aquamacs and I get this error/warning when starting up aquamacs. Does anyone know what am I missing? Thanks.
Warning (initialization): An error occurred while loading `/Users/yoelusa/.emacs':
Symbol's value as variable is void: company-backends
To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file. Start Emacs with
the `--debug-init' option to view a complete error backtrace.
I have this configuration on ``~/.emacs`
;; Melpa
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa-stable.milkbox.net/packages/"))
(package-initialize)
(autoload 'ghc-init "ghc" nil t)
(autoload 'ghc-debug "ghc" nil t)
(autoload 'company-mode "company" nil t)
(add-hook 'haskell-mode-hook (lambda () (ghc-init)))
(add-hook 'after-init-hook 'global-company-mode)
(add-to-list 'company-backends 'company-ghc)
The company-ghc-diagnostic-info
cmd shows this
* company-ghc backend not found
* automatic scan module is disabled.
You need to run either 'M-x company-ghc-turn-on-autoscan' once
or 'M-x company-ghc-scan-modules' when it is necessary.
* ghc-boot process has been done
Module Alias Candidates
-------------------------------------------------------------------------------
The ghc-debug
cmd shows this
...
Version: all versions must be the same.
ghc.el version 0
ghc-mod version 4.1.6 compiled by GHC 7.8.3
ghc-modi version 4.1.6 compiled by GHC 7.8.3
The Glorious Glasgow Haskell Compilation System, version 7.8.3
...
Hey,
this looks really awesome, adding a company backend for ghc-mod has been on my TODO list for ages now, looks like you did it better than I could have if i tried ;) I'm one of the maintainers of ghc-mod and I was wondering if you might want this to be merged into ghc-mod itself? We're about to do some major elisp code cleanup so this might be just the right time to do it if you want to.
Is there any reason to not showing type info in completion annotation? Similar to company-ghc-show-module
but company-ghc-show-type-info
It could be very useful.
Citing from the the tool's site [1]:
Company-flex only works with the company-capf backend. Most sources use this backend, with the exception of the more advanced sources. Most backends should be re-written in terms of completion-at-point-functions eventually, although it's going to take a while.
Is it possible that company-ghc use capf?
I keep getting the "Visit tags table (default TAGS)" dialog whenever company-ghc tries to do code completion.
I had a search and found this for company mode https://github.com/company-mode/company-mode/issues/333
The followiing is the result of M-x describe-variable completion-at-point-function
completion-at-point-functions's value is (haskell-completions-completion-at-point t)
Local in buffer Main.hs; global value is
(tags-completion-at-point-function)
I have ghc-mod 5.5.0.0 installed with stack. What do I have to do to stop this behaviour ?
I am not sure if I should raise this issue somewhere else, but company-mode
seems to conflict with haskell-interactive-mode
.
To reproduce:
(setq debug-on-error t)
haskell-mode
, type something, company
is working finehaskell-process-load-or-reload
, and enter haskell-interactive-mode
haskell-mode
, in the beginning of line ,type something, debugger window pops out.The abridged error message in my case is below:
Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
haskell-interactive-at-prompt()
haskell-interactive-mode-completion-at-point-function()
completion--capf-wrapper(haskell-interactive-mode-completion-at-point-function optimist)
run-hook-wrapped(completion--capf-wrapper haskell-interactive-mode-completion-at-point-function optimist)
company--capf-data()
company-capf(prefix)
#[0 "\n\203 ...
company--begin-new()
company--perform()
#0 "\300 \207" [company--perform] 1 "\n\n(fn)"
funcall(#[0 "\300 \207" [company--perform] 1 "\n\n(fn)"])
company-auto-begin()
company-idle-begin(# #<window 3 on Main.hs> 2490 3405)
apply(company-idle-begin (# #<window 3 on Main.hs> 2490 3405))
byte-code("r\301�\302H�\303H"\210)\301\207" [timer apply 5 6] 4)
timer-event-handler([t 21441 4252 273797 nil company-idle-begin (# #<window 3 on Main.hs> 2490 3405) nil 0])
read-event(nil t 3)
sit-for(3)
flyspell-check-word-p()
byte-code("\306� ...
flyspell-post-command-hook()
Currently, company-ghc borrows ghc-mod variables and modifies them by adding text properties.
It is not polite.
I would like to change it by communicating with ghc-modi
directly via ghc-sync-process
.
Once after ghc-modi
supports "-d" and "-o" options like ghc-mod
, we can remove call of ghc-get-info
and add operators into candidates.
One down side is we may have duplicate set of keywords in ghc-mod and company-ghc.
Hi!
I've been unable to successfully use company-ghci. Running
company-ghc-diagnose
shows nil and 0 completions:
company-ghc backend found: company-ghc
automatic scan module is enabled
Module Alias Candidates
-------------------------------------------------------------------------------
Seraph.Types - nil
Debug.Trace - nil
MVC - nil
Data.Set S nil
Data.Maybe - 0
Data.Map M nil
Control.Monad.Writer.Strict - nil
Control.Monad.State.Strict - nil
Control.Lens - nil
Prelude - 0
Before you invite me to RTFM, I have read the troubleshooting steps on
this: M-: (setq ghc-debug t)
and then M-x ghc-debug
. Nothing jumps
out me as erroneous:
% ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.8.3
% ghc-mod version
ghc-mod version 5.0.1 compiled by GHC 7.8.3
% ghc-modi version
ghc-modi version 5.0.1 compiled by GHC 7.8.3
I'm using flycheck-haskell and haskell-mode. I'm happy to provide any
additional details you find necessary and thankk you in advance for
any help you can provide with debugging.
* company-ghc backend found: company-ghc
* automatic scan module is enabled
* ghc-boot process has not been done
Module Alias Candidates
-------------------------------------------------------------------------------
Prelude - nil
As the diag above, though company-ghc is added to backend, ghc-boot process cannot been done. What should I do?
My config:
(add-to-list 'company-backends 'company-ghc)
(set-company-backend! 'haskell-mode
'company-ghc)
(add-hook 'haskell-mode-hook 'eglot-ensure)
I'd like to be able to type something like C.M.Re
and get Control.Monad.Reader
. Or rather, C.M
and have Control.Monad
show up in the completion list.
If I understood the code correctly, this requires us not to use all-completions
.
This might be an edge case, and might also be doable by other means, but I was hoping you'd be able to help - when my current module isn't compilable, I lose the ability to complete identifiers from the current module. This is a bit jarring. Might it be possible to have a fallback mode where the tokenised words are used as completion sources when ghc-mod fails to parse the file? Can I achieve this goal by some other company-mode plugin?
Hi there,
It looks like the MELPA package is gone:
https://melpa.org/#/company-ghc
FWIW the "haskell" layer of Spacemacs seems to pull that package (and fails at doing so)
Hi,
I'm trying to get company-ghc to work, but without success. The diagnostic reports:
* company-ghc backend found: company-ghc
* automatic scan module is enabled
* ghc-boot process seems to have failed
Module Alias Candidates
-------------------------------------------------------------------------------
Prelude - 0
So I applied the recommendations:
inst
and it goes to instance
)ghc-mod boot
on the command line does work and gives a huge list of identifiers% ghc-mod root
/Users/etanter/Develop/Haskell
% boot
% check /Users/etanter/Develop/Haskell/Arboles.hs
% check /Users/etanter/Develop/Haskell/Arboles.hs
I find it strange that it says boot
above and not ghc-mode boot
. Could it be the problem? if so, where to fix that?
If not, any idea? Something I can do to dig into the matter?
thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.