Home / File/ yaml.ts — astro Source File

yaml.ts — astro Source File

Architecture documentation for yaml.ts, a typescript file in the astro codebase. 5 imports, 0 dependents.

File typescript CoreAstro RoutingSystem 5 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  5e9b95b7_b879_26fe_0542_7582ae13ba27["yaml.ts"]
  0e94d234_63d6_9e3a_18cc_17c52f493c38["../core/frontmatterHolders.js"]
  5e9b95b7_b879_26fe_0542_7582ae13ba27 --> 0e94d234_63d6_9e3a_18cc_17c52f493c38
  6857b6b2_4d48_bfb0_0a0e_8e2e52fabb56["language-server"]
  5e9b95b7_b879_26fe_0542_7582ae13ba27 --> 6857b6b2_4d48_bfb0_0a0e_8e2e52fabb56
  1b7f3f22_7c1e_f584_78bf_c28212c711a6["language-service"]
  5e9b95b7_b879_26fe_0542_7582ae13ba27 --> 1b7f3f22_7c1e_f584_78bf_c28212c711a6
  897e257c_ec79_bb03_b606_075eeb136a80["volar-service-yaml"]
  5e9b95b7_b879_26fe_0542_7582ae13ba27 --> 897e257c_ec79_bb03_b606_075eeb136a80
  abeb339e_cdba_0d7f_6b7f_3696c1eb86f9["vscode-uri"]
  5e9b95b7_b879_26fe_0542_7582ae13ba27 --> abeb339e_cdba_0d7f_6b7f_3696c1eb86f9
  style 5e9b95b7_b879_26fe_0542_7582ae13ba27 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { Diagnostic, DiagnosticSeverity, MarkupContent, Range } from '@volar/language-server';
import type { LanguageServicePlugin } from '@volar/language-service';
import type { Provide } from 'volar-service-yaml';
import { create as createYAMLService } from 'volar-service-yaml';
import { URI, Utils } from 'vscode-uri';
import type { CollectionConfig } from '../core/frontmatterHolders.js';
import {
	FrontmatterHolder,
	SUPPORTED_FRONTMATTER_EXTENSIONS_KEYS,
} from '../core/frontmatterHolders.js';

type LanguageSettings = Parameters<ReturnType<Provide['yaml/languageService']>['configure']>['0'];

export function getSettings(collectionConfig: CollectionConfig): LanguageSettings {
	const schemas = collectionConfig.configs.flatMap((workspaceCollectionConfig) => {
		return workspaceCollectionConfig.config.collections.flatMap((collection) => {
			return {
				fileMatch: SUPPORTED_FRONTMATTER_EXTENSIONS_KEYS.map(
					(ext) => `volar-embedded-content://yaml_frontmatter_${collection.name}/**/*${ext}`,
				),
				uri: Utils.joinPath(
					workspaceCollectionConfig.folder,
					'.astro/collections',
					`${collection.name}.schema.json`,
				).toString(),
			};
		});
	});

	return {
		completion: true,
		format: false,
		hover: true,
		validate: true,
		customTags: [],
		yamlVersion: '1.2',
		isKubernetes: false,
		parentSkeletonSelectedFirst: false,
		disableDefaultProperties: false,
		schemas: schemas,
	};
}

export const create = (collectionConfig: CollectionConfig): LanguageServicePlugin => {
	const yamlPlugin = createYAMLService({
		getLanguageSettings: () => getSettings(collectionConfig),
	}) as LanguageServicePlugin<Provide>;

	return {
		...yamlPlugin,
		capabilities: {
			...yamlPlugin.capabilities,
			codeLensProvider: undefined,
		},
		create(context) {
			const yamlPluginInstance = yamlPlugin.create(context);

			const languageService = yamlPluginInstance.provide?.['yaml/languageService']();
			if (languageService && context.env.onDidChangeWatchedFiles) {
				context.env.onDidChangeWatchedFiles(async (events) => {
// ... (89 more lines)

Domain

Subdomains

Dependencies

  • ../core/frontmatterHolders.js
  • language-server
  • language-service
  • volar-service-yaml
  • vscode-uri

Frequently Asked Questions

What does yaml.ts do?
yaml.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RoutingSystem subdomain.
What functions are defined in yaml.ts?
yaml.ts defines 2 function(s): create, getSettings.
What does yaml.ts depend on?
yaml.ts imports 5 module(s): ../core/frontmatterHolders.js, language-server, language-service, volar-service-yaml, vscode-uri.
Where is yaml.ts in the architecture?
yaml.ts is located at packages/language-tools/language-server/src/plugins/yaml.ts (domain: CoreAstro, subdomain: RoutingSystem, directory: packages/language-tools/language-server/src/plugins).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free