Alt+a is not greedy enough #6

Closed
whitequark opened this Issue Feb 20, 2014 · 11 comments

2 participants

@whitequark
Owner

For example, it doesn't eat ', which are valid in identifiers.

@TheSpyder
Collaborator

We probably need to use the identifier regex in a forward search, rather than my quick-fix "sublime expand to word" solution :)

@whitequark
Owner

But how to go backwards?

@TheSpyder
Collaborator

Searching backwards uses the existing code from completion. If it needs to be more permissive, maybe the query function does need to be split for completion vs type inspection.

@whitequark
Owner

See, goa'uld is a valid identifier. If you position the cursor between l and d, it should work.

@TheSpyder
Collaborator

goa'uld is also broken for autocompletion (type goa'ul <ctrl+space>). It shows the generic local let binding, not the full completion. We need to adjust the regex to include ' :)

In fact, do we need to include the generic local let bindings at all? The switch to -F and --context should pick those up now...

@whitequark
Owner

Would it pick up bar in let foo _ = let bar = 1 in <cursor> ? If yes, feel free to drop it.

@TheSpyder
Collaborator

Looks like no. You can test that yourself - the autocomplete shows type "let" for the locally detected variables, and a proper type for the ocp-index ones. I guess context is only really useful for opens :)

@whitequark
Owner

I was just checking -- perhaps you know ocp-index better than I do. :) Then let sniffing probably stays. I really don't like it, it's silly and flawed and doesn't respect lexical scope and doesn't pick up bindings in patterns, but it's still quite useful.

@whitequark
Owner

I've considered using sublime's "scopes" feature to pull out bindings from patterns, but the highlighting file is completely incomprehensible and it doesn't have a specific scope for one variable inside pattern. Rather, it highlights everything that is not a variable inside a pattern in a differing way. :/

@TheSpyder TheSpyder closed this in 61b14e0 Feb 20, 2014
@TheSpyder
Collaborator

I think we're hitting the limits of what can be done without running merlin in the background as vim/emacs do :)

Pretty easy fix in the end, I didn't quite understand what the regex was doing before.

@whitequark
Owner

awesome. There are some plans for merlin, but they're blocked on upstream (cc @def-lkb)

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