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

New dabbrev completions too eager #741

Closed
geraldus opened this issue Jul 1, 2015 · 20 comments
Closed

New dabbrev completions too eager #741

geraldus opened this issue Jul 1, 2015 · 20 comments

Comments

@geraldus
Copy link
Contributor

geraldus commented Jul 1, 2015

Currently I'm writing some GHCJS code and didn't setup interactive version yet, so I always have dabbrev completions. With 10-20 opened buffers dabbrev completion method becomes too eager already, i.e. completions takes too long. It is possible to limit dabbrev list of buffers to search completions. For example, try to lookup nearest folder contains .git, or .cabal file, set some haskell-completions-top-folder local var, and when searching dynamic abbrevs take this var in account. When session is available, search for d-abbrevs in buffers assigned to current session.

What do you think?

@gracjan
Copy link
Contributor

gracjan commented Jul 1, 2015 via email

@geraldus
Copy link
Contributor Author

geraldus commented Jul 1, 2015

If you don't use company-mode I think you does not encounter this issue. Here is a little demo. Company mode, no REPL (hence completions are always comes from dynamic abbrevs), 50 buffers opened.

@geraldus
Copy link
Contributor Author

geraldus commented Jul 5, 2015

If someone want to fix this before I find a time this might be helpful dabbrev.el.

@gracjan
Copy link
Contributor

gracjan commented Jul 24, 2015

@geraldus: Why do you use dabbrev--reset-global-variables? It is here:

(dabbrev--reset-global-variables)

As I understand dabbrev has some caching mechanism to speed up expansions, resetting kills this optimization. Or am I mistaken?

@gracjan
Copy link
Contributor

gracjan commented Jul 24, 2015

@geraldus: My point about M-/ was that company-mode should NOT use dabbrev as source. I envision it like this:

  • company-mode uses only contextual sources for completions: :complete, PRAGMA, import
  • M-/ uses non-contextual sources for completions: abbrev, dabbrev

So 'smart' stuff is for company/completion, non-smart for dabbrev. Am I mistaken?

@cocreature
Copy link
Contributor

@gracjan I agree if people want to use dabbrev via company mode they can still add it themselves but I am not sure what we gain by doing that from haskell mode.

@geraldus
Copy link
Contributor Author

Sometimes REPL is not running for some reason (in my case there is no GHCJSi available yet) or user just does not want to run it, that is, :complete command is not available too. So how company should look up completions?

@gracjan
Copy link
Contributor

gracjan commented Jul 24, 2015

@geraldus: My (original) company setup has this part:

...
Company Backends:
INS DEL Back-end: Value Menu completion-at-point-functions
INS DEL Back-end: Value Menu Merged Back-ends:
            INS DEL Back-end: Value Menu dabbrev for code
            INS DEL Back-end: Value Menu GNU Global
            INS DEL Back-end: Value Menu etags
            INS DEL Back-end: Value Menu Programming language keywords
            INS
INS DEL Back-end: Value Menu Oddmuse
INS DEL Back-end: Value Menu Files
INS DEL Back-end: Value Menu dabbrev for plain text

Does this mean dabbrev is just handled by company-mode and there is no need to do anything about it inside haskell-mode?

@gracjan
Copy link
Contributor

gracjan commented Jul 24, 2015

@geraldus: If interpreter is not running then :complete is not an available source. What is left is of the semantic sources, currently PRAGMA, LANGUAGE and that is enough. Someday we might add more sources

dabbrev is available always as M-/, so nothing is lost.

@gracjan
Copy link
Contributor

gracjan commented Jul 24, 2015

@cocreature: How do they 'add it themselves'? It is of vital importance to me that stuff works out of the box as it should.

@cocreature
Copy link
Contributor

@gracjan IIRC there is a company-dabbrev backend built into company mode so you can just add that to your backend. Looking at it we don't seem to provide a company backend atm, so I am not quite sure how to easily combine them. Of course it is important that stuff works out of the box, but to be frank the current dabbrev integration doesn't work (well enough). Mostly it hangs up my emacs.

@gracjan
Copy link
Contributor

gracjan commented Jul 24, 2015 via email

@geraldus
Copy link
Contributor Author

Well, I think we should have some overrides for company's dabbrev source, for example case sensitivity. And if it is possible we should have some notes about completions itself and company-mode particularly.

@gracjan
Copy link
Contributor

gracjan commented Jul 24, 2015 via email

@geraldus
Copy link
Contributor Author

Ok, to test this I need to rewrite some code in completion function itself, I'll update pull request soon.

@cocreature
Copy link
Contributor

Could we just disable dabbrev until this is fixed? It hangs up my emacs for multiple seconds which is for obvious reasons pretty annoying. I'll be happy to send a pullrequest for that if you agree.

@geraldus
Copy link
Contributor Author

Please excuse me my delay and inconveniences brought by last changes. I have some troubles here and can do nothing at the moment. I will continue as soon as possible! Go ahead!

@geraldus
Copy link
Contributor Author

@cocreature by the way haskell-mode have some configuration for dabbrev already. When you'll disable my stuff, can you please test how it works and share your feelings? The one thing I've already mentioned is that it ignores case and making completions useless in most cases. In the end, I think it is possible to remove dabbrev-stuff which I provided replacing it with a better configuration to make everybody happy out-of-box (when REPL completions are no available).

@gracjan
Copy link
Contributor

gracjan commented Aug 29, 2015 via email

cocreature added a commit to cocreature/haskell-mode that referenced this issue Aug 29, 2015
@gracjan
Copy link
Contributor

gracjan commented Aug 30, 2015

Fixed by #838.

@gracjan gracjan closed this as completed Aug 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants