Titian Cernicova-Dragomir
Titian Cernicova-Dragomir

Reputation: 249696

Visual Studio 2013 and Typescript 1.3 language service

Can language service for the 'release 1.3' typescript branch be used as a drop-in replacement in the current Visual Studio plugin? I would like to try out the 1.3 compiler and would like to have Visual Studio use the new language service, is this possible? I tried to copy the typescriptServies.js into the TS language service plugin, but this makes VS lose all completion for TS.

Upvotes: 0

Views: 314

Answers (2)

TypeScript World
TypeScript World

Reputation: 46

The API is different than before, so that would not be impossible.

However the opensource editor called CATS right now has support for TypeScript 1.3 in the latest unstable release. You can download that from here:

https://github.com/jbaron/cats/releases

Some of the new features you could try out then are (all part of the latest TS master branch):

  1. Protected members
  2. Union Types
  3. Support for ES6 (block scoping etc)

BTW I'm one of the developers of CATS. So although not too much effort migrating from 1.0.1 to 1.3, it was still for sure not a drop-in replacement. Also the current master branch still has a few methods that throw not-yet-implemented exceptions, so some special precautions are required to avoid them.

Upvotes: 3

Dick van den Brink
Dick van den Brink

Reputation: 14509

I don't think that will work. I believe VS uses the LanguageService interface found here: services.ts 1.3 for the 1.3 version. If you compare it to the 1.1 version of the LanguageService the interface itself is mostly the same (getTypeAtPosition is gone and replaced by getQuickInfoAtPosition and so on) but other interfaces changed too (see below for the CompletionEntryDetails interface).

I tried replacing it myself and for example renames won't work either ("Unknown type at caret position" or something).

//1.1 
export interface CompletionEntryDetails {
    name: string;
    kind: string;            // see ScriptElementKind
    kindModifiers: string;   // see ScriptElementKindModifier, comma separated
    type: string;
    fullSymbolName: string;
    docComment: string;
}
//1.3
export interface CompletionEntryDetails {
    name: string;
    kind: string;            // see ScriptElementKind
    kindModifiers: string;   // see ScriptElementKindModifier, comma separated
    displayParts: SymbolDisplayPart[];
    documentation: SymbolDisplayPart[];
}

Upvotes: 0

Related Questions