-
Notifications
You must be signed in to change notification settings - Fork 347
Completion mechanics haskell-completions-grab-prefix implementation #688
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
Conversation
Function Any thought about how to make it a bit readable? |
@gracjan updated |
the rest should be easier, but I want to fix presentation buffer first |
otherwise returns nil." | ||
;; TODO Discuss this. In some cases it is better to provide completions if | ||
;; point is not at whitespace, for example when point is at closing | ||
;; parenthesis: (ma|) - point is after `a` character. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In some cases it is better to provide completions if point is not at whitespace, for example when point is at closing parenthesis: (ma|)
- point is after a
character. Any thoughts?
Well, I believe I've covered all prefix cases originally defined here1. Now I can write a general function for grabbing prefix at point which first invokes pragma-prefix function and if its result is nil it returns the result of identifier-prefix function. And after that I can update completions at point function: split it to synchronous and asynchronous ones. Have any thoughts? |
Sound like a very good idea!
|
A little progress here |
Are there some commits here that you could spin-off as a separate pull request? This is getting rather big... |
@gracjan I think I'm done with prefixes, can you review everything that done so far and it is could be merged after squashing some commits. The next part is to update completion functions (still some research needed). I have no strong opinion on some key points though:
|
@@ -0,0 +1,189 @@ | |||
;;; haskell-completions.el --- Haskell Completion package | |||
|
|||
;; FIXME copyright (c) 2015 Haskell mode community. All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it okay to reserve copy rights to community rather than a person?
@gracjan I think GPL licence itself ( |
Overall this looks good to me. Tests provide assurance that this also works. License stuff got merged in another commit, so it can go away. Please squash what is there to squash. (Note: when you commit you can use |
@gracjan I will tidy up things this evening, however, I'm still have no strong opinion about completions in the middle of strings. Initially I've decided not to grab prefixes in the middle of string (hence no completions in this case) being influenced by some comments in company-mode sources1. But, when I write Elisp code company-mode works even in the mid of the word and it feels quite comfortable and useful, so this was wrong decision from the very beginning and provide no completions in the middle of string is likely a misfeature. Now I'm leaning to other direction, but I don't know and can't recall how completions provision works in other packages (like auto-complete) and/or in other editors/IDEs _(I can check how Sublime works in the evening). |
I would love completions to work inside comments!
Note that QuasiQuotes are done using strings, so having completions there
can be also useful.
I vote for having completions everywhere!
|
OK, I've tested Sublime Text and it does not completes in the middle of string, so does company-mode with elisp code. But them both provide completions when point is at punctuation, e.g. I also want to have completions inside comments and string literals, this is one of the reasons of my efforts on completion improvements. Currently, it is possible to grab prefix inside comments and strings, but I think I need to implement special completion type for these cases, e.g. As for quasi-quotes, my current haskell workflow have lot of them, so if it's possible to make QQs support a bit better I'd love to have it. But I have nothing to say about this stuff yet. |
Define a function which grabs completion prefixes for pragma names (WARNING, LANGUAGE, etc.), and handles special cases of OPTIONS_GHC pragma and LANGUAGE pragma returning prefixes for options or language extensions respectively.
pinging @gracjan, please review carefully final update |
Code is nice, can be merged as is. Do you anything more you want to do about this? How can I see this working besides of unit tests? |
@gracjan nope, this is supposed to be merged as is, the next PR will touch completion functionality itself. I'm testing this stuff manually running |
Completion mechanics haskell-completions-grab-prefix implementation
This is long story. I want to make some improvements on completion stuff.
I will add changes step by step because a bit short in time and made this PR to have some feedback and help.