microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

Home Page:https://www.typescriptlang.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TS Server: Add way for plugins to provided additional metadata in responses

mjbvz opened this issue · comments

Problem
TS Server plugins sometimes want to provide additional metadata on responses beyond that found in the official TS Server API. Two examples:

  • Emmet needs to pass a special isIncomplete property to VS Code. This property tells VS Code to re-trigger completions when ever the user types - microsoft/typescript-styled-plugin#33 (comment)

  • The styled plugin would like to pass color metadata information for color completions so that a preview of these colors are shown in the suggestion UI

Right now, I believe the TS server strips all unrecognized properties from response objects

Proposed fix
Either:

  • Make the TS server serialize all properties on response objects, recognized or not.

  • Add a special metadata property to responses that a plugin can use to pass additional information along.

/cc @ramya-rao-a