Skip to content

Document guidelines to enable language features for embedded languages #47288

@aeschli

Description

@aeschli

In VSCode each file is associated with a language. Language supports such as code completion, hovers, are contributed to that language. This is ideally through a language server.
When a language allows to embedded snippets of an other language (e.g. CSS in HTML or HTML in PHP) there are various techniques that a language server can use:

  • The language server also implements support for the embedded language. It can do that by including libraries that provide that support. For example there are easy to use node modules for css, less, scss, html and json or more basic language supports for typescript
  • Forward requests to an other language server as done in intelephense

The first approach has the following advantages

  • Full control of the user experience. Completion proposals, hovers... can be tuned to apply to the situation.
  • No dependencies on other language servers, self contained server that is easy to embedded also in other editors or IDE.

In either case the embedded content needs to be escaped according to the owner language. E.g > needs to be &gt.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions