Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust to code jumping on namespaced keywords #1220

Closed
lgrapenthin opened this issue Jul 21, 2015 · 7 comments
Closed

Adjust to code jumping on namespaced keywords #1220

lgrapenthin opened this issue Jul 21, 2015 · 7 comments

Comments

@lgrapenthin
Copy link

There is a library that represents function references in data as keywords. Would it be possible to implement code-jump on keywords? (onyx-platform/onyx#253)

@bbatsov
Copy link
Member

bbatsov commented Jul 21, 2015

Not sure it's a good idea to try to interpret all keywords as var names. Perhaps a separate function? I'm also not sure how common such setup is in the wild. Btw, it'd be better if you added more examples to the ticket itself - makes the discussion simpler and more focused.

@Malabarba
Copy link
Member

I didn't quite get what that library does, but I think namespaced keywords (::something or :some.ns/something) are relatively common. At least, I've run into them several times in my very limited experience.

One thing I wonder, though, is where would you jump to? The top of the file with the corresponding namespace? The first occurrence of the keyword in that file?

@lgrapenthin
Copy link
Author

@bbatsov Agreed, yes, jumping from keywords to identically named vars would be the desired usage. As @Malabarba observed there are possible other implementations of code jumping on keywords. A second function would probably be the best thing at the time.

@Malabarba
Copy link
Member

Agreed, yes, jumping from keywords to identically named vars would be the desired usage.

That would be making an assumption that the keyword corresponds to the var, which is not necessarily true (though it sounds like a low-risk assumption). I think that's what Batsov was saying.

In any case, doing something is certainly better doing nothing when the user calls find-var on a keyword, it's just important to figure out what's the most appropriate "something".

@expez
Copy link
Member

expez commented Jul 21, 2015

find-var uses thing at point as the default value, can't we just drop the leading : and use the rest as the default value? If there is a matching var you can hit RET to jump and if some other scheme is used you can edit the seeded value.

@bbatsov
Copy link
Member

bbatsov commented Jul 21, 2015

Yep, we can certainly do this. That'd be the alternative of a separate command, which might be more user-friendly.

@lgrapenthin
Copy link
Author

I made the observation that keywords with a fully qualified var name are quite rare. We don't have to make the assumption that every keyword we hit C-. on has to be named like a var. Alternative behavior can still be implemented for "normal" keywords, which I believe are 99.99% of all keywords.

My personal guess is that whatever future behavior will be implemented for hitting C-. on a keyword (and I can imagine many ones like the one @Malabarba suggested) one would still prefer var jumping on keywords with fully qualified var names because they are essentially occuring only in spots where one would normally use symbols (but for some reason has decided or is forced not to).

One could assume quite sincerely that those users who don't have use for this feature won't be affected by it. One could also offer them a flag to disable this if the future behavior is more desirable on keywords with a fully qualified var name.

After these reconsiderations the risk of implementing var jumping on fully qualified keywords exclusively and leaving all other keywords open for future behavior implementation seems significantly smaller. My original worries are gone, YMMV.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants