问题
What I'd like to do is create an extension that extends HTML support - that is it does everything that HTML support does and more, which includes the following:
- Syntax Highlighting (colorizer)
- IntelliSense
- Format HTML
- Emmet snippets
These details are listed on this page HTML Programming in VS Code
Ultimately I would like to create an extension that supports Liquid Templating syntax highlighting and auto complete.
I've gotten #1 to work on it's own as a colorizer, and #2 can be accomplished through a language server.
Since Liquid expressions are inserted into HTML documents, the plugin should be built top of/extend HTML support rather than override it. Is this possible?
回答1:
It doesn't look like this is possible as an extension. Looking at the source code src\vs\languages\html\common
, if I want to extend an existing built in language support, then I can create a class extension.
For example, Handlebars
language support is an extension of HTML
and is implemented thusly:
// handlebars.ts
import htmlMode = require('vs/languages/html/common/html');
export class HandlebarsState extends htmlMode.State { ... }
export class HandlebarsMode extends htmlMode.HTMLMode<htmlWorker.HTMLWorker> { ... }
So in my particular case, I'll either want to extend HTML or Handlebars (I haven't determined which makes more sense yet) in order to add Liquid
language support.
来源:https://stackoverflow.com/questions/38404182/can-i-extend-an-existing-colorizer-or-language-in-vs-code