Commit graph

37 commits

Author SHA1 Message Date
Sam Steingold
448e161068 Avoid dependency on the deprecated package "cl"
Replace `defun*' with `cl-defun', `loop' with `cl-loop',
  `case' with `cl-case', `assert' with `cl-assert',
  `destructuring-bind' with `cl-destructuring-bind',
  `multiple-value-bind' with `cl-multiple-value-bind',
  `equalp` with `cl-equalp`, `defstruct' with `cl-defstruct`
  &c &c &c
Use lexical-binding instead of lexical-let.
Add declarations and defvar to avoid breakage.
2019-10-12 08:37:46 -05:00
Miller
d3591e011a Improvements to company backend.
- Make sure we only cache actual python objects.
- Do better when we are completing in the middle of an object.

To that end is the new function `ein:object-prefix-at-point' that returns the
prefix for the dotty.thing.at.point. See the function documentation for more
info.
2019-10-06 18:05:36 -05:00
John M. Miller
3f5173cb2f Avoid completing against punctuation (again).
Fix #506 while maintaining (I hope) the spirit of #463.
2019-04-04 16:42:59 -05:00
dickmao
234cf391f9 Polymode
M-x customize-group RET ein
Toggle Ein:Polymode

Avoid trying to emulate jump-to-definition, eldoc, and autocompletion
functionalities that Elpy will always do better.

Fixes #497 #482 #418
2019-04-02 09:35:17 -04:00
dickmao
22b4e58e56 preserve the no-op for now 2019-03-15 00:50:13 -04:00
dickmao
6698b4f563 Don't attempt completion in markdown cells 2019-03-11 22:37:13 -04:00
John Miller
bf1bcf12cf ein-company: Hotfix for #478
Do no run ein company backend unless we can find a kernel to do completion
against.
2019-03-05 21:50:51 -06:00
John Miller
94655e7738 ein-company: Implement company completion in connected buffers. 2019-02-26 08:55:17 -06:00
leizhe
46e3fc6247 ignore nonascii completion 2019-02-02 22:32:27 +09:00
dickmao
129afa5fb4 Respect cursor_start and cursor_end in matches
The :cursor_start and :cursor_end fields tell us whether we need to
prepend the prefix ourselves.

Fixes #436
2018-12-28 21:14:11 -05:00
John Miller
16c14fa695
Merge pull request #415 from dickmao/autocomplete-initial-refactor
Allow disabling of autocomplete
2018-11-29 21:05:52 -06:00
dickmao
d4ef4ed81c Allow disabling of autocomplete
```
M-x customize-group RET ein-completion
```
Set `Ein:Completion Backend` to `ein:use-none-backend`, Set `State` to
`Save for Future Sessions`.

Also use `featurep` and `with-eval-after-load` to clean up the
subpackage requiring gymnastics.
2018-11-28 17:45:23 -05:00
dickmao
4e8a9b51b5 notebook-mode as a proper minor mode
Previously `notebook-mode` was an ordinary function that called
`notebook-minor-mode` to install `ein:notebook-mode-map`.  Make
`ein:notebook-mode` a proper minor mode via `define-minor-mode`.  This
has a few visible benefits primarily that `describe-mode` or `F1 m` will now
show all the keybindings, and mode-line will reflect.

As a consequence `ein:notebook-mode-hook` is no longer an explicit
`defcustom` (proper minor modes get it for free).  This had been a
dangerous situation as the default hook containing critical functions could be overridden.
2018-11-28 13:31:23 -05:00
John Miller
e280bb8633 ein-company: Add completion caching, make caching kernel specific. 2018-11-22 09:07:02 -07:00
dickmao
512658883b @sam-s says Requiring ESS is wrong because it forces people who do NOT use it to install it.
The standard way to avoid this problem is to use autoload instead of require.
This way ESS is not required to compile and run EIN and it is only loaded if the user actually uses it.
2018-10-15 12:19:30 -04:00
dickmao
bc10cea743 Normalize url-or-port
```
"http://localhost:8888"
"http://localhost:8888/"
"http://127.0.0.1:8888"
"http://127.0.0.1:8888/"
"8888"
8888
```

Ideally these should converge to the same thing.  Since many hash
tables are keyed off `url-or-port`, forgetting to
normalize `url-or-port` with `ein:url` leads to missed cache hits and
general malaise.  So we try to do that.

Address a FIXME: apply callbacks to `ein:notebook-list-login-and-open`.

Removed py3.5 from travis build matrix to reduce developer strain.
2018-10-12 21:55:33 -05:00
John Miller
8adc38ae8f Code cleanup.
Get rid of some unused variable warnings, add some lexical-binding definitions
and update some documentation.
2018-09-18 21:46:35 -05:00
John Miller
7320c16b47 ein-company: Function annotations via oinfo db
As ein builds completions for company it will build a database of object-info
data that can later be used for function annotations.
2018-09-03 16:06:15 -05:00
John Miller
8b7f26d668 Refactor object info for company annotations. 2018-09-02 23:24:21 -05:00
John Miller
91d78370d3 EIN, Company, Jedi, and connected buffers
Not sure if it is really doing anything, but ein:use-company-jedi-backend is now
a valid setting for ein:completion-backends.

More useful is that connected buffers now use ein's company completeion backend,
so completion should now work across all backends all across ein. Now let's get
something working in org!
2018-08-25 13:41:09 -04:00
John Miller
c65c21403e Improving ein-company
Code for getting matches uses deferred and calls to `ein:completer-complete',
avoiding the hacks needed with `ein:completer-finish-completing-company' (names
are shorter too!). Using deferred makes reading the code a bit easier, I think.

EIN will also try to prepare function annotations via the python oinfo object.
Performance is not ideal when the completion candidate list is long, so there is
a new customizable variable `ein:allow-company-annotations' to control this
behavior.
2018-08-25 12:45:50 -04:00
John Miller
9c2e6fe7c8 ein-company: Only check for punctation near completion point.
This will allow ein-company backend to complete in the middle of a line.
2017-10-23 19:39:00 -05:00
John Miller
3fa575bbf4 ein-company: Tweak punctation check.
Spaces should also not trigger completion.
2017-10-22 19:20:41 -05:00
Sam Steingold
05ba2e257a fix a typo in 34902e1 2017-10-20 14:32:53 -04:00
John Miller
d7e1aece02 ein-company: Make sure matches actually start with right text.
This should address the original problem described in #225.
2017-10-20 12:05:01 -05:00
John Miller
34902e104f ein-company: Avoid completing around punctuation.
For some reason this causes the IPython kernel to return a very large number of
potential matches.
2017-10-20 11:55:31 -05:00
Sam Steingold
d447c8cc15 typos 2017-07-11 14:32:00 -04:00
John Miller
5c2f34ceeb Implement company locate command.
ein company backend now dutifully looks for the file and line where an object is
defined when company so asks it. When ein fails in its duty it fails silently
and I am not sure yet if that is the correct behavior. For now it will stand,
until I think of something better.
2017-04-21 19:07:16 -05:00
John Miller
91b5f605ee Implementat company doc-buffer command.
ein company backend will now show results of inspect_request in a company
documentation buffer when company requests documentation via the doc-buffer
command.
2017-04-21 17:57:16 -05:00
John Miller
ab106032a8 Fixing bug in company backend.
The backend was working properly only when completing at the beginning of the
lines. For example, completing `import IPython.` would end up replacing the
import and moving IPython to the beginning of the line. EIN's company backend no
longer does this.
2017-04-20 19:55:00 -05:00
John Miller
3aac45257c Cosmetic tweaks to ein-company.el 2017-04-20 16:33:56 -05:00
John Miller
7ad1faf452 Fix completion issues with ein's company backend.
Also tweak names of buffers for editing non-notebook files.
2017-04-20 16:21:54 -05:00
John Miller
06269b72bb Update autoloads for ein-company.el 2017-04-19 10:57:19 -05:00
John Miller
d13e85b370 Minimally functional company-mode support.
There is now a company mode backend for ein. It generates completions by sending
complete_request to the running kernel so for the moment no jedi integration.

Configuring is maybe non-obvious - user should at minimum set
`ein:use-auto-complete` and `ein:use-auto-complete-superpack` to nil. Adding a
`(require 'ein-company)` probably should be done somewhere in the user's init
file. This could all be done better so I will attempt to address in later
commits.
2017-04-19 10:12:45 -05:00
John Miller
fdb20813cf Give another try at company-mode integration. 2017-03-04 21:25:21 -06:00
John Miller
45f415f134 Guessing how async completion might work.
Almost a direct copy and paste from ein-ac.el. Will have to
iterate on this more than a few times to figure out a good system
for generation completion candidates for company mode.
2016-03-10 15:15:44 -06:00
John Miller
db630250ac New branch for company-mode backend development. 2016-03-03 13:29:00 -06:00