I'm working on an LSP server and I'm testing if i can leverage the parseHtmlDocument from this service.
To do that i need to add some customData/customTags that are recognized by the service, but I'm having some issues figuring out how to inject it properly.
I've tried initializing the languageService witha IHTMLDataProvider object:
// Define custom tags
const customTags = [
{ name: '<%', kind: 'startTag' },
{ name: '%>', kind: 'endTag' }
];
// Custom data provider function
const customDataProvider: html.IHTMLDataProvider = {
getId: () => 'customDataProvider',
isApplicable: () => true,
provideTags: () => {
return customTags.map(tag => ({
name: tag.name,
kind: tag.kind,
selfClosing: false,
attributes: [] // empty array for attributes
}));
},
provideAttributes: () => [], // empty array for attributes
provideValues: () => [] // empty array for values
};
// Initialize language service options with custom data provider
const languageServiceOptions: html.LanguageServiceOptions = {
customDataProviders: [customDataProvider]
};
// Initialize language service
const htmlLs = html.getLanguageService(languageServiceOptions);
Hello,
I'm working on an LSP server and I'm testing if i can leverage the parseHtmlDocument from this service. To do that i need to add some customData/customTags that are recognized by the service, but I'm having some issues figuring out how to inject it properly.
I've tried initializing the languageService witha IHTMLDataProvider object:
What's the proper way of doing it?
//Eivind