[TypeScript] Support placeholder in LSP type output #3846
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
LSP output, such as is displayed in tooltips, truncated long types with syntax like the following:
This is not valid TypeScript syntax, but LSP highlights tooltips using the core TS syntax, and this causes highlighting to break. (The TS type expression syntax is deliberately rigid to prevent false positives.)
This PR adds support for the
... 100 more ...
bit to the TS syntax definition. Ordinarily, I'd hesitate to put something that's not actually TS syntax in the core definition, but in this case I think it makes sense — given the tight coupling between the language and the language server, I'm not concerned about this conflicting with other syntax extensions.I used a comment scope, though not for any particular reasons. The regexp seems to work in practice. I have inquired on the official TypeScript Discord about whether there is any documentation for this, or whether the placeholder is localizable, and so on, but I am not holding my breath for a helpful response.