On 06/09/2005, at 11.04, Graeme Mathieson wrote:
My suggestion is that you sort them by proximity (as it is now), but look for words in both directions, so the words right in the next line stand a better chance.
That would be most excellent. In addition, it'd be really nice if TextMate had the option to look in other files in the project -- for example, the completion of a function from another file.
The utterly uber-cool feature would be if the project-wide completion was scope sensitive...
You can actually overload the completion for different scopes.
Here's the example from the release notes (a preferences item in the bundle editor):
completionCommand = 'php -r '$a = get_defined_functions(); print_r(implode("\n", $a["internal"]));'|grep "^$TM_CURRENT_WORD"| sort'; disableDefaultCompletion = 1;
This disables the default suggestions, and instead completes based on PHP's list of build-in functions. You'd set the scope for this to source.php -- but you can also set it to a more restrictive scope.
To search *.cc files in current files directory, you could do something like:
completionCommand = 'cd "$TM_DIRECTORY"; cat *.cc|tr -cs "[:alpha:]_" "\n"|grep "^$TM_CURRENT_WORD."|sort|uniq';