Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completion broken in many modes #1045

Closed
6 tasks done
trishume opened this issue Apr 3, 2015 · 22 comments
Closed
6 tasks done

Completion broken in many modes #1045

trishume opened this issue Apr 3, 2015 · 22 comments

Comments

@trishume
Copy link
Contributor

trishume commented Apr 3, 2015

769d54d broke completion in many modes where the package itself has special functionality to configure autocomplete.

This issue tracks which modes used to be working and now do not and which have been fixed using Github's fancy checkbox feature:

  • Uses a built in function to manipulate company-backends
    • Auctex
    • Racket
  • Were using default company-backends backends
    • CSS
    • Ctags/Gtags
  • Benefited greatly from backend fallback
    • Ledger: Fell back on company-capf backend
    • Ruby: Without robe server (not possible for all projects) gets no auto-complete

Most of these should be pretty easy to fix. In fact I haven't actually tested that all these are broken but based on my knowledge of the current Spacemacs codebase they will be.

As these are fixed I will check them off on the list. Comment if I miss a fix and I'll add it.

trishume referenced this issue Apr 3, 2015
Move company and auto-complete to a common layer.
They are not enabled globally anymore, each mode using them
must explicitly declare a hook.
Only one frontend is supported for a given mode, we have to
choose the best between the two.
Only one key binding to toggle auto-completion on `SPC t a` no
matter if it is company or auto-complete. The lighter in the
mode-line is Ⓐ for both frontends.
@syl20bnr
Copy link
Owner

syl20bnr commented Apr 4, 2015

Excellent list 👍
I'm going to fix them.

@PierreR
Copy link
Contributor

PierreR commented Apr 5, 2015

  • Haskell

As mentioned in #1046, it does not work in haskell-mode either.

I do get the Ⓐ but completion never pops up anymore

If I use SPC t a twice (disable and enable again), then I have got some completion back (such as for fmap). Unfortunately even then I don't get company-dabbrev-code completion

To nail the problem a little bit more if I add company-dabbrev-code manually here with:

      :init (push '(company-ghc :with company-yasnippet company-dabbrev-code)

then I have company-dabbrev-code working at the start but I still have to do the SPC t a dance twice to get company-ghc.

As an aside, how can I add a company backend without modifying the contrib file ? I used to add this line in my .spacemacs but it currently fails in the develop branch:

(add-hook 'haskell-mode-hook (lambda ()
  (add-to-list 'company-backends '(company-ghc :with company-dabbrev-code))))

If I may another aside, it would be nice to add a keybinding for canceling/aborting (ESC ?) because c-g does not fit so well with the spacemacs philosophy I would argue.

@syl20bnr
Copy link
Owner

syl20bnr commented Apr 7, 2015

@PierreR you have to push in company-backends-haskell-mode. Spacemacs defines custom list of backends per mode.
I tested a bit and it seems that :with company-yasnippet prevent ghc-company from displaying candidates the first time. I removed it for now, can you try the last develop ?
Also note that the other backends you mentioned are now added by default so it should work. But if you have a better setup feel free to PR :-)

trishume added a commit to trishume/spacemacs that referenced this issue Apr 7, 2015
Adds support for ruby, auctex, css, ledger and gtags with new
auto-completion infrastructure. Ticks off many things in syl20bnr#1045
@PierreR
Copy link
Contributor

PierreR commented Apr 9, 2015

I have just updated (to cef3ca6) and it is actually worse ... When starting spacemacs, the first opening file works fine (completion works as described), then it won't work for all other buffers (same haskell mode).

This is easy to reproduce. Open an haskell file, try completion (OK), open another haskell file, try completion (KO). It does not matter which file you pick first.

I will try to bisect to see when the problem occurs.

@PierreR
Copy link
Contributor

PierreR commented Apr 9, 2015

This is happening since 68ea365 ... The current situation is actually worse because there is no workaround anymore (the disable, enable dance is annoying but at least it makes completion work for all buffers ...)

@trishume
Copy link
Contributor Author

trishume commented Apr 9, 2015

Only Haskell left, almost there :D

@syl20bnr
Copy link
Owner

syl20bnr commented Apr 9, 2015

OMG............... How can I be so stupid on this. I reproduced the same flaw as actual company by enabling it globally........ crap.

There is no middle ground possible then, either going global company all the way down with global backend, either going the isolated company route.

For now I disable the global company but I have to give it some thought.

@syl20bnr
Copy link
Owner

syl20bnr commented Apr 9, 2015

@PierreR Get the last develop and it will be good. Sorry for the regressions. (don't forget to restart Emacs).

@PierreR
Copy link
Contributor

PierreR commented Apr 9, 2015

Euh no still no luck. Exactly the same symptoms. I did restart emacs ... I know the guy behind company is quite responsive ...

@trishume
Copy link
Contributor Author

trishume commented Apr 9, 2015

@syl20bnr I don't get it, what about global company interferes? The new infrastructure will override global company with its own backends list so having global company shouldn't matter, right?

@syl20bnr
Copy link
Owner

@PierreR @trishume I found the issue, it was a hook order issue. It should be OK in Haskell and the other languages, I was also able to add back company-yasnippet.

@PierreR Can you test again the last develop ? :-)

@syl20bnr
Copy link
Owner

I don't seem to be able to make company-ghc backend to work on my config :-(
Tried on several Haskell project, it seems that only the fallback backends are giving candidates.
I have also systematically ghc-check failure (display failed in the mode-line).

@PierreR
Copy link
Contributor

PierreR commented Apr 10, 2015

At first sight, it seems OK on my side. I will keep you updated.

Cheers

@carlosgaldino
Copy link
Contributor

develop should have the fixes for ruby-mode? Because I'm running in the develop branch with everything updated and still don't have auto complete in Ruby. OTOH things look good for Haskell.

@trishume
Copy link
Contributor Author

@carlosgaldino what kind of auto-completion are you expecting? I get basic buffer completion in Ruby with develop.

Do you have the auto-completion layer installed?

@carlosgaldino
Copy link
Contributor

@trishume I was expecting to have the same auto completion stuff I have when I'm writing other languages like existing variables/function names from the buffer I'm or any other buffer that I already opened. At least this is what I get when I'm in an .hs file.

@trishume
Copy link
Contributor Author

@carlosgaldino you should get that, I certainly do. Do you have anything like an inf-ruby process running? Does it show the autocompletion 'a' in the modeline? Do you get any auto-completion popups ever? What do you get when you type SPC : eval-expression RET company-backends?

To help with a problem I can't reproduce I'm going to need a lot more info than just that it happens, sorry for all the questions.

@carlosgaldino
Copy link
Contributor

@trishume Sure and is better that you ask the questions because I'm new to this and have no idea on what useful information I could give.

So, the output for company-backends is: (company-bbdb company-nxml company-css company-eclim company-semantic company-clang company-xcode company-cmake company-capf (company-dabbrev-code company-gtags company-etags company-keywords) company-oddmuse company-files company-dabbrev)

Just an FYI, the output when I'm in a Haskell file is the following: ((company-ghc company-dabbrev-code company-yasnippet) (company-dabbrev-code company-gtags company-etags company-keywords) company-files company-dabbrev)

The 'a' doesn't appear when I'm in a Ruby file but it does show when it's a Haskell file.

And I'm not sure about what you mean by "inf-ruby process running", could you explain?

Thank you.

@trishume
Copy link
Contributor Author

@carlosgaldino got it, thanks for the help. I wasn't experiencing it because I enabled fallback global completion for modes without proper setup, and the ruby setup was missing something. Fixed with #1225.

@carlosgaldino
Copy link
Contributor

Thanks @trishume. I commented on #1225 that your patch fixes the problem.

@trishume
Copy link
Contributor Author

And with that this bug should be done.

@syl20bnr
Copy link
Owner

👍

kryptt pushed a commit to kryptt/spacemacs that referenced this issue Sep 6, 2015
Adds support for ruby, auctex, css, ledger and gtags with new
auto-completion infrastructure. Ticks off many things in syl20bnr#1045
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants