[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Guidelines for the "symbol" syntax class
From: |
Dmitry Gutov |
Subject: |
Re: Guidelines for the "symbol" syntax class |
Date: |
Mon, 4 Jan 2016 03:14:39 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:43.0) Gecko/20100101 Thunderbird/43.0 |
On 01/04/2016 02:55 AM, John Wiegley wrote:
I suppose my informal guideline is to implement a strategy that works best for
the mode you want to derive information from, and to not expect syntax classes
to be a capable enough interface. I'd expect Ruby symbols to include ":",
personally.
In c++-mode, `std::cout' is two separate symbols, so I'm going to follow
that model.
A::B is the qualified name of a symbol
Yes, and methods have qualified names like A::B#foo or A::B.bar, but we
don't make `#' or `.' symbol constituents.
-- although "B" is
technically an unqualified symbol in its own right within that qualified name.
Yup. "B" is the name of a constant set on the module/class A. This is
relevant because we can reference A::B from code lexically inside A (or
even inside A::C) by its base name (B). And it's impossible to know
whether the referenced constant (classes are constants, BTW) is B, A::B
or A::C::B without runtime information, or parsing the whole project and
its dependencies.
Better yet, define a more general API that all modes can use, since many modes
struggle with these same issues (imenu, thing-at-pt, dabbrev, etc). This
echoes back to our long IDE thread.
Ouch. We do need to release 25.1 sometime. And I want
xref-find-references to work okay-ish in ruby-mode by then.
There *are* some variables already in Emacs that I might have to use,
and maybe I'm missing some of them. E.g.
dabbrev-abbrev-skip-leading-regexp and find-tag-default-function (should
xref-collect-references use find-tag-default-function?).
Perhaps we need layered, semantically-
defined classes, such that a given text position might occur within many such
layers (for example, selection might choose B, A::B, or A::B.foo, depending on
how many times I smash the "select current" key).
easy-kill defines a hierarchy of things (though a simplistic one), which
works like you describe. How to apply that idea to dabbrev-expand and
xref-find-references is not immediately obvious to me.
- Guidelines for the "symbol" syntax class, Dmitry Gutov, 2016/01/03
- Re: Guidelines for the "symbol" syntax class, John Wiegley, 2016/01/03
- Re: Guidelines for the "symbol" syntax class, Dmitry Gutov, 2016/01/03
- Re: Guidelines for the "symbol" syntax class, Stefan Monnier, 2016/01/03
- Re: Guidelines for the "symbol" syntax class, Dmitry Gutov, 2016/01/03
- Re: Guidelines for the "symbol" syntax class, John Yates, 2016/01/03
- Re: Guidelines for the "symbol" syntax class, Dmitry Gutov, 2016/01/03
- Message not available
- Re: Guidelines for the "symbol" syntax class, Dmitry Gutov, 2016/01/03
- Re: Guidelines for the "symbol" syntax class, John Wiegley, 2016/01/03
- Re: Guidelines for the "symbol" syntax class,
Dmitry Gutov <=
- Re: Guidelines for the "symbol" syntax class, Stefan Monnier, 2016/01/03
- Re: Guidelines for the "symbol" syntax class, Dmitry Gutov, 2016/01/03
- Message not available
- Message not available
- Message not available
- Re: Guidelines for the "symbol" syntax class, Dmitry Gutov, 2016/01/03