microsoft / microsoft/TypeScript
Feature Request: LanguageServiceHost plugin
Personne n'a encore pris cette issue.
- Langage dominant
- Go
- Étoiles
- 111k
- Forks
- 14.4k
- Merge moyen
- 1 j 19 h
- PR mergées (30 j)
- 117
Description
Search Terms
language service host compiler plugin
Refs #16607
Suggestion
Currently, TypeScript only supports proxying the language service. It would be good to have an officially supported way of being able to proxy the LanguageServiceHost as well.
Use Cases
Being able to provide a plugin that changes how the language service host behaves is often a requirement for use cases where the default behaviour of TypeScript in Visual Studio Code does not mirror the compile time behaviour when using tools that implement a language service host with TypeScript.
For example in Deno, we utilise full path names for modules, including TypeScript ones. The standard language service host disallows this (because it assumes that the module name won't end in .ts at runtime).
There are likely to be other use cases where the behaviour of the language service host differs when using other forms of TypeScript other than tsc and Visual Studio Code, where it would be useful to allow plugins to mimic that behaviour, in particular in Visual Studio Code, so that the editing experience can be more rich.
Examples
I currently have a plugin which just monkey patches the LanguageServiceHost to inject similar logic for module resolution to what is done in Deno. This is because I cannot return a proxy, like I could with the LanaguageService.
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, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par le guide « Writing a Language-Service-Plugin » référencé dans l’issue et examinez l’index.ts du plugin d’exemple. Comparez l’approche existante du proxy LanguageService avec le cas d’utilisation demandé d’un proxy LanguageServiceHost, notamment la résolution des modules de style Deno. Le travail sera considéré comme terminé lorsqu’un chemin défini pour les extensions prises en charge évitera le monkey-patching.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- typescript
- Domaine
- compilers, tooling
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 30/100