[TxMt] Re: Autocompletion of variables using dashes

Allan Odgaard mailinglist at textmate.org
Mon Jul 11 13:29:34 UTC 2016

On 10 Jul 2016, at 13:53, Louis Abraham wrote:

> If I type :
> (define ab-cd€ 23)
> ab
> And press [esc], then the whole name appears. Nevertheless, if I try 
> with ab-, then the completion doesn't trigger. So far I experienced, I 
> works only after alphanumeric characters.
> Thus, there are two strange behaviours :
> 1. The entity scopes don't seem to affect autocompletion. Then, what 
> is the recommended manner to solve my main issue ? Can I capture the 
> function name in both selectors (entity and variable) ?

What you can do is set a characterClass for the entity scope.

For example in the bundle editor create a new settings item and make the 
scope selector be `entity.name.function.scheme` and the actual value 
something like: `{ characterClass = 'variable'; }`.

Now TextMate will treat all contiguous characters matched as 
`entity.name.function.scheme` as a single word for the purpose of word 
selection, completion, etc.

> 2. Why can't the autocompletion be triggered after a non alphanumeric 
> character ?

This is because TextMate only completes “words”, however, as you can 
define what constitute a word, you can include the dash.

For example if you do the above setting then escape will complete _if_ 
the dash is used in a place where it is matched as 

There is also the ability to simply make the dash a word character for 
the `source.scheme` scope, this would also be done by a bundle setting 
but one that is scoped to `source.scheme` and contains `{ wordCharacters 
= '-'; }`.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20160711/5d78b5f9/attachment.html>

More information about the textmate mailing list