language services auto complete performance

Topics: General, Language Specification
Jul 3, 2013 at 3:10 AM
Abstract: Every auto complete request takes 200ms and I'm trying to cut it down, any suggestions.


I'm trying to use the language services for auto completion of typescript source files.

I have a class which implements ILanguageServiceShimHost and is forked from the TypeScriptLS class from harness/harness.ts.

To do an auto complete I first create a new language serviceshim object like so
        var languageServiceShim = new Services.TypeScriptServicesFactory().createLanguageServiceShim(this);
        languageServiceShim.refresh(true);
        this.languageServiceShim = languageServiceShim;
        this.languageService = this.languageServiceShim.languageService;
Then I call this.languageService.getCompletionsAtPosition(...).

If I change the file in the ShimHost, I have to recreate the shim and call getCompletions again. Recreating the shim takes 200ms (actually it's the refresh(true) line that takes so long) and that's just far too large for my application. Does anybody know how to speed up the refresh or get around it? Thanks!