emacs-devel
[Top][All Lists]
Advanced

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

Re: IDE


From: Dmitry Gutov
Subject: Re: IDE
Date: Sat, 17 Oct 2015 17:25:27 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Thunderbird/42.0

On 10/17/2015 03:45 PM, Eric Ludlam wrote:

There is nothing about semantic the framework that prevents using
something like SMIE as a tagging engine.  It seems likely that if some
language not supported by CEDET today has a good SMIE grammar, and if
SMIE could be adapted to produce compatible tags (which isn't really
that hard to do), and if SMIE has an entry point that allows parsing a
tag set out of a region, then it would integrate into the semantic
framework at the best level.

With SMIE, though, it might make sense to optimize the process and only ask it for the current tag (and maybe the nearby ones), because it would otherwise be slower (no incremental parsing, or anything like that). So a straightforward conversion might not be optimal.

But from the main examples you gave of tag usage, knowing the current tag is by far the most important.

The difference is that the parser generators in Semantic today have
optimizations for skipping parts of the buffer while tagging.  This lets
it parse whole files more quickly, and more robustly.  Since it uses
syntax tables to do that, I'll guess SMIE can do it, but I'm not that
familiar with it.

Skipping strings and comments - probably. Method bodies - unlikely (except in C-like languages: skipping over a pair of braces is easy).

Also, wisent type grammars could easily dump out data you need for
indentation since actions can do anything you can write in lisp.  No one
has tried to do it though.

Someone should try and tell us about it.

The mechanism in use is that there are detailed taggers, like those
currently written for Semantic using wisent type parsers, and weak
taggers, like GNU Global.

Once a buffer is open, the detailed tagger runs and is truth.  When a
search occurs, a process of pulling all relevant databases together is
started.  This includes tags from the detailed taggers already cached,
and high level 'omniscient' taggers that are usually weak, but have
scanned the whole project.

Well, that's my point: if you don't use etags, to have all project files indexed you have to open each of them at some point.

Some languages have import systems where you have to declare all file's dependencies at its top (and so you can know which files to reindex if you're only interested in this file; although even that could be a lot). But in Ruby and pre-ES6 JavaScript, you don't usually have that.

The output of the search includes a database
table, and tags found in that table.  The tags are additionally refined
based on whatever the layered criteria is, and when the code decides to
work with a detailed tag from the search, it forces it to be real, and
pulls it into a buffer if necessary, and any problems with the weak
tagger is resolved.

Yup.

The key here is that the detailed tagger is needed to do complex tasks,
but weak taggers are great to integrate in due to the speed advantage.
Having a mix gives you the best possible results.

If the program generating TAGS is smart enough, the result can be pretty accurate already (and contain qualified method name). Eli has recently made some improvements to that effect to etags.

If instead you put the cursor on "tee" and do

M-x semantic-ia-fast-jump RET

it will go to the right spot.

Indeed it does, thanks. But it goes to the second definition irrespective of which argument is passed to tee. Which brings us back to the completion problem I reported with that snippet.

For the keybinding you were using, the workflow is:

Right, why doesn't semantic-ia-fast-jump have a default keybinding? I was only looking for the appropriate command in the active keymaps.

C-c , J tee TAB

shows you where it would jump, then

TAB

Oh, so it uses something more advanced than completing-read. That's unexpected.

But what about duck typed languages? If a method foo calls bar on its
argument tee, we don't know the type of tee, all we know that it has a
method bar.

In the workflow above, you can just keep pressing TAB to pick the one
you want.

I would want semantic-ia-fast-jump to work with them, of course. As well as semantic-symref.



reply via email to

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