Closed mwotton closed 9 years ago
I agree we need better handling in such case by ghc-mod
, by company-ghc
, or both.
I have no specific idea for now though.
As for the last question, company-dabbrev-code
might help, which is included in company-mode.
Quote from docstring:
dabbrev-like `company-mode' back-end for code.
The back-end looks for all symbols in the current buffer that aren't in
comments or strings."
See https://github.com/iquiw/company-ghc#4note for the example setting.
beautiful, that did the trick. Unfortunately it seems to extend it to all buffers - ie, anything that's in any currently open buffer is a target, which isn't quite what I want. Still, too many options is better than not enough. Thanks!
company-backends
can be buffer local.
If you set it by e.g. M-: (setq-local company-backends '(company-dabbrev-code))
, it won't affect to other buffers.
Sorry, I misunderstood your comment.
I think company-dabbrev-code-other-buffers
can control the behavior though I have not tried it.
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?