Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jlelong/vscode-extend-language
Generate a new language configuration file for VS Code by extending an existing one
https://github.com/jlelong/vscode-extend-language
Last synced: 23 days ago
JSON representation
Generate a new language configuration file for VS Code by extending an existing one
- Host: GitHub
- URL: https://github.com/jlelong/vscode-extend-language
- Owner: jlelong
- License: mit
- Created: 2021-12-17T12:25:03.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-30T05:07:01.000Z (8 months ago)
- Last Synced: 2024-10-30T10:49:15.617Z (2 months ago)
- Language: JavaScript
- Size: 570 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Utility to extend languages in VS Code
Currently, it is not possible to build a new language as an extension of an existing one, the `language-configuration.json` file must be self-contained. This can lead to tedious maintenance as changes to the base language have to be forwarded manually. This package aims at helping language developers.
Assume you wand to derive a new language configuration from `A-language-configuration.json`, you just need to define a file let us say `B.extension.language-configuration.json` containing
```json
{
"extends": "path/to/A-language-configuration.json",
"overrides": {
"comments": {
"blockComment": [
""
]
},
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"],
["$", "$"],
["`", "`"],
["_", "_"],
["*", "*"]
],
},
"folding": {
"offSide": true,
"markers": {
"start": "^\\s*",
"end": "^\\s*"
}
}
}
```- `extends` means that language `B` is based on the language configuration of language `A`. `path/to/A-language-configuration.json` can either be a relative local path to `A-language-configuration.json` or an url.
- The `overrides` section allows to replace some settings of `A-language-configuration.json` by their new values in `B`.
- Everything outside the `overrides` section is added to the `B` configuration. If the key already exists in `A-language-configuration.json`, it must be an array and in this case their contents are concatenated.To obtain the self-contained language configuration file for `B`, `B.language-configuration.json`, use
```js
const vel = require('vscode-extend-language')vel.expandConfigurationFile('./B.extension.language-configuration.json', './B.language-configuration.json')
```