snippets.ts — astro Source File
Architecture documentation for snippets.ts, a typescript file in the astro codebase. 2 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR f60dedc5_1402_7c07_f5a8_da94c037c1fd["snippets.ts"] 5d635c24_aea1_c7f7_2c64_4fe0f5e4041b["../core/parseAstro.js"] f60dedc5_1402_7c07_f5a8_da94c037c1fd --> 5d635c24_aea1_c7f7_2c64_4fe0f5e4041b 6857b6b2_4d48_bfb0_0a0e_8e2e52fabb56["language-server"] f60dedc5_1402_7c07_f5a8_da94c037c1fd --> 6857b6b2_4d48_bfb0_0a0e_8e2e52fabb56 style f60dedc5_1402_7c07_f5a8_da94c037c1fd fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { type CompletionItem, CompletionItemKind, TextEdit } from '@volar/language-server';
import type { FrontmatterStatus } from '../../core/parseAstro.js';
export function getSnippetCompletions(frontmatter: FrontmatterStatus): CompletionItem[] {
if (frontmatter.status === 'doesnt-exist') return [];
const frontmatterStartPosition = {
line: frontmatter.position.start.line,
character: frontmatter.position.start.column - 1,
};
return [
{
label: 'interface Props',
kind: CompletionItemKind.Snippet,
labelDetails: { description: 'Create a new interface to type your props' },
documentation: {
kind: 'markdown',
value: [
'Create a new interface to type your props.',
'\n',
'[Astro reference](https://docs.astro.build/en/guides/typescript/#component-props)',
].join('\n'),
},
insertTextFormat: 2,
filterText: 'interface props',
insertText: 'interface Props {\n\t$1\n}',
},
{
label: 'getStaticPaths',
kind: CompletionItemKind.Snippet,
labelDetails: { description: 'Create a new getStaticPaths function' },
documentation: {
kind: 'markdown',
value: [
'Create a new getStaticPaths function.',
'\n',
'[Astro reference](https://docs.astro.build/en/reference/routing-reference/#getstaticpaths)',
].join('\n'),
},
insertText:
'export const getStaticPaths = (() => {\n\t$1\n\treturn [];\n}) satisfies GetStaticPaths;',
additionalTextEdits: [
TextEdit.insert(frontmatterStartPosition, 'import type { GetStaticPaths } from "astro";\n'),
],
filterText: 'getstaticpaths',
insertTextFormat: 2,
},
{
label: 'prerender',
kind: CompletionItemKind.Snippet,
labelDetails: { description: 'Add prerender export' },
documentation: {
kind: 'markdown',
value: [
'Add prerender export. When [using server-side rendering](https://docs.astro.build/en/guides/on-demand-rendering/#enabling-on-demand-rendering), this value will be used to determine whether to prerender the page or not.',
'\n',
'[Astro reference](https://docs.astro.build/en/reference/routing-reference/#prerender)',
].join('\n'),
},
insertText: 'export const prerender = ${1|true,false|}',
insertTextFormat: 2,
},
];
}
Domain
Subdomains
Functions
Dependencies
- ../core/parseAstro.js
- language-server
Source
Frequently Asked Questions
What does snippets.ts do?
snippets.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 snippets.ts?
snippets.ts defines 1 function(s): getSnippetCompletions.
What does snippets.ts depend on?
snippets.ts imports 2 module(s): ../core/parseAstro.js, language-server.
Where is snippets.ts in the architecture?
snippets.ts is located at packages/language-tools/language-server/src/plugins/typescript-addons/snippets.ts (domain: CoreAstro, subdomain: RoutingSystem, directory: packages/language-tools/language-server/src/plugins/typescript-addons).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free