You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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);
What's the proper way of doing it?
//Eivind
The text was updated successfully, but these errors were encountered:
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
The text was updated successfully, but these errors were encountered: