A VSCode Extension to support some specific language features for languages which are embedded into other languages.
Currently, it supports the basic autocompletion and hover prompt for sql, javascript, css and html. These languages are recoginzed by specific sign pairs using RegEx. The result of autocompletion and hover prompt are related to recoginezd embedded language itself.
Here are some concepts used in this extension:
Concept | Description |
---|---|
External Language | The original language of a file. |
Embedded Language | A language which is embedded into the external languages. |
Sign Pair | A pair of text which is used to mark and recognize embedded languages. Always the signs will be comments of such embedded language. |
- autocomplete - base support
- hover - base support
- highlight - which has been supported in another extension highlight-string-code. However, the matching logic of nested sign pairs are different from this extension now.
- more features will be support.
Language | Start Sign | End Sign | Comment |
---|---|---|---|
SQL | `-- *(beginsql | begin-sql).*` | `-- *(endsql |
HTML | <!-- *html.*--> |
<!-- *!html.*--> |
|
JS | \/\/ *js.* |
\/\/ *!js.* |
|
CSS | \/\* *css.*\*\/ |
\/\* *!css.*\*\/ |
- Latest Visual Studio Code is recommended.
This extension contributes the following settings:
PEL.enabledEmbeddedLanguages
: Specifies what embedded languages will be recognized.PEL.enabledExternalLanguages
: Specifies files of what external languages the extension will monitor.
- Implement basic support for auto completion and hovering
- Initial release
More release notes can be found at CHANGELOG.md.
See known issue for more infomation.
This extension is based on the Request Forwarding method in VSCode official doc of embedded languages.
Work Flow:
- Client
- The extension will scan the whole code text when typing any character.
- Recognize the language at the position of cursor.
- If language is an embedded language, all corresponding code will be extracted from the file.
- Call correspond functions to supported feature.
- general embedded langs recognition
- refresh status when configuration are changed
-
dynamic importing third-part language server modules (not need anymore) - common virtual document extraction
- customize embedded language settings, including sign pairs, name and suffix.
- popup a notfication when extension updated.
- Chinese document.
- language recognition test
- language extraction test
- Visual Studio Code Extension API