typescript-language-server / typescript-language-server

TypeScript & JavaScript Language Server

Home Page:https://www.npmjs.com/package/typescript-language-server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

angle brackets are not being matched properly, causing keywords to be highlighted as a type

DibyodyutiMondal opened this issue · comments

I am not sure if this is a problem with vs code or the language service, but I'm assuming it is the language service. Apologies in advance if I'm wrong.

The following snippet works fine, and the code highlighting in the editor works fine too, except when I wrap the type parameter.

snippet

export const mapResponse = {
  blogPost: <I extends { created: string; updated: string; }>(input: I) => {
    return {
      ...input,
      created: DateTime.fromISO(input.created),
      updated: DateTime.fromISO(input.updated)
    };
  }
};

return keyword is correctly identified as a keyword

image

return keyword is incorrectly identified as a type(?)

image

It's not language server applying syntax highlighting, it's the editor.

Language server can augment the colors through semantic highlighting but it doesn't apply semantic tokens to keywords like return so it's not gonna help in this case.

You should report this in the VSCode repo. VSCode doesn't even use this server.