提交 1e301ede 编写于 作者: A AdrieanKhisbe

Grammar Injection - Consider broader Scopes

In order to be able to inject grammar to all language without having to enumerate all of them.

With this, we could use
```json
"grammars": [
     {
     "injectTo": ["source", "text"....]
// ....
}
     ]
```
instead of :
```json
"grammars": [
     {
     "injectTo": ["source.js", "source.ts", "source.jsx", "source.yaml", ....]
// ....
}
     ]
```
上级 4eaf5834
......@@ -205,7 +205,13 @@ export class TextMateService implements ITextMateService {
return this._scopeRegistry.getFilePath(scopeName);
},
getInjections: (scopeName: string) => {
return this._injections[scopeName];
const scopeParts = scopeName.split('.');
let injections: string[] = [];
for (let i = 1; i <= scopeParts.length; i++) {
const subScopeName = scopeParts.slice(0, i).join('.');
injections = [...injections, ...this._injections[subScopeName]];
}
return injections;
}
});
this._updateTheme(grammarRegistry);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册