emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is intellisense features integration in Emacs technically possible?


From: Jorgen Schaefer
Subject: Re: Is intellisense features integration in Emacs technically possible?
Date: Wed, 22 Jan 2014 19:49:30 +0100

On Wed, 22 Jan 2014 17:29:15 +0000
address@hidden (Phillip Lord) wrote:

> Eli Zaretskii <address@hidden> writes:
> >> A better way is to build on the hard work of other and interface
> >> emacs with an external tool.
> >
> > Personally, I think implementing such features via external programs
> > is a terrible design.  It will never be smooth and responsive
> > enough, and on top of that you'd need to track development of those
> > other tools.  And what if they become abandoned some day?
> 
> I think that it depends on the language. Introspecting over, for
> example, Java would require an awful of elisp, which would be
> difficult to write. Getting Java to do this work is quite a lot less
> effort. Hence, the JDEEs use of Java for this (via bsh). Likewise,
> Clojure and Scala both of which use their own language to do much of
> the work. Or for that matter, common lisp with slime/swank. Or even,
> for that matter, English with aspell. I didn't have a problem with
> responsiveness with any of these.

Yeah, roughly that.

"External program" instead of "integrated" means very little these
days. I wrote one of the various Emacs modes that provide semantic
completion for Python, interfacing with two different Python libraries
which do the actual semantic analysis. In this case, Emacs communicates
with the external program via a specified protocol, which, from the
Emacs side, looks exactly like calling some kind of Emacs Lisp
function. (Abstraction is great.)

The only problem I have is that keeping state shared between the
processes is difficult. Right now, what I'm doing is to re-send the
current buffer to the other process, including the position of point,
for every completion request. This is highly inefficient, and makes it
difficult to create a tighter coupling for better completion or
analysis from the Emacs side. To improve on that, there would need to
be a way of sharing the current contents of a buffer with a subprocess
without writing it to a file.

But this is an optimization problem, not a capability problem. The
current approach I use is "fast enough", so fast actually that I
haven't even implemented a speed-up idea of using temporary files
instead of sending the buffer contents as encoded strings to the other
process.

Considering there already are so many different modes that provide
semantic completion for Emacs, the main obstacle for IntelliSense (as
far as I understand it) *on the Emacs side* is actually not that big.
It's mainly a common interface for such external programs so that we
can add more languages more easily. The current effort of unifying the
completion interface as well as supporting company mode as a front-end
is going a great deal forward in that.

The biggest problems are outside of Emacs. Good libraries that provide
intelligent completion and code introspection are rare. I know of three
for Python, one of which is not maintained anymore, one was mostly-dead
for a few years, and all of which have different deficiencies. They
also have trouble keeping up with the development of the language. I
expect similar problems for other languages. Reimplementing these
libraries in Emacs Lisp will just cause more problems keeping them
up-to-date.

Though if someone wants to do that, do not let that stop you. It's most
certainly not "impossible".

Regards,
Jorgen



reply via email to

[Prev in Thread] Current Thread [Next in Thread]