Skip to content

Expose semantic token command typeΒ #42091

@christianbundy

Description

@christianbundy

Suggestion

πŸ” Search Terms

language server protocol, semantic tokens, full, range, syntax highlight,

βœ… Viability Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

⭐ Suggestion

Hi. I'd like to get the LSP equivalent of textDocument/semanticTokens, which the Typescript codebase seems to call getSemanticTokens(), but it doesn't look like that's an available command type.

πŸ“ƒ Motivating Example

{"seq":1,"type":"request","command":"getSemanticTokens","arguments":{"file":"/home/user/example.ts"}}

πŸ’» Use Cases

I'd like to have tsserver send me tokens so that I can do syntax highlighting without my editor having to understand JS/TS/etc.

See-also: https://github.com/christianbundy/lsp-editor

Metadata

Metadata

Assignees

No one assigned

    Labels

    In DiscussionNot yet reached consensusSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions