Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate language server json.customBlockSchemaUrls option #3398

Merged
merged 1 commit into from Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 0 additions & 3 deletions packages/vscode-vue/package.json
Expand Up @@ -426,9 +426,6 @@
"type": "boolean",
"default": false
},
"vue.server.json.customBlockSchemaUrls": {
"type": "object"
},
"vue.server.diagnosticModel": {
"type": "string",
"default": "push",
Expand Down
6 changes: 1 addition & 5 deletions packages/vscode-vue/src/common.ts
Expand Up @@ -214,11 +214,7 @@ async function getInitializationOptions(
tokenTypes: ['component'],
tokenModifiers: [],
};
options.fullCompletionList = config.server.fullCompletionList,
// vue
options.json = {
customBlockSchemaUrls: config.server.json.customBlockSchemaUrls,
};
options.fullCompletionList = config.server.fullCompletionList;
options.additionalExtensions = [
...config.server.additionalExtensions,
...!config.server.petiteVue.supportHtmlFile ? [] : ['html'],
Expand Down
3 changes: 0 additions & 3 deletions packages/vscode-vue/src/config.ts
Expand Up @@ -29,9 +29,6 @@ export const config = {
petiteVue: {
supportHtmlFile: boolean;
};
json: {
customBlockSchemaUrls: Record<string, string>;
};
}> {
return _config().get('server')!;
},
Expand Down
20 changes: 0 additions & 20 deletions packages/vue-language-server/src/languageServerPlugin.ts
Expand Up @@ -35,7 +35,6 @@ export function createServerPlugin(connection: Connection) {
async resolveConfig(config, ctx) {

const vueOptions = await getVueCompilerOptions();
const vueLanguageServiceSettings = getVueLanguageServiceSettings();

if (ctx) {
hostToVueOptions.set(ctx.host, vue.resolveVueCompilerOptions(vueOptions));
Expand All @@ -46,7 +45,6 @@ export function createServerPlugin(connection: Connection) {
ctx?.host.getCompilationSettings() ?? {},
vueOptions,
ts,
vueLanguageServiceSettings,
initOptions.codegenStack,
);

Expand Down Expand Up @@ -81,24 +79,6 @@ export function createServerPlugin(connection: Connection) {

return vueOptions;
}

function getVueLanguageServiceSettings() {

const settings: vue.Settings = {};

if (initOptions.json && ctx) {
settings.json = { schemas: [] };
for (const blockType in initOptions.json.customBlockSchemaUrls) {
const url = initOptions.json.customBlockSchemaUrls[blockType];
settings.json.schemas?.push({
fileMatch: [`*.customBlock_${blockType}_*.json*`],
uri: new URL(url, ctx.project.rootUri.toString() + '/').toString(),
});
}
}

return settings;
}
},
onInitialized(getService, env) {

Expand Down
3 changes: 0 additions & 3 deletions packages/vue-language-server/src/types.ts
@@ -1,9 +1,6 @@
import { InitializationOptions } from "@volar/language-server";

export type VueServerInitializationOptions = InitializationOptions & {
json?: {
customBlockSchemaUrls?: Record<string, string>;
};
/**
* @example ['vue1', 'vue2']
*/
Expand Down
6 changes: 2 additions & 4 deletions packages/vue-language-service/src/languageService.ts
Expand Up @@ -34,15 +34,14 @@ export function resolveConfig(
compilerOptions: ts.CompilerOptions = {},
vueCompilerOptions: Partial<vue.VueCompilerOptions> = {},
ts: typeof import('typescript/lib/tsserverlibrary') = require('typescript'),
settings?: Settings,
codegenStack: boolean = false,
) {

const resolvedVueCompilerOptions = vue.resolveVueCompilerOptions(vueCompilerOptions);
const vueLanguageModules = vue.createLanguages(compilerOptions, resolvedVueCompilerOptions, ts, codegenStack);

config.languages = Object.assign({}, vueLanguageModules, config.languages);
config.services = resolvePlugins(config.services, resolvedVueCompilerOptions, settings);
config.services = resolvePlugins(config.services, resolvedVueCompilerOptions);

return config;
}
Expand All @@ -52,7 +51,6 @@ const unicodeReg = /\\u/g;
function resolvePlugins(
services: Config['services'],
vueCompilerOptions: VueCompilerOptions,
settings?: Settings,
) {

const originalTsPlugin: Service = services?.typescript ?? createTsService();
Expand Down Expand Up @@ -284,7 +282,7 @@ function resolvePlugins(
services.vue ??= createVueService();
services.css ??= createCssService();
services['pug-beautify'] ??= createPugFormatService();
services.json ??= createJsonService(settings?.json);
services.json ??= createJsonService();
services['typescript/twoslash-queries'] ??= createTsTqService();
services['vue/referencesCodeLens'] ??= createReferencesCodeLensService();
services['vue/autoInsertDotValue'] ??= createAutoDotValueService();
Expand Down