mapEdit() — astro Function Reference
Architecture documentation for the mapEdit() function in utils.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD cb2e3701_274b_40fb_bdb8_1aef7135e3da["mapEdit()"] 16797996_1eb4_d7a9_ad38_47fe954cb188["utils.ts"] cb2e3701_274b_40fb_bdb8_1aef7135e3da -->|defined in| 16797996_1eb4_d7a9_ad38_47fe954cb188 style cb2e3701_274b_40fb_bdb8_1aef7135e3da fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/language-tools/language-server/src/plugins/typescript/utils.ts lines 5–19
export function mapEdit(edit: TextEdit, code: AstroVirtualCode, languageId: string) {
// Don't attempt to move the edit to the frontmatter if the file isn't the root TSX file, it means it's a script tag
if (languageId === 'typescriptreact') {
if (editShouldBeInFrontmatter(edit.range, code.astroMeta).itShould) {
edit = ensureProperEditForFrontmatter(edit, code.astroMeta, '\n');
}
} else {
// If the edit is at the start of the file, add a newline before it, otherwise we'll get `<script>text`
if (edit.range.start.line === 0 && edit.range.start.character === 0) {
edit.newText = '\n' + edit.newText;
}
}
return edit;
}
Domain
Subdomains
Source
Frequently Asked Questions
What does mapEdit() do?
mapEdit() is a function in the astro codebase, defined in packages/language-tools/language-server/src/plugins/typescript/utils.ts.
Where is mapEdit() defined?
mapEdit() is defined in packages/language-tools/language-server/src/plugins/typescript/utils.ts at line 5.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free