clausreinke / typescript-tools

(repo no longer active) Tools related to the TypeScript language
Apache License 2.0
266 stars 29 forks source link

Omnicomplete function API isn't correct #33

Closed buma closed 10 years ago

buma commented 10 years ago

Hi!

Great program but I think omnifunc API isn't correct. In vim documentations it is written that

On the first invocation the arguments are: a:findstart 1 a:base empty

The function must return the column where the completion starts. (...) Return -1 if no completion can be done.

I'm trying to get completition for greeter var (line 12) in test Typescript file

I'm using YouCompleteMe and it sends 1 and "" to omnicomplete function (TSScompleteFunc). But TScompleteFunc returns -1 and YouCompleteMe correctly assumes that no completitions can be done. If I press ctrl Space I get completitions but those are without YouCompleteMe substring search. If I comment this check in YouCompleteMe completition works. But I think problem is with typescript tools.

clausreinke commented 10 years ago

Thanks for the report - that explains the issues other YouCompleteMe users had. There is an explicit check in our vim plugin to ensure we're on a keyword char, but I do not recall why I considered that necessary - Vim doesn't seem to care about the -1 return (old protocol?), just about empty/non-empty completion list, and the language services seem to handle all situations. I will probably just remove the check in the next update.