emacs-devel
[Top][All Lists]
Advanced

[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 02:46:02 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:43.0) Gecko/20100101 Thunderbird/43.0

On 01/04/2016 12:56 AM, John Wiegley wrote:

Does removing ':' from the symbol class for ruby solve all of your problems,
and create no new ones? :)

I wish.

With fewer (hopefully none) false negatives returned by xref-collect-references, there will come more false positive matches.

One false negative comes to mind: if `:' is not a symbol constituent, and the user searches for all references to `:foo', using the current implementation, they will get none. The default input suggested by xref-find-references will be `foo', though (when point is on `:foo').

In completion, if we continue to simply collect all symbols from all buffers, the user will start typing a method name , try completion and will get offered the names of all method and Symbols they ever typed anywhere, in the code. While Symbols are used to refer to method names, they're also used for method keyword arguments (in Ruby 2.0+), and you even often see them in business logic. For instance, in most web applications there will be Symbols :username, :password, :account_id, and so on, referring to the HTTP request parameters. So, there will be a lot of false positives here as well.

I don't know how to fight that, except by using a smarter program, one that loads the application and/or parses the code, etc, but there will always be some use cases that are not handled by "smart" logic already written, and being able to write a quick-and-simple solution is often handy.

Further, I'm sure there are a lot of third-party packages out there, some of them language-agnostic, which deal with source code and use the notion of a symbol.

One example that I do use is `easy-kill'. If my cursor is at the end of a Symbol :foo, currently calling this command will select `:foo', including the colon, which is handy to be able to copy and paste, or kill, that value as a whole. If `:' is no longer a symbol constituent, either I'll have to live with always additionally typing or deleting these colons in that kind of situations, or will have to provide the "boundary of thing" info to easy-kill additionally somehow.

That's why I'm asking if there are any existing guidelines, formal or informal, that I can take into consideration. That might also inform changes to xref-collection-references and company-dabbrev-code; not just ruby-mode.

Would anyone care for another wall of text?



reply via email to

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