emacs-devel
[Top][All Lists]
Advanced

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

Re: IDE


From: Oleh Krehel
Subject: Re: IDE
Date: Mon, 12 Oct 2015 14:37:26 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Dmitry Gutov <address@hidden> writes:

> Ivy also could use a popup to display completions, in the
> future. Ideally, I'd prefer something like Sublime/Atom popup at the
> top of the screen that you get after pressing C-p.

Eventually, yes. But it's hard for me to figure out how to make the text
and the overlays work together while the text is being updated.  Perhaps
I should try Sublime/Atom at least once, just to see how it's done
there.

>> Could someone explain to me if making GCC the dependency of Emacs would
>> be a good idea, from technical and freedom point of view?  Personally, I
>> wouldn't care if Emacs executable would get inflated a bit more, if that
>> meant access to true IDE features, which are only possible with a
>> precise and fast parser.
>
> Having the whole GCC as a dependency might be problematic, but that's
> not the #1 problem. AFAIK, GCC currently has no "code completion"
> feature anywhere.

There's no need for a specific "code completion" feature. Take this code
for example:

    #include "qapplication.h"
    #include "qfont.h"
    #include "qpushbutton.h"
    
    int main(int argc, char *argv[]) {
        QApplication app(argc, argv);
        QPushButton quit("Quit");
        quit.
            
        return 0;
    }

Here's what (semantic-fetch-tags) returns:

    (("qapplication.h"
      include
      nil
      nil
      #<overlay from 1 to 26 in main.cc>)
     ("qfont.h"
      include
      nil
      nil
      #<overlay from 27 to 45 in main.cc>)
     ("qpushbutton.h"
      include
      nil
      nil
      #<overlay from 46 to 70 in main.cc>)
     ("main"
      function
      (:arguments (("argc"
                    variable
                    (:type "int")
                    (reparse-symbol arg-sub-list)
                    #<overlay from 81 to 90 in main.cc>)
                   ("argv"
                    variable
                    (:pointer 1
                              :dereference 1
                              :type "char")
                    (reparse-symbol arg-sub-list)
                    #<overlay from 91 to 104 in main.cc>))
                  :type "int")
      nil
      #<overlay from 72 to 205 in main.cc>))

A similar data structure *has* to be somewhere in the GCC innards: it's
a first step for compilation. In addition, this information is used to
point out compilation errors/warnings.
This data structure would know all defined functions/variables/types.
For instance, it would know that the class QPushButton is defined in
qpushbutton.h at line 57, and it inherits from QAbstractButton.

It only remains to write a small wrapper that dumps all the AST included
into `file_name` up to the point `offset`:

    void gcc_ast_for_file (char* file_name, int offset, void* out)

I hope that I'm not being naive here and it's as simple to do as that.

    Oleh







reply via email to

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