Skip to content

Commit

Permalink
fix: doesn't respect html.autoCreateQuotes setting
Browse files Browse the repository at this point in the history
close #840
  • Loading branch information
johnsoncodehk committed Mar 21, 2022
1 parent 99ed3c8 commit b32be70
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
14 changes: 10 additions & 4 deletions packages/vue-language-service/src/commonPlugins/html.ts
Expand Up @@ -8,6 +8,7 @@ export default function (host: {
documentContext?: html.DocumentContext,
fileSystemProvider?: html.FileSystemProvider,
validLang?: string,
disableCustomData?: boolean,
}): EmbeddedLanguageServicePlugin & {
htmlLs: html.LanguageService,
getHtmlDocument(document: TextDocument): html.HTMLDocument | undefined,
Expand All @@ -20,10 +21,15 @@ export default function (host: {
let inited = false;
let customData: html.IHTMLDataProvider[] = [];

host.configurationHost?.onDidChangeConfiguration(async () => {
customData = await getCustomData();
htmlLs.setDataProviders(true, customData);
});
if (host.disableCustomData) {
inited = true;
}
else {
host.configurationHost?.onDidChangeConfiguration(async () => {
customData = await getCustomData();
htmlLs.setDataProviders(true, customData);
});
}

return {

Expand Down
1 change: 1 addition & 0 deletions packages/vue-language-service/src/documentService.ts
Expand Up @@ -47,6 +47,7 @@ export function getDocumentService(

// language support plugins
const vuePlugin = useVuePlugin({
configurationHost,
getVueDocument,
scriptTsLs: undefined,
});
Expand Down
1 change: 1 addition & 0 deletions packages/vue-language-service/src/languageService.ts
Expand Up @@ -120,6 +120,7 @@ export function createLanguageService(
const customPlugins = _customPlugins.map(plugin => defineLanguageServicePlugin(plugin));
const vuePlugin = defineLanguageServicePlugin(
useVuePlugin({
configurationHost,
getVueDocument: (document) => vueDocuments.get(document.uri),
scriptTsLs,
}),
Expand Down
8 changes: 6 additions & 2 deletions packages/vue-language-service/src/vuePlugins/vue.ts
Expand Up @@ -5,7 +5,7 @@ import useHtmlPlugin from '../commonPlugins/html';
import * as vscode from 'vscode-languageserver-protocol';
import type * as ts2 from '@volar/typescript-language-service';
import { VueDocument } from '../vueDocuments';
import { EmbeddedLanguageServicePlugin } from '@volar/vue-language-service-types';
import { ConfigurationHost, EmbeddedLanguageServicePlugin } from '@volar/vue-language-service-types';

const dataProvider = html.newHTMLDataProvider('vue', {
version: 1.1,
Expand Down Expand Up @@ -93,11 +93,15 @@ const dataProvider = html.newHTMLDataProvider('vue', {
});

export default function (host: {
configurationHost?: ConfigurationHost,
getVueDocument(document: TextDocument): VueDocument | undefined,
scriptTsLs: ts2.LanguageService | undefined,
}): EmbeddedLanguageServicePlugin {

const htmlPlugin = useHtmlPlugin({ validLang: 'vue' });
const htmlPlugin = useHtmlPlugin({
configurationHost: host.configurationHost,
validLang: 'vue',
});
htmlPlugin.htmlLs.setDataProviders(false, [dataProvider]);

return {
Expand Down

0 comments on commit b32be70

Please sign in to comment.