@soda-gql/lsp 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -0
- package/dist/bin.cjs +13 -0
- package/dist/bin.cjs.map +1 -0
- package/dist/bin.d.cts +1 -0
- package/dist/bin.d.mts +1 -0
- package/dist/bin.mjs +14 -0
- package/dist/bin.mjs.map +1 -0
- package/dist/index.cjs +8 -0
- package/dist/index.d.cts +254 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +254 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3 -0
- package/dist/server-0Mbk3BXO.cjs +4408 -0
- package/dist/server-0Mbk3BXO.cjs.map +1 -0
- package/dist/server-BgXl3W41.mjs +4345 -0
- package/dist/server-BgXl3W41.mjs.map +1 -0
- package/index.d.ts +2 -0
- package/index.js +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-0Mbk3BXO.cjs","names":["inString: false | '\"' | \"'\"","match: RegExpExecArray | null","module","declaration: ImportDeclaration | null","templates: ExtractedTemplate[]","elementName: string | undefined","typeName: string | undefined","parts: string[]","visit","fragments: IndexedFragment[]","parseSyncFn: typeof import(\"@swc/core\").parseSync | null","state: DocumentState","result: IndexedFragment[]","locations: FragmentSpreadLocation[]","match: RegExpExecArray | null","offsets: number[]","positionToOffset","documents: DocumentNode[]","files: SchemaFileInfo[]","resolver: SchemaResolver","errors: LspError[]","sep","errors: LspError[]","integer","uinteger","MarkupKind","SelectionRange","TextDocument","undefined","positionToOffset","ast: ReturnType<typeof parse>","TypeInfo","replaceEdit: TextEdit","insertEdit: TextEdit","result: ExtractResult | null","ts","lastToken: ts.SyntaxKind","positionToOffset","found: FragmentSpreadNode | null","match: RegExpExecArray | null","ranges: FragmentRange[]","result: ObjectTypeInfo[]","positionToOffset","positionToOffset","KIND_MAP: Record<string, SymbolKind>","children: DocumentSymbol[]","symbols: DocumentSymbol[]","toContentPos: PositionConverter","positionToOffset","defaultFormatGraphql: FormatGraphqlFn","edits: TextEdit[]","formatted: string","positionToOffset","contents: MarkupContent","positionToOffset","locations: Location[]","positionToOffset","changes: Record<string, TextEdit[]>","ProposedFeatures","TextDocuments","TextDocument","registry: ConfigRegistry | undefined","swcNotification: SwcNotificationState","TextDocumentSyncKind","DidChangeWatchedFilesNotification","FileChangeType"],"sources":["../src/fragment-args-preprocessor.ts","../src/document-manager.ts","../src/errors.ts","../src/position-mapping.ts","../src/schema-resolver.ts","../src/config-registry.ts","../../../node_modules/vscode-languageserver-types/lib/esm/main.js","../src/handlers/code-action.ts","../src/handlers/completion.ts","../src/handlers/_utils.ts","../src/handlers/definition.ts","../src/handlers/diagnostics.ts","../src/handlers/document-symbol.ts","../src/handlers/formatting.ts","../src/handlers/hover.ts","../src/handlers/references.ts","../src/handlers/rename.ts","../src/server.ts"],"sourcesContent":["/**\n * Preprocessor for Fragment Arguments RFC syntax.\n *\n * Strips fragment argument declarations and spread arguments by replacing\n * them with equal-length whitespace to preserve line/column alignment.\n *\n * @module\n */\n\n/** Result of fragment arguments preprocessing. */\nexport type PreprocessResult = {\n /** Content with Fragment Arguments syntax replaced by whitespace. */\n readonly preprocessed: string;\n /** Whether any preprocessing was applied. */\n readonly modified: boolean;\n};\n\n/**\n * Find the matching closing parenthesis for a balanced group.\n * Handles nested parentheses, string literals, and comments.\n * Returns the index of the closing ')' or -1 if not found.\n */\nconst findMatchingParen = (content: string, openIndex: number): number => {\n let depth = 1;\n let inString: false | '\"' | \"'\" = false;\n\n for (let i = openIndex + 1; i < content.length; i++) {\n const ch = content[i];\n if (ch === undefined) break;\n\n if (inString) {\n if (ch === inString) {\n let backslashes = 0;\n for (let j = i - 1; j >= 0 && content[j] === \"\\\\\"; j--) {\n backslashes++;\n }\n if (backslashes % 2 === 0) {\n inString = false;\n }\n }\n continue;\n }\n\n if (ch === '\"' || ch === \"'\") {\n inString = ch;\n continue;\n }\n\n if (ch === \"(\") {\n depth++;\n } else if (ch === \")\") {\n depth--;\n if (depth === 0) {\n return i;\n }\n }\n }\n\n return -1;\n};\n\n/**\n * Replace a range [start, end] (inclusive) with spaces, preserving newlines.\n */\nconst replaceWithSpaces = (content: string, start: number, end: number): string => {\n let result = content.slice(0, start);\n for (let i = start; i <= end; i++) {\n result += content[i] === \"\\n\" ? \"\\n\" : \" \";\n }\n result += content.slice(end + 1);\n return result;\n};\n\n// Pattern: fragment Name( at word boundary — old reconstructed format (args before \"on Type\")\nconst FRAGMENT_DEF_PATTERN = /\\bfragment\\s+(\\w+)\\s*\\(/g;\n\n// Pattern: fragment Name on Type ( — curried reconstructed format (args after \"on Type\")\nconst FRAGMENT_DEF_CURRIED_PATTERN = /\\bfragment\\s+\\w+\\s+on\\s+\\w+\\s*\\(/g;\n\n// Pattern: ...FragmentName(\nconst FRAGMENT_SPREAD_PATTERN = /\\.\\.\\.(\\w+)\\s*\\(/g;\n\n/**\n * Preprocess Fragment Arguments RFC syntax by replacing argument lists with spaces.\n *\n * Transforms:\n * - `fragment UserProfile($showEmail: Boolean = false) on User` → `fragment UserProfile on User`\n * - `...UserProfile(showEmail: true)` → `...UserProfile `\n */\nexport const preprocessFragmentArgs = (content: string): PreprocessResult => {\n let result = content;\n let modified = false;\n\n // Pass 1: Fragment definition arguments\n // Match \"fragment Name(\" and find the matching \")\" to strip\n let match: RegExpExecArray | null;\n FRAGMENT_DEF_PATTERN.lastIndex = 0;\n while ((match = FRAGMENT_DEF_PATTERN.exec(result)) !== null) {\n const openParenIndex = match.index + match[0].length - 1;\n\n // Check that the next non-whitespace after \")\" is \"on\" (to distinguish from non-fragment-args parens)\n const closeParenIndex = findMatchingParen(result, openParenIndex);\n if (closeParenIndex === -1) {\n continue;\n }\n\n // Verify this is a fragment definition (followed by \"on\")\n const afterParen = result.slice(closeParenIndex + 1).trimStart();\n if (!afterParen.startsWith(\"on\")) {\n continue;\n }\n\n result = replaceWithSpaces(result, openParenIndex, closeParenIndex);\n modified = true;\n // Reset regex since we modified the string (positions may shift)\n FRAGMENT_DEF_PATTERN.lastIndex = 0;\n }\n\n // Pass 1b: Fragment definition arguments (curried reconstructed format: fragment Name on Type ($args) { ... })\n FRAGMENT_DEF_CURRIED_PATTERN.lastIndex = 0;\n while ((match = FRAGMENT_DEF_CURRIED_PATTERN.exec(result)) !== null) {\n const openParenIndex = match.index + match[0].length - 1;\n const closeParenIndex = findMatchingParen(result, openParenIndex);\n if (closeParenIndex === -1) {\n continue;\n }\n\n // Verify this is followed by \"{\" (fragment body)\n const afterParen = result.slice(closeParenIndex + 1).trimStart();\n if (!afterParen.startsWith(\"{\")) {\n continue;\n }\n\n result = replaceWithSpaces(result, openParenIndex, closeParenIndex);\n modified = true;\n FRAGMENT_DEF_CURRIED_PATTERN.lastIndex = 0;\n }\n\n // Pass 2: Fragment spread arguments\n FRAGMENT_SPREAD_PATTERN.lastIndex = 0;\n while ((match = FRAGMENT_SPREAD_PATTERN.exec(result)) !== null) {\n const openParenIndex = match.index + match[0].length - 1;\n const closeParenIndex = findMatchingParen(result, openParenIndex);\n if (closeParenIndex === -1) {\n continue;\n }\n\n result = replaceWithSpaces(result, openParenIndex, closeParenIndex);\n modified = true;\n FRAGMENT_SPREAD_PATTERN.lastIndex = 0;\n }\n\n return { preprocessed: result, modified };\n};\n","/**\n * Document manager: tracks open documents and extracts tagged templates using SWC.\n * @module\n */\n\nimport { createRequire } from \"node:module\";\nimport { fileURLToPath } from \"node:url\";\nimport type { GraphqlSystemIdentifyHelper } from \"@soda-gql/builder\";\nimport { createSwcSpanConverter, type SwcSpanConverter } from \"@soda-gql/common\";\nimport type {\n ArrowFunctionExpression,\n CallExpression,\n Expression,\n ImportDeclaration,\n MemberExpression,\n Module,\n Node,\n TaggedTemplateExpression,\n} from \"@swc/types\";\nimport { type FragmentDefinitionNode, parse, visit } from \"graphql\";\nimport { preprocessFragmentArgs } from \"./fragment-args-preprocessor\";\nimport type { DocumentState, ExtractedTemplate, FragmentSpreadLocation, IndexedFragment, OperationKind } from \"./types\";\n\nexport type DocumentManager = {\n readonly update: (uri: string, version: number, source: string) => DocumentState;\n readonly get: (uri: string) => DocumentState | undefined;\n readonly remove: (uri: string) => void;\n readonly findTemplateAtOffset: (uri: string, offset: number) => ExtractedTemplate | undefined;\n /** Get fragments from other documents for a given schema, excluding the specified URI. */\n readonly getExternalFragments: (uri: string, schemaName: string) => readonly IndexedFragment[];\n /** Get ALL indexed fragments (including self) for a given schema. */\n readonly getAllFragments: (schemaName: string) => readonly IndexedFragment[];\n /** Find all fragment spread locations across all documents for a given fragment name and schema. */\n readonly findFragmentSpreadLocations: (fragmentName: string, schemaName: string) => readonly FragmentSpreadLocation[];\n};\n\ntype SwcLoaderOptions = {\n /** Override parseSync for testing. Pass null to simulate SWC unavailable. */\n readonly parseSync?: typeof import(\"@swc/core\").parseSync | null;\n /** Config file path used as the base for createRequire resolution of @swc/core. */\n readonly resolveFrom?: string;\n};\n\nconst OPERATION_KINDS = new Set<string>([\"query\", \"mutation\", \"subscription\", \"fragment\"]);\n\nconst isOperationKind = (value: string): value is OperationKind => OPERATION_KINDS.has(value);\n\n/**\n * Collect gql identifiers from import declarations.\n * Adapted from builder's collectGqlIdentifiers pattern.\n */\nconst collectGqlIdentifiers = (module: Module, filePath: string, helper: GraphqlSystemIdentifyHelper): ReadonlySet<string> => {\n const identifiers = new Set<string>();\n\n for (const item of module.body) {\n let declaration: ImportDeclaration | null = null;\n\n if (item.type === \"ImportDeclaration\") {\n declaration = item;\n } else if (\n \"declaration\" in item &&\n item.declaration &&\n // biome-ignore lint/suspicious/noExplicitAny: SWC AST type checking\n (item.declaration as any).type === \"ImportDeclaration\"\n ) {\n declaration = item.declaration as unknown as ImportDeclaration;\n }\n\n if (!declaration) {\n continue;\n }\n\n if (!helper.isGraphqlSystemImportSpecifier({ filePath, specifier: declaration.source.value })) {\n continue;\n }\n\n for (const specifier of declaration.specifiers ?? []) {\n if (specifier.type === \"ImportSpecifier\") {\n const imported = specifier.imported ? specifier.imported.value : specifier.local.value;\n if (imported === \"gql\" && !specifier.imported) {\n identifiers.add(specifier.local.value);\n }\n }\n }\n }\n\n return identifiers;\n};\n\n/**\n * Check if a call expression is a gql.{schemaName}(...) call.\n * Returns the schema name if it is, null otherwise.\n */\nconst getGqlCallSchemaName = (identifiers: ReadonlySet<string>, call: CallExpression): string | null => {\n const callee = call.callee;\n if (callee.type !== \"MemberExpression\") {\n return null;\n }\n\n const member = callee as MemberExpression;\n if (member.object.type !== \"Identifier\" || !identifiers.has(member.object.value)) {\n return null;\n }\n\n if (member.property.type !== \"Identifier\") {\n return null;\n }\n\n const firstArg = call.arguments[0];\n if (!firstArg?.expression || firstArg.expression.type !== \"ArrowFunctionExpression\") {\n return null;\n }\n\n return member.property.value;\n};\n\n/**\n * Extract templates from a gql callback's arrow function body.\n * Handles both expression bodies and block bodies with return statements.\n */\nconst extractTemplatesFromCallback = (\n arrow: ArrowFunctionExpression,\n schemaName: string,\n spanOffset: number,\n converter: SwcSpanConverter,\n): ExtractedTemplate[] => {\n const templates: ExtractedTemplate[] = [];\n\n const processExpression = (expr: Expression): void => {\n // Direct tagged template: query(\"Name\")`...`\n if (expr.type === \"TaggedTemplateExpression\") {\n const tagged = expr as TaggedTemplateExpression;\n extractFromTaggedTemplate(tagged, schemaName, spanOffset, converter, templates);\n return;\n }\n\n // Metadata chaining: query(\"Name\")`...`({ metadata: {} })\n if (expr.type === \"CallExpression\") {\n const call = expr as CallExpression;\n if (call.callee.type === \"TaggedTemplateExpression\") {\n extractFromTaggedTemplate(call.callee as TaggedTemplateExpression, schemaName, spanOffset, converter, templates);\n }\n }\n };\n\n // Expression body: ({ query }) => query(\"Name\")`...`\n if (arrow.body.type !== \"BlockStatement\") {\n processExpression(arrow.body as Expression);\n return templates;\n }\n\n // Block body: ({ query }) => { return query(\"Name\")`...`; }\n for (const stmt of arrow.body.stmts) {\n if (stmt.type === \"ReturnStatement\" && stmt.argument) {\n processExpression(stmt.argument);\n }\n }\n\n return templates;\n};\n\nconst extractFromTaggedTemplate = (\n tagged: TaggedTemplateExpression,\n schemaName: string,\n spanOffset: number,\n converter: SwcSpanConverter,\n templates: ExtractedTemplate[],\n): void => {\n // Tag must be a CallExpression: query(\"name\")`...` or fragment(\"name\", \"type\")`...` (curried syntax)\n if (tagged.tag.type !== \"CallExpression\") {\n return;\n }\n\n const tagCall = tagged.tag as CallExpression;\n if (tagCall.callee.type !== \"Identifier\") {\n return;\n }\n\n const kind = tagCall.callee.value;\n if (!isOperationKind(kind)) {\n return;\n }\n\n // Extract element name and type name from curried call arguments\n let elementName: string | undefined;\n let typeName: string | undefined;\n const firstArg = tagCall.arguments[0]?.expression;\n if (firstArg?.type === \"StringLiteral\") {\n elementName = (firstArg as { value: string }).value;\n }\n const secondArg = tagCall.arguments[1]?.expression;\n if (secondArg?.type === \"StringLiteral\") {\n typeName = (secondArg as { value: string }).value;\n }\n\n const { quasis, expressions } = tagged.template;\n\n if (quasis.length === 0) {\n return;\n }\n\n // Build content by interleaving quasis with placeholder tokens\n const parts: string[] = [];\n let contentStart = -1;\n let contentEnd = -1;\n\n for (let i = 0; i < quasis.length; i++) {\n const quasi = quasis[i];\n if (!quasi) {\n continue;\n }\n\n // Track the overall content range (first quasi start to last quasi end)\n const quasiStart = converter.byteOffsetToCharIndex(quasi.span.start - spanOffset);\n const quasiEnd = converter.byteOffsetToCharIndex(quasi.span.end - spanOffset);\n\n if (contentStart === -1) {\n contentStart = quasiStart;\n }\n contentEnd = quasiEnd;\n\n const quasiContent = quasi.cooked ?? quasi.raw;\n parts.push(quasiContent);\n\n // Add placeholder for interpolation expression if this is not the last quasi\n if (i < expressions.length) {\n // Use a placeholder that preserves GraphQL spread syntax for fragment references\n // Pattern: __FRAG_SPREAD_N__ to indicate this is likely a fragment spread interpolation\n parts.push(`__FRAG_SPREAD_${i}__`);\n }\n }\n\n if (contentStart === -1 || contentEnd === -1) {\n return;\n }\n\n const content = parts.join(\"\");\n\n templates.push({\n contentRange: { start: contentStart, end: contentEnd },\n schemaName,\n kind,\n content,\n ...(elementName !== undefined ? { elementName } : {}),\n ...(typeName !== undefined ? { typeName } : {}),\n });\n};\n\n/**\n * Walk AST to find gql calls and extract templates.\n * Adapted from builder's unwrapMethodChains + visit pattern.\n */\nconst walkAndExtract = (\n node: Node,\n identifiers: ReadonlySet<string>,\n spanOffset: number,\n converter: SwcSpanConverter,\n): ExtractedTemplate[] => {\n const templates: ExtractedTemplate[] = [];\n\n const visit = (n: Node | ReadonlyArray<Node> | Record<string, unknown>): void => {\n if (!n || typeof n !== \"object\") {\n return;\n }\n\n if (\"type\" in n && n.type === \"CallExpression\") {\n // Check if this is a gql call (possibly wrapped in method chains)\n const gqlCall = findGqlCall(identifiers, n as Node);\n if (gqlCall) {\n const schemaName = getGqlCallSchemaName(identifiers, gqlCall);\n if (schemaName) {\n const arrow = gqlCall.arguments[0]?.expression as ArrowFunctionExpression;\n templates.push(...extractTemplatesFromCallback(arrow, schemaName, spanOffset, converter));\n }\n return; // Don't recurse into gql calls\n }\n }\n\n // Recurse into all array and object properties\n if (Array.isArray(n)) {\n for (const item of n) {\n visit(item as Node);\n }\n return;\n }\n\n for (const key of Object.keys(n)) {\n if (key === \"span\" || key === \"type\") {\n continue;\n }\n const value = (n as Record<string, unknown>)[key];\n if (value && typeof value === \"object\") {\n visit(value as Node);\n }\n }\n };\n\n visit(node);\n return templates;\n};\n\n/**\n * Find the innermost gql call, unwrapping method chains like .attach().\n */\nconst findGqlCall = (identifiers: ReadonlySet<string>, node: Node): CallExpression | null => {\n if (!node || node.type !== \"CallExpression\") {\n return null;\n }\n\n const call = node as unknown as CallExpression;\n if (getGqlCallSchemaName(identifiers, call) !== null) {\n return call;\n }\n\n const callee = call.callee;\n if (callee.type !== \"MemberExpression\") {\n return null;\n }\n\n return findGqlCall(identifiers, callee.object as unknown as Node);\n};\n\n/**\n * Index fragment definitions from extracted templates.\n * Parses each fragment template to extract FragmentDefinitionNode for cross-file resolution.\n */\n/**\n * Reconstruct full GraphQL source from an extracted template.\n * Prepends the definition header from curried tag call arguments.\n */\nexport const reconstructGraphql = (template: ExtractedTemplate): string => {\n const content = template.content;\n\n if (template.elementName) {\n if (template.kind === \"fragment\" && template.typeName) {\n // fragment(\"Name\", \"Type\")`($vars) { ... }` -> fragment Name on Type ($vars) { ... }\n return `fragment ${template.elementName} on ${template.typeName} ${content}`;\n }\n // query(\"Name\")`($vars) { ... }` -> query Name ($vars) { ... }\n return `${template.kind} ${template.elementName} ${content}`;\n }\n\n return content;\n};\n\nconst indexFragments = (uri: string, templates: readonly ExtractedTemplate[], source: string): readonly IndexedFragment[] => {\n const fragments: IndexedFragment[] = [];\n\n for (const template of templates) {\n if (template.kind !== \"fragment\") {\n continue;\n }\n\n const reconstructed = reconstructGraphql(template);\n const headerLen = reconstructed.length - template.content.length;\n const { preprocessed } = preprocessFragmentArgs(reconstructed);\n\n try {\n const ast = parse(preprocessed, { noLocation: false });\n for (const def of ast.definitions) {\n if (def.kind === \"FragmentDefinition\") {\n fragments.push({\n uri,\n schemaName: template.schemaName,\n fragmentName: def.name.value,\n definition: def as FragmentDefinitionNode,\n content: preprocessed,\n contentRange: template.contentRange,\n tsSource: source,\n headerLen,\n });\n }\n }\n } catch {\n // Invalid GraphQL — skip indexing this template\n }\n }\n\n return fragments;\n};\n\n/** Create a document manager that tracks open documents and extracts templates. */\nexport const createDocumentManager = (helper: GraphqlSystemIdentifyHelper, swcOptions?: SwcLoaderOptions): DocumentManager => {\n // Per-instance SWC state (avoids cross-instance contamination in multi-config setups)\n let parseSyncFn: typeof import(\"@swc/core\").parseSync | null =\n swcOptions?.parseSync !== undefined ? (swcOptions.parseSync ?? null) : null;\n let swcLoadAttempted = swcOptions?.parseSync !== undefined;\n let swcUnavailable = swcOptions?.parseSync === null;\n\n const getParseSync = (): typeof import(\"@swc/core\").parseSync | null => {\n if (!swcLoadAttempted) {\n swcLoadAttempted = true;\n // Try resolveFrom first (project-local), then fall back to LSP package location\n const resolveBases = swcOptions?.resolveFrom ? [swcOptions.resolveFrom, import.meta.url] : [import.meta.url];\n for (const base of resolveBases) {\n try {\n const localRequire = createRequire(base);\n const candidate = localRequire(\"@swc/core\")?.parseSync;\n if (typeof candidate === \"function\") {\n parseSyncFn = candidate;\n return parseSyncFn;\n }\n } catch {\n // Try next base\n }\n }\n swcUnavailable = true;\n }\n return parseSyncFn;\n };\n\n /** Wrap SWC parseSync (which throws) to return null on failure. */\n const safeParseSync = (source: string, tsx: boolean): Module | null => {\n const parseSync = getParseSync();\n if (!parseSync) return null;\n try {\n const result = parseSync(source, {\n syntax: \"typescript\",\n tsx,\n decorators: false,\n dynamicImport: true,\n });\n return result.type === \"Module\" ? result : null;\n } catch {\n return null;\n }\n };\n\n const cache = new Map<string, DocumentState>();\n const fragmentIndex = new Map<string, readonly IndexedFragment[]>();\n\n const extractTemplates = (uri: string, source: string): readonly ExtractedTemplate[] => {\n const isTsx = uri.endsWith(\".tsx\");\n\n const program = safeParseSync(source, isTsx);\n if (!program) {\n return [];\n }\n\n // SWC's BytePos counter accumulates across parseSync calls within the same process.\n // Use UTF-8 byte length (not source.length which is UTF-16 code units) for correct offset.\n const converter = createSwcSpanConverter(source);\n const spanOffset = program.span.end - converter.byteLength + 1;\n\n // Convert URI to a file path for the helper\n const filePath = uri.startsWith(\"file://\") ? fileURLToPath(uri) : uri;\n\n const gqlIdentifiers = collectGqlIdentifiers(program, filePath, helper);\n if (gqlIdentifiers.size === 0) {\n return [];\n }\n\n return walkAndExtract(program, gqlIdentifiers, spanOffset, converter);\n };\n\n return {\n update: (uri, version, source) => {\n const templates = extractTemplates(uri, source);\n const state: DocumentState = {\n uri,\n version,\n source,\n templates,\n ...(swcUnavailable ? { swcUnavailable: true as const } : {}),\n };\n cache.set(uri, state);\n if (swcUnavailable) {\n fragmentIndex.delete(uri);\n } else {\n fragmentIndex.set(uri, indexFragments(uri, templates, source));\n }\n return state;\n },\n\n get: (uri) => cache.get(uri),\n\n remove: (uri) => {\n cache.delete(uri);\n fragmentIndex.delete(uri);\n },\n\n findTemplateAtOffset: (uri, offset) => {\n const state = cache.get(uri);\n if (!state) {\n return undefined;\n }\n return state.templates.find((t) => offset >= t.contentRange.start && offset <= t.contentRange.end);\n },\n\n getExternalFragments: (uri, schemaName) => {\n const result: IndexedFragment[] = [];\n for (const [fragmentUri, fragments] of fragmentIndex) {\n if (fragmentUri === uri) {\n continue;\n }\n for (const fragment of fragments) {\n if (fragment.schemaName === schemaName) {\n result.push(fragment);\n }\n }\n }\n return result;\n },\n\n getAllFragments: (schemaName) => {\n const result: IndexedFragment[] = [];\n for (const [, fragments] of fragmentIndex) {\n for (const fragment of fragments) {\n if (fragment.schemaName === schemaName) {\n result.push(fragment);\n }\n }\n }\n return result;\n },\n\n findFragmentSpreadLocations: (fragmentName, schemaName) => {\n const locations: FragmentSpreadLocation[] = [];\n\n for (const [uri, state] of cache) {\n for (const template of state.templates) {\n if (template.schemaName !== schemaName) {\n continue;\n }\n\n const reconstructed = reconstructGraphql(template);\n const headerLen = reconstructed.length - template.content.length;\n const { preprocessed } = preprocessFragmentArgs(reconstructed);\n\n try {\n const ast = parse(preprocessed, { noLocation: false });\n visit(ast, {\n FragmentSpread(node) {\n if (node.name.value === fragmentName && node.name.loc) {\n // Adjust offset from reconstructed space to template-content space\n locations.push({\n uri,\n tsSource: state.source,\n template,\n nameOffset: node.name.loc.start - headerLen,\n nameLength: fragmentName.length,\n });\n }\n },\n });\n } catch {\n // Parse error — fall back to regex\n const pattern = new RegExp(`\\\\.\\\\.\\\\.${fragmentName}\\\\b`, \"g\");\n let match: RegExpExecArray | null = null;\n while ((match = pattern.exec(preprocessed)) !== null) {\n // Adjust offset from reconstructed space to template-content space\n locations.push({\n uri,\n tsSource: state.source,\n template,\n nameOffset: match.index + 3 - headerLen, // skip \"...\"\n nameLength: fragmentName.length,\n });\n }\n }\n }\n }\n\n return locations;\n },\n };\n};\n","/**\n * Structured error types for the LSP server.\n * @module\n */\n\nimport type { Result } from \"neverthrow\";\n\n/** Error code taxonomy for LSP operations. */\nexport type LspErrorCode =\n | \"CONFIG_LOAD_FAILED\"\n | \"SCHEMA_LOAD_FAILED\"\n | \"SCHEMA_BUILD_FAILED\"\n | \"SCHEMA_NOT_CONFIGURED\"\n | \"PARSE_FAILED\"\n | \"INTERNAL_INVARIANT\"\n | \"SWC_RESOLUTION_FAILED\";\n\ntype ConfigLoadFailed = { readonly code: \"CONFIG_LOAD_FAILED\"; readonly message: string; readonly cause?: unknown };\ntype SchemaLoadFailed = {\n readonly code: \"SCHEMA_LOAD_FAILED\";\n readonly message: string;\n readonly schemaName: string;\n readonly cause?: unknown;\n};\ntype SchemaBuildFailed = {\n readonly code: \"SCHEMA_BUILD_FAILED\";\n readonly message: string;\n readonly schemaName: string;\n readonly cause?: unknown;\n};\ntype SchemaNotConfigured = { readonly code: \"SCHEMA_NOT_CONFIGURED\"; readonly message: string; readonly schemaName: string };\ntype ParseFailed = { readonly code: \"PARSE_FAILED\"; readonly message: string; readonly uri: string; readonly cause?: unknown };\ntype InternalInvariant = {\n readonly code: \"INTERNAL_INVARIANT\";\n readonly message: string;\n readonly context?: string;\n readonly cause?: unknown;\n};\ntype SwcResolutionFailed = { readonly code: \"SWC_RESOLUTION_FAILED\"; readonly message: string };\n\n/** Structured error type for all LSP operations. */\nexport type LspError =\n | ConfigLoadFailed\n | SchemaLoadFailed\n | SchemaBuildFailed\n | SchemaNotConfigured\n | ParseFailed\n | InternalInvariant\n | SwcResolutionFailed;\n\n/** Helper type for LSP operation results. */\nexport type LspResult<T> = Result<T, LspError>;\n\n/** Error constructor helpers for concise error creation. */\nexport const lspErrors = {\n configLoadFailed: (message: string, cause?: unknown): ConfigLoadFailed => ({\n code: \"CONFIG_LOAD_FAILED\",\n message,\n cause,\n }),\n\n schemaLoadFailed: (schemaName: string, message?: string, cause?: unknown): SchemaLoadFailed => ({\n code: \"SCHEMA_LOAD_FAILED\",\n message: message ?? `Failed to load schema: ${schemaName}`,\n schemaName,\n cause,\n }),\n\n schemaBuildFailed: (schemaName: string, message?: string, cause?: unknown): SchemaBuildFailed => ({\n code: \"SCHEMA_BUILD_FAILED\",\n message: message ?? `Failed to build schema: ${schemaName}`,\n schemaName,\n cause,\n }),\n\n schemaNotConfigured: (schemaName: string): SchemaNotConfigured => ({\n code: \"SCHEMA_NOT_CONFIGURED\",\n message: `Schema \"${schemaName}\" is not configured in soda-gql.config`,\n schemaName,\n }),\n\n parseFailed: (uri: string, message?: string, cause?: unknown): ParseFailed => ({\n code: \"PARSE_FAILED\",\n message: message ?? `Failed to parse: ${uri}`,\n uri,\n cause,\n }),\n\n internalInvariant: (message: string, context?: string, cause?: unknown): InternalInvariant => ({\n code: \"INTERNAL_INVARIANT\",\n message,\n context,\n cause,\n }),\n\n swcResolutionFailed: (message?: string): SwcResolutionFailed => ({\n code: \"SWC_RESOLUTION_FAILED\",\n message:\n message ??\n \"@swc/core not found. Install @soda-gql/builder (which provides @swc/core) in your project and restart the LSP server to enable template extraction.\",\n }),\n} as const;\n","/**\n * Bidirectional position mapping between TypeScript file and GraphQL content.\n * @module\n */\n\n/** 0-indexed line and character position. */\nexport type Position = {\n readonly line: number;\n readonly character: number;\n};\n\nexport type PositionMapper = {\n /** Map TS file position to GraphQL content position. Returns null if outside template. */\n readonly tsToGraphql: (tsPosition: Position) => Position | null;\n /** Map GraphQL content position back to TS file position. */\n readonly graphqlToTs: (gqlPosition: Position) => Position;\n};\n\nexport type PositionMapperInput = {\n readonly tsSource: string;\n /** Byte offset of the first character of GraphQL content (after opening backtick). */\n readonly contentStartOffset: number;\n readonly graphqlContent: string;\n};\n\n/** Compute byte offsets for the start of each line in the source text. */\nexport const computeLineOffsets = (source: string): readonly number[] => {\n const offsets: number[] = [0];\n for (let i = 0; i < source.length; i++) {\n if (source.charCodeAt(i) === 10) {\n // newline\n offsets.push(i + 1);\n }\n }\n return offsets;\n};\n\n/** Convert a Position to a byte offset within the source text. */\nexport const positionToOffset = (lineOffsets: readonly number[], position: Position): number => {\n if (position.line < 0 || position.line >= lineOffsets.length) {\n return -1;\n }\n return (lineOffsets[position.line] ?? 0) + position.character;\n};\n\n/** Convert a byte offset to a Position within the source text. */\nexport const offsetToPosition = (lineOffsets: readonly number[], offset: number): Position => {\n // Binary search for the line containing the offset\n let low = 0;\n let high = lineOffsets.length - 1;\n while (low < high) {\n const mid = Math.ceil((low + high) / 2);\n if ((lineOffsets[mid] ?? 0) <= offset) {\n low = mid;\n } else {\n high = mid - 1;\n }\n }\n return { line: low, character: offset - (lineOffsets[low] ?? 0) };\n};\n\n/** Convert a Position to an IPosition compatible with graphql-language-service. */\nexport const toIPosition = (\n pos: Position,\n): {\n line: number;\n character: number;\n setLine: (l: number) => void;\n setCharacter: (c: number) => void;\n lessThanOrEqualTo: (other: Position) => boolean;\n} => {\n const p = {\n line: pos.line,\n character: pos.character,\n setLine: (l: number) => {\n p.line = l;\n },\n setCharacter: (c: number) => {\n p.character = c;\n },\n lessThanOrEqualTo: (other: Position) => p.line < other.line || (p.line === other.line && p.character <= other.character),\n };\n return p;\n};\n\n/** Create a bidirectional position mapper between TS file and GraphQL content. */\nexport const createPositionMapper = (input: PositionMapperInput): PositionMapper => {\n const { tsSource, contentStartOffset, graphqlContent } = input;\n const tsLineOffsets = computeLineOffsets(tsSource);\n const gqlLineOffsets = computeLineOffsets(graphqlContent);\n\n return {\n tsToGraphql: (tsPosition) => {\n const tsOffset = positionToOffset(tsLineOffsets, tsPosition);\n if (tsOffset < 0) {\n return null;\n }\n const gqlOffset = tsOffset - contentStartOffset;\n if (gqlOffset < 0 || gqlOffset > graphqlContent.length) {\n return null;\n }\n return offsetToPosition(gqlLineOffsets, gqlOffset);\n },\n\n graphqlToTs: (gqlPosition) => {\n const gqlOffset = positionToOffset(gqlLineOffsets, gqlPosition);\n const tsOffset = gqlOffset + contentStartOffset;\n return offsetToPosition(tsLineOffsets, tsOffset);\n },\n };\n};\n","/**\n * Schema resolver: maps schema names to GraphQLSchema objects.\n * @module\n */\n\nimport { readFileSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport { hashSchema } from \"@soda-gql/codegen\";\nimport type { ResolvedSodaGqlConfig } from \"@soda-gql/config\";\nimport { buildASTSchema, concatAST, type DocumentNode, type GraphQLSchema, parse } from \"graphql\";\nimport { err, ok, type Result } from \"neverthrow\";\nimport type { LspError } from \"./errors\";\nimport { lspErrors } from \"./errors\";\n\n/** Per-file schema source info for go-to-definition. */\nexport type SchemaFileInfo = {\n readonly filePath: string;\n readonly content: string;\n};\n\n/** Cached schema entry. */\nexport type SchemaEntry = {\n readonly name: string;\n readonly schema: import(\"graphql\").GraphQLSchema;\n readonly documentNode: DocumentNode;\n readonly hash: string;\n readonly files: readonly SchemaFileInfo[];\n};\n\nexport type SchemaResolver = {\n readonly getSchema: (schemaName: string) => SchemaEntry | undefined;\n readonly getSchemaNames: () => readonly string[];\n readonly reloadSchema: (schemaName: string) => Result<SchemaEntry, LspError>;\n readonly reloadAll: () => Result<void, LspError[]>;\n};\n\n/** Wrap buildASTSchema (which throws) in a Result. */\nconst safeBuildASTSchema = (schemaName: string, documentNode: DocumentNode): Result<GraphQLSchema, LspError> => {\n try {\n return ok(buildASTSchema(documentNode));\n } catch (e) {\n return err(lspErrors.schemaBuildFailed(schemaName, e instanceof Error ? e.message : String(e), e));\n }\n};\n\nconst loadAndBuildSchema = (schemaName: string, schemaPaths: readonly string[]): Result<SchemaEntry, LspError> => {\n const documents: DocumentNode[] = [];\n const files: SchemaFileInfo[] = [];\n\n for (const schemaPath of schemaPaths) {\n const resolvedPath = resolve(schemaPath);\n try {\n const content = readFileSync(resolvedPath, \"utf8\");\n documents.push(parse(content));\n files.push({ filePath: resolvedPath, content });\n } catch (e) {\n return err(lspErrors.schemaLoadFailed(schemaName, e instanceof Error ? e.message : String(e)));\n }\n }\n\n const documentNode = concatAST(documents);\n const hash = hashSchema(documentNode as Parameters<typeof hashSchema>[0]);\n\n const buildResult = safeBuildASTSchema(schemaName, documentNode);\n if (buildResult.isErr()) {\n return err(buildResult.error);\n }\n\n return ok({ name: schemaName, schema: buildResult.value, documentNode, hash, files });\n};\n\n/** Create a schema resolver from config. Loads all schemas eagerly. */\nexport const createSchemaResolver = (config: ResolvedSodaGqlConfig): Result<SchemaResolver, LspError> => {\n const cache = new Map<string, SchemaEntry>();\n\n // Load all schemas from config\n for (const [name, schemaConfig] of Object.entries(config.schemas)) {\n const result = loadAndBuildSchema(name, schemaConfig.schema);\n if (result.isErr()) {\n return err(result.error);\n }\n cache.set(name, result.value);\n }\n\n const resolver: SchemaResolver = {\n getSchema: (schemaName) => cache.get(schemaName),\n\n getSchemaNames: () => [...cache.keys()],\n\n reloadSchema: (schemaName) => {\n const schemaConfig = config.schemas[schemaName];\n if (!schemaConfig) {\n return err(lspErrors.schemaNotConfigured(schemaName));\n }\n const result = loadAndBuildSchema(schemaName, schemaConfig.schema);\n if (result.isErr()) {\n return err(result.error);\n }\n cache.set(schemaName, result.value);\n return ok(result.value);\n },\n\n reloadAll: () => {\n const errors: LspError[] = [];\n for (const [name, schemaConfig] of Object.entries(config.schemas)) {\n const result = loadAndBuildSchema(name, schemaConfig.schema);\n if (result.isErr()) {\n errors.push(result.error);\n } else {\n cache.set(name, result.value);\n }\n }\n return errors.length > 0 ? err(errors) : ok(undefined);\n },\n };\n\n return ok(resolver);\n};\n","/**\n * Config registry: maps document URIs to their nearest config context.\n * Supports multiple soda-gql configs in a monorepo workspace.\n * @module\n */\n\nimport { dirname, sep } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { createGraphqlSystemIdentifyHelper, type GraphqlSystemIdentifyHelper } from \"@soda-gql/builder\";\nimport { loadConfig, type ResolvedSodaGqlConfig } from \"@soda-gql/config\";\nimport { err, ok, type Result } from \"neverthrow\";\nimport { createDocumentManager, type DocumentManager } from \"./document-manager\";\nimport type { LspError } from \"./errors\";\nimport { lspErrors } from \"./errors\";\nimport { createSchemaResolver, type SchemaResolver } from \"./schema-resolver\";\n\nexport type ConfigContext = {\n readonly configPath: string;\n readonly config: ResolvedSodaGqlConfig;\n readonly helper: GraphqlSystemIdentifyHelper;\n readonly schemaResolver: SchemaResolver;\n readonly documentManager: DocumentManager;\n};\n\nexport type ConfigRegistry = {\n readonly resolveForUri: (uri: string) => ConfigContext | undefined;\n readonly getAllContexts: () => readonly ConfigContext[];\n readonly reloadSchemas: (configPath: string) => Result<void, LspError[]>;\n readonly reloadAllSchemas: () => Result<void, LspError[]>;\n};\n\nexport const createConfigRegistry = (configPaths: readonly string[]): Result<ConfigRegistry, LspError> => {\n // Sort by path depth descending so deeper configs are checked first\n const sortedPaths = [...configPaths].sort((a, b) => b.length - a.length);\n\n const contexts = new Map<string, ConfigContext>();\n\n for (const configPath of sortedPaths) {\n const configResult = loadConfig(configPath);\n if (configResult.isErr()) {\n return err(\n lspErrors.configLoadFailed(`Failed to load config ${configPath}: ${configResult.error.message}`, configResult.error),\n );\n }\n\n const config = configResult.value;\n const helper = createGraphqlSystemIdentifyHelper(config);\n\n const resolverResult = createSchemaResolver(config);\n if (resolverResult.isErr()) {\n return err(resolverResult.error);\n }\n\n contexts.set(configPath, {\n configPath,\n config,\n helper,\n schemaResolver: resolverResult.value,\n documentManager: createDocumentManager(helper, { resolveFrom: configPath }),\n });\n }\n\n // Cache: directory path → configPath (or null if no match)\n const uriCache = new Map<string, string | null>();\n\n const resolveConfigPath = (dirPath: string): string | null => {\n const cached = uriCache.get(dirPath);\n if (cached !== undefined) {\n return cached;\n }\n\n for (const configPath of sortedPaths) {\n const configDir = dirname(configPath);\n if (dirPath === configDir || dirPath.startsWith(`${configDir}${sep}`)) {\n uriCache.set(dirPath, configPath);\n return configPath;\n }\n }\n\n uriCache.set(dirPath, null);\n return null;\n };\n\n return ok({\n resolveForUri: (uri: string) => {\n const filePath = uri.startsWith(\"file://\") ? fileURLToPath(uri) : uri;\n const dirPath = dirname(filePath);\n const configPath = resolveConfigPath(dirPath);\n return configPath ? contexts.get(configPath) : undefined;\n },\n\n getAllContexts: () => [...contexts.values()],\n\n reloadSchemas: (configPath: string) => {\n const ctx = contexts.get(configPath);\n if (!ctx) {\n return err([lspErrors.configLoadFailed(`Config not found: ${configPath}`)]);\n }\n return ctx.schemaResolver.reloadAll();\n },\n\n reloadAllSchemas: () => {\n const errors: LspError[] = [];\n for (const ctx of contexts.values()) {\n const result = ctx.schemaResolver.reloadAll();\n if (result.isErr()) {\n errors.push(...result.error);\n }\n }\n return errors.length > 0 ? err(errors) : ok(undefined);\n },\n });\n};\n","/* --------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n * ------------------------------------------------------------------------------------------ */\n'use strict';\nexport var DocumentUri;\n(function (DocumentUri) {\n function is(value) {\n return typeof value === 'string';\n }\n DocumentUri.is = is;\n})(DocumentUri || (DocumentUri = {}));\nexport var URI;\n(function (URI) {\n function is(value) {\n return typeof value === 'string';\n }\n URI.is = is;\n})(URI || (URI = {}));\nexport var integer;\n(function (integer) {\n integer.MIN_VALUE = -2147483648;\n integer.MAX_VALUE = 2147483647;\n function is(value) {\n return typeof value === 'number' && integer.MIN_VALUE <= value && value <= integer.MAX_VALUE;\n }\n integer.is = is;\n})(integer || (integer = {}));\nexport var uinteger;\n(function (uinteger) {\n uinteger.MIN_VALUE = 0;\n uinteger.MAX_VALUE = 2147483647;\n function is(value) {\n return typeof value === 'number' && uinteger.MIN_VALUE <= value && value <= uinteger.MAX_VALUE;\n }\n uinteger.is = is;\n})(uinteger || (uinteger = {}));\n/**\n * The Position namespace provides helper functions to work with\n * {@link Position} literals.\n */\nexport var Position;\n(function (Position) {\n /**\n * Creates a new Position literal from the given line and character.\n * @param line The position's line.\n * @param character The position's character.\n */\n function create(line, character) {\n if (line === Number.MAX_VALUE) {\n line = uinteger.MAX_VALUE;\n }\n if (character === Number.MAX_VALUE) {\n character = uinteger.MAX_VALUE;\n }\n return { line, character };\n }\n Position.create = create;\n /**\n * Checks whether the given literal conforms to the {@link Position} interface.\n */\n function is(value) {\n let candidate = value;\n return Is.objectLiteral(candidate) && Is.uinteger(candidate.line) && Is.uinteger(candidate.character);\n }\n Position.is = is;\n})(Position || (Position = {}));\n/**\n * The Range namespace provides helper functions to work with\n * {@link Range} literals.\n */\nexport var Range;\n(function (Range) {\n function create(one, two, three, four) {\n if (Is.uinteger(one) && Is.uinteger(two) && Is.uinteger(three) && Is.uinteger(four)) {\n return { start: Position.create(one, two), end: Position.create(three, four) };\n }\n else if (Position.is(one) && Position.is(two)) {\n return { start: one, end: two };\n }\n else {\n throw new Error(`Range#create called with invalid arguments[${one}, ${two}, ${three}, ${four}]`);\n }\n }\n Range.create = create;\n /**\n * Checks whether the given literal conforms to the {@link Range} interface.\n */\n function is(value) {\n let candidate = value;\n return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);\n }\n Range.is = is;\n})(Range || (Range = {}));\n/**\n * The Location namespace provides helper functions to work with\n * {@link Location} literals.\n */\nexport var Location;\n(function (Location) {\n /**\n * Creates a Location literal.\n * @param uri The location's uri.\n * @param range The location's range.\n */\n function create(uri, range) {\n return { uri, range };\n }\n Location.create = create;\n /**\n * Checks whether the given literal conforms to the {@link Location} interface.\n */\n function is(value) {\n let candidate = value;\n return Is.objectLiteral(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));\n }\n Location.is = is;\n})(Location || (Location = {}));\n/**\n * The LocationLink namespace provides helper functions to work with\n * {@link LocationLink} literals.\n */\nexport var LocationLink;\n(function (LocationLink) {\n /**\n * Creates a LocationLink literal.\n * @param targetUri The definition's uri.\n * @param targetRange The full range of the definition.\n * @param targetSelectionRange The span of the symbol definition at the target.\n * @param originSelectionRange The span of the symbol being defined in the originating source file.\n */\n function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) {\n return { targetUri, targetRange, targetSelectionRange, originSelectionRange };\n }\n LocationLink.create = create;\n /**\n * Checks whether the given literal conforms to the {@link LocationLink} interface.\n */\n function is(value) {\n let candidate = value;\n return Is.objectLiteral(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri)\n && Range.is(candidate.targetSelectionRange)\n && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));\n }\n LocationLink.is = is;\n})(LocationLink || (LocationLink = {}));\n/**\n * The Color namespace provides helper functions to work with\n * {@link Color} literals.\n */\nexport var Color;\n(function (Color) {\n /**\n * Creates a new Color literal.\n */\n function create(red, green, blue, alpha) {\n return {\n red,\n green,\n blue,\n alpha,\n };\n }\n Color.create = create;\n /**\n * Checks whether the given literal conforms to the {@link Color} interface.\n */\n function is(value) {\n const candidate = value;\n return Is.objectLiteral(candidate) && Is.numberRange(candidate.red, 0, 1)\n && Is.numberRange(candidate.green, 0, 1)\n && Is.numberRange(candidate.blue, 0, 1)\n && Is.numberRange(candidate.alpha, 0, 1);\n }\n Color.is = is;\n})(Color || (Color = {}));\n/**\n * The ColorInformation namespace provides helper functions to work with\n * {@link ColorInformation} literals.\n */\nexport var ColorInformation;\n(function (ColorInformation) {\n /**\n * Creates a new ColorInformation literal.\n */\n function create(range, color) {\n return {\n range,\n color,\n };\n }\n ColorInformation.create = create;\n /**\n * Checks whether the given literal conforms to the {@link ColorInformation} interface.\n */\n function is(value) {\n const candidate = value;\n return Is.objectLiteral(candidate) && Range.is(candidate.range) && Color.is(candidate.color);\n }\n ColorInformation.is = is;\n})(ColorInformation || (ColorInformation = {}));\n/**\n * The Color namespace provides helper functions to work with\n * {@link ColorPresentation} literals.\n */\nexport var ColorPresentation;\n(function (ColorPresentation) {\n /**\n * Creates a new ColorInformation literal.\n */\n function create(label, textEdit, additionalTextEdits) {\n return {\n label,\n textEdit,\n additionalTextEdits,\n };\n }\n ColorPresentation.create = create;\n /**\n * Checks whether the given literal conforms to the {@link ColorInformation} interface.\n */\n function is(value) {\n const candidate = value;\n return Is.objectLiteral(candidate) && Is.string(candidate.label)\n && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate))\n && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is));\n }\n ColorPresentation.is = is;\n})(ColorPresentation || (ColorPresentation = {}));\n/**\n * A set of predefined range kinds.\n */\nexport var FoldingRangeKind;\n(function (FoldingRangeKind) {\n /**\n * Folding range for a comment\n */\n FoldingRangeKind.Comment = 'comment';\n /**\n * Folding range for an import or include\n */\n FoldingRangeKind.Imports = 'imports';\n /**\n * Folding range for a region (e.g. `#region`)\n */\n FoldingRangeKind.Region = 'region';\n})(FoldingRangeKind || (FoldingRangeKind = {}));\n/**\n * The folding range namespace provides helper functions to work with\n * {@link FoldingRange} literals.\n */\nexport var FoldingRange;\n(function (FoldingRange) {\n /**\n * Creates a new FoldingRange literal.\n */\n function create(startLine, endLine, startCharacter, endCharacter, kind, collapsedText) {\n const result = {\n startLine,\n endLine\n };\n if (Is.defined(startCharacter)) {\n result.startCharacter = startCharacter;\n }\n if (Is.defined(endCharacter)) {\n result.endCharacter = endCharacter;\n }\n if (Is.defined(kind)) {\n result.kind = kind;\n }\n if (Is.defined(collapsedText)) {\n result.collapsedText = collapsedText;\n }\n return result;\n }\n FoldingRange.create = create;\n /**\n * Checks whether the given literal conforms to the {@link FoldingRange} interface.\n */\n function is(value) {\n const candidate = value;\n return Is.objectLiteral(candidate) && Is.uinteger(candidate.startLine) && Is.uinteger(candidate.startLine)\n && (Is.undefined(candidate.startCharacter) || Is.uinteger(candidate.startCharacter))\n && (Is.undefined(candidate.endCharacter) || Is.uinteger(candidate.endCharacter))\n && (Is.undefined(candidate.kind) || Is.string(candidate.kind));\n }\n FoldingRange.is = is;\n})(FoldingRange || (FoldingRange = {}));\n/**\n * The DiagnosticRelatedInformation namespace provides helper functions to work with\n * {@link DiagnosticRelatedInformation} literals.\n */\nexport var DiagnosticRelatedInformation;\n(function (DiagnosticRelatedInformation) {\n /**\n * Creates a new DiagnosticRelatedInformation literal.\n */\n function create(location, message) {\n return {\n location,\n message\n };\n }\n DiagnosticRelatedInformation.create = create;\n /**\n * Checks whether the given literal conforms to the {@link DiagnosticRelatedInformation} interface.\n */\n function is(value) {\n let candidate = value;\n return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message);\n }\n DiagnosticRelatedInformation.is = is;\n})(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {}));\n/**\n * The diagnostic's severity.\n */\nexport var DiagnosticSeverity;\n(function (DiagnosticSeverity) {\n /**\n * Reports an error.\n */\n DiagnosticSeverity.Error = 1;\n /**\n * Reports a warning.\n */\n DiagnosticSeverity.Warning = 2;\n /**\n * Reports an information.\n */\n DiagnosticSeverity.Information = 3;\n /**\n * Reports a hint.\n */\n DiagnosticSeverity.Hint = 4;\n})(DiagnosticSeverity || (DiagnosticSeverity = {}));\n/**\n * The diagnostic tags.\n *\n * @since 3.15.0\n */\nexport var DiagnosticTag;\n(function (DiagnosticTag) {\n /**\n * Unused or unnecessary code.\n *\n * Clients are allowed to render diagnostics with this tag faded out instead of having\n * an error squiggle.\n */\n DiagnosticTag.Unnecessary = 1;\n /**\n * Deprecated or obsolete code.\n *\n * Clients are allowed to rendered diagnostics with this tag strike through.\n */\n DiagnosticTag.Deprecated = 2;\n})(DiagnosticTag || (DiagnosticTag = {}));\n/**\n * The CodeDescription namespace provides functions to deal with descriptions for diagnostic codes.\n *\n * @since 3.16.0\n */\nexport var CodeDescription;\n(function (CodeDescription) {\n function is(value) {\n const candidate = value;\n return Is.objectLiteral(candidate) && Is.string(candidate.href);\n }\n CodeDescription.is = is;\n})(CodeDescription || (CodeDescription = {}));\n/**\n * The Diagnostic namespace provides helper functions to work with\n * {@link Diagnostic} literals.\n */\nexport var Diagnostic;\n(function (Diagnostic) {\n /**\n * Creates a new Diagnostic literal.\n */\n function create(range, message, severity, code, source, relatedInformation) {\n let result = { range, message };\n if (Is.defined(severity)) {\n result.severity = severity;\n }\n if (Is.defined(code)) {\n result.code = code;\n }\n if (Is.defined(source)) {\n result.source = source;\n }\n if (Is.defined(relatedInformation)) {\n result.relatedInformation = relatedInformation;\n }\n return result;\n }\n Diagnostic.create = create;\n /**\n * Checks whether the given literal conforms to the {@link Diagnostic} interface.\n */\n function is(value) {\n var _a;\n let candidate = value;\n return Is.defined(candidate)\n && Range.is(candidate.range)\n && Is.string(candidate.message)\n && (Is.number(candidate.severity) || Is.undefined(candidate.severity))\n && (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code))\n && (Is.undefined(candidate.codeDescription) || (Is.string((_a = candidate.codeDescription) === null || _a === void 0 ? void 0 : _a.href)))\n && (Is.string(candidate.source) || Is.undefined(candidate.source))\n && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));\n }\n Diagnostic.is = is;\n})(Diagnostic || (Diagnostic = {}));\n/**\n * The Command namespace provides helper functions to work with\n * {@link Command} literals.\n */\nexport var Command;\n(function (Command) {\n /**\n * Creates a new Command literal.\n */\n function create(title, command, ...args) {\n let result = { title, command };\n if (Is.defined(args) && args.length > 0) {\n result.arguments = args;\n }\n return result;\n }\n Command.create = create;\n /**\n * Checks whether the given literal conforms to the {@link Command} interface.\n */\n function is(value) {\n let candidate = value;\n return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command);\n }\n Command.is = is;\n})(Command || (Command = {}));\n/**\n * The TextEdit namespace provides helper function to create replace,\n * insert and delete edits more easily.\n */\nexport var TextEdit;\n(function (TextEdit) {\n /**\n * Creates a replace text edit.\n * @param range The range of text to be replaced.\n * @param newText The new text.\n */\n function replace(range, newText) {\n return { range, newText };\n }\n TextEdit.replace = replace;\n /**\n * Creates an insert text edit.\n * @param position The position to insert the text at.\n * @param newText The text to be inserted.\n */\n function insert(position, newText) {\n return { range: { start: position, end: position }, newText };\n }\n TextEdit.insert = insert;\n /**\n * Creates a delete text edit.\n * @param range The range of text to be deleted.\n */\n function del(range) {\n return { range, newText: '' };\n }\n TextEdit.del = del;\n function is(value) {\n const candidate = value;\n return Is.objectLiteral(candidate)\n && Is.string(candidate.newText)\n && Range.is(candidate.range);\n }\n TextEdit.is = is;\n})(TextEdit || (TextEdit = {}));\nexport var ChangeAnnotation;\n(function (ChangeAnnotation) {\n function create(label, needsConfirmation, description) {\n const result = { label };\n if (needsConfirmation !== undefined) {\n result.needsConfirmation = needsConfirmation;\n }\n if (description !== undefined) {\n result.description = description;\n }\n return result;\n }\n ChangeAnnotation.create = create;\n function is(value) {\n const candidate = value;\n return Is.objectLiteral(candidate) && Is.string(candidate.label) &&\n (Is.boolean(candidate.needsConfirmation) || candidate.needsConfirmation === undefined) &&\n (Is.string(candidate.description) || candidate.description === undefined);\n }\n ChangeAnnotation.is = is;\n})(ChangeAnnotation || (ChangeAnnotation = {}));\nexport var ChangeAnnotationIdentifier;\n(function (ChangeAnnotationIdentifier) {\n function is(value) {\n const candidate = value;\n return Is.string(candidate);\n }\n ChangeAnnotationIdentifier.is = is;\n})(ChangeAnnotationIdentifier || (ChangeAnnotationIdentifier = {}));\nexport var AnnotatedTextEdit;\n(function (AnnotatedTextEdit) {\n /**\n * Creates an annotated replace text edit.\n *\n * @param range The range of text to be replaced.\n * @param newText The new text.\n * @param annotation The annotation.\n */\n function replace(range, newText, annotation) {\n return { range, newText, annotationId: annotation };\n }\n AnnotatedTextEdit.replace = replace;\n /**\n * Creates an annotated insert text edit.\n *\n * @param position The position to insert the text at.\n * @param newText The text to be inserted.\n * @param annotation The annotation.\n */\n function insert(position, newText, annotation) {\n return { range: { start: position, end: position }, newText, annotationId: annotation };\n }\n AnnotatedTextEdit.insert = insert;\n /**\n * Creates an annotated delete text edit.\n *\n * @param range The range of text to be deleted.\n * @param annotation The annotation.\n */\n function del(range, annotation) {\n return { range, newText: '', annotationId: annotation };\n }\n AnnotatedTextEdit.del = del;\n function is(value) {\n const candidate = value;\n return TextEdit.is(candidate) && (ChangeAnnotation.is(candidate.annotationId) || ChangeAnnotationIdentifier.is(candidate.annotationId));\n }\n AnnotatedTextEdit.is = is;\n})(AnnotatedTextEdit || (AnnotatedTextEdit = {}));\n/**\n * The TextDocumentEdit namespace provides helper function to create\n * an edit that manipulates a text document.\n */\nexport var TextDocumentEdit;\n(function (TextDocumentEdit) {\n /**\n * Creates a new `TextDocumentEdit`\n */\n function create(textDocument, edits) {\n return { textDocument, edits };\n }\n TextDocumentEdit.create = create;\n function is(value) {\n let candidate = value;\n return Is.defined(candidate)\n && OptionalVersionedTextDocumentIdentifier.is(candidate.textDocument)\n && Array.isArray(candidate.edits);\n }\n TextDocumentEdit.is = is;\n})(TextDocumentEdit || (TextDocumentEdit = {}));\nexport var CreateFile;\n(function (CreateFile) {\n function create(uri, options, annotation) {\n let result = {\n kind: 'create',\n uri\n };\n if (options !== undefined && (options.overwrite !== undefined || options.ignoreIfExists !== undefined)) {\n result.options = options;\n }\n if (annotation !== undefined) {\n result.annotationId = annotation;\n }\n return result;\n }\n CreateFile.create = create;\n function is(value) {\n let candidate = value;\n return candidate && candidate.kind === 'create' && Is.string(candidate.uri) && (candidate.options === undefined ||\n ((candidate.options.overwrite === undefined || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === undefined || Is.boolean(candidate.options.ignoreIfExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId));\n }\n CreateFile.is = is;\n})(CreateFile || (CreateFile = {}));\nexport var RenameFile;\n(function (RenameFile) {\n function create(oldUri, newUri, options, annotation) {\n let result = {\n kind: 'rename',\n oldUri,\n newUri\n };\n if (options !== undefined && (options.overwrite !== undefined || options.ignoreIfExists !== undefined)) {\n result.options = options;\n }\n if (annotation !== undefined) {\n result.annotationId = annotation;\n }\n return result;\n }\n RenameFile.create = create;\n function is(value) {\n let candidate = value;\n return candidate && candidate.kind === 'rename' && Is.string(candidate.oldUri) && Is.string(candidate.newUri) && (candidate.options === undefined ||\n ((candidate.options.overwrite === undefined || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === undefined || Is.boolean(candidate.options.ignoreIfExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId));\n }\n RenameFile.is = is;\n})(RenameFile || (RenameFile = {}));\nexport var DeleteFile;\n(function (DeleteFile) {\n function create(uri, options, annotation) {\n let result = {\n kind: 'delete',\n uri\n };\n if (options !== undefined && (options.recursive !== undefined || options.ignoreIfNotExists !== undefined)) {\n result.options = options;\n }\n if (annotation !== undefined) {\n result.annotationId = annotation;\n }\n return result;\n }\n DeleteFile.create = create;\n function is(value) {\n let candidate = value;\n return candidate && candidate.kind === 'delete' && Is.string(candidate.uri) && (candidate.options === undefined ||\n ((candidate.options.recursive === undefined || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === undefined || Is.boolean(candidate.options.ignoreIfNotExists)))) && (candidate.annotationId === undefined || ChangeAnnotationIdentifier.is(candidate.annotationId));\n }\n DeleteFile.is = is;\n})(DeleteFile || (DeleteFile = {}));\nexport var WorkspaceEdit;\n(function (WorkspaceEdit) {\n function is(value) {\n let candidate = value;\n return candidate &&\n (candidate.changes !== undefined || candidate.documentChanges !== undefined) &&\n (candidate.documentChanges === undefined || candidate.documentChanges.every((change) => {\n if (Is.string(change.kind)) {\n return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change);\n }\n else {\n return TextDocumentEdit.is(change);\n }\n }));\n }\n WorkspaceEdit.is = is;\n})(WorkspaceEdit || (WorkspaceEdit = {}));\nclass TextEditChangeImpl {\n constructor(edits, changeAnnotations) {\n this.edits = edits;\n this.changeAnnotations = changeAnnotations;\n }\n insert(position, newText, annotation) {\n let edit;\n let id;\n if (annotation === undefined) {\n edit = TextEdit.insert(position, newText);\n }\n else if (ChangeAnnotationIdentifier.is(annotation)) {\n id = annotation;\n edit = AnnotatedTextEdit.insert(position, newText, annotation);\n }\n else {\n this.assertChangeAnnotations(this.changeAnnotations);\n id = this.changeAnnotations.manage(annotation);\n edit = AnnotatedTextEdit.insert(position, newText, id);\n }\n this.edits.push(edit);\n if (id !== undefined) {\n return id;\n }\n }\n replace(range, newText, annotation) {\n let edit;\n let id;\n if (annotation === undefined) {\n edit = TextEdit.replace(range, newText);\n }\n else if (ChangeAnnotationIdentifier.is(annotation)) {\n id = annotation;\n edit = AnnotatedTextEdit.replace(range, newText, annotation);\n }\n else {\n this.assertChangeAnnotations(this.changeAnnotations);\n id = this.changeAnnotations.manage(annotation);\n edit = AnnotatedTextEdit.replace(range, newText, id);\n }\n this.edits.push(edit);\n if (id !== undefined) {\n return id;\n }\n }\n delete(range, annotation) {\n let edit;\n let id;\n if (annotation === undefined) {\n edit = TextEdit.del(range);\n }\n else if (ChangeAnnotationIdentifier.is(annotation)) {\n id = annotation;\n edit = AnnotatedTextEdit.del(range, annotation);\n }\n else {\n this.assertChangeAnnotations(this.changeAnnotations);\n id = this.changeAnnotations.manage(annotation);\n edit = AnnotatedTextEdit.del(range, id);\n }\n this.edits.push(edit);\n if (id !== undefined) {\n return id;\n }\n }\n add(edit) {\n this.edits.push(edit);\n }\n all() {\n return this.edits;\n }\n clear() {\n this.edits.splice(0, this.edits.length);\n }\n assertChangeAnnotations(value) {\n if (value === undefined) {\n throw new Error(`Text edit change is not configured to manage change annotations.`);\n }\n }\n}\n/**\n * A helper class\n */\nclass ChangeAnnotations {\n constructor(annotations) {\n this._annotations = annotations === undefined ? Object.create(null) : annotations;\n this._counter = 0;\n this._size = 0;\n }\n all() {\n return this._annotations;\n }\n get size() {\n return this._size;\n }\n manage(idOrAnnotation, annotation) {\n let id;\n if (ChangeAnnotationIdentifier.is(idOrAnnotation)) {\n id = idOrAnnotation;\n }\n else {\n id = this.nextId();\n annotation = idOrAnnotation;\n }\n if (this._annotations[id] !== undefined) {\n throw new Error(`Id ${id} is already in use.`);\n }\n if (annotation === undefined) {\n throw new Error(`No annotation provided for id ${id}`);\n }\n this._annotations[id] = annotation;\n this._size++;\n return id;\n }\n nextId() {\n this._counter++;\n return this._counter.toString();\n }\n}\n/**\n * A workspace change helps constructing changes to a workspace.\n */\nexport class WorkspaceChange {\n constructor(workspaceEdit) {\n this._textEditChanges = Object.create(null);\n if (workspaceEdit !== undefined) {\n this._workspaceEdit = workspaceEdit;\n if (workspaceEdit.documentChanges) {\n this._changeAnnotations = new ChangeAnnotations(workspaceEdit.changeAnnotations);\n workspaceEdit.changeAnnotations = this._changeAnnotations.all();\n workspaceEdit.documentChanges.forEach((change) => {\n if (TextDocumentEdit.is(change)) {\n const textEditChange = new TextEditChangeImpl(change.edits, this._changeAnnotations);\n this._textEditChanges[change.textDocument.uri] = textEditChange;\n }\n });\n }\n else if (workspaceEdit.changes) {\n Object.keys(workspaceEdit.changes).forEach((key) => {\n const textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]);\n this._textEditChanges[key] = textEditChange;\n });\n }\n }\n else {\n this._workspaceEdit = {};\n }\n }\n /**\n * Returns the underlying {@link WorkspaceEdit} literal\n * use to be returned from a workspace edit operation like rename.\n */\n get edit() {\n this.initDocumentChanges();\n if (this._changeAnnotations !== undefined) {\n if (this._changeAnnotations.size === 0) {\n this._workspaceEdit.changeAnnotations = undefined;\n }\n else {\n this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();\n }\n }\n return this._workspaceEdit;\n }\n getTextEditChange(key) {\n if (OptionalVersionedTextDocumentIdentifier.is(key)) {\n this.initDocumentChanges();\n if (this._workspaceEdit.documentChanges === undefined) {\n throw new Error('Workspace edit is not configured for document changes.');\n }\n const textDocument = { uri: key.uri, version: key.version };\n let result = this._textEditChanges[textDocument.uri];\n if (!result) {\n const edits = [];\n const textDocumentEdit = {\n textDocument,\n edits\n };\n this._workspaceEdit.documentChanges.push(textDocumentEdit);\n result = new TextEditChangeImpl(edits, this._changeAnnotations);\n this._textEditChanges[textDocument.uri] = result;\n }\n return result;\n }\n else {\n this.initChanges();\n if (this._workspaceEdit.changes === undefined) {\n throw new Error('Workspace edit is not configured for normal text edit changes.');\n }\n let result = this._textEditChanges[key];\n if (!result) {\n let edits = [];\n this._workspaceEdit.changes[key] = edits;\n result = new TextEditChangeImpl(edits);\n this._textEditChanges[key] = result;\n }\n return result;\n }\n }\n initDocumentChanges() {\n if (this._workspaceEdit.documentChanges === undefined && this._workspaceEdit.changes === undefined) {\n this._changeAnnotations = new ChangeAnnotations();\n this._workspaceEdit.documentChanges = [];\n this._workspaceEdit.changeAnnotations = this._changeAnnotations.all();\n }\n }\n initChanges() {\n if (this._workspaceEdit.documentChanges === undefined && this._workspaceEdit.changes === undefined) {\n this._workspaceEdit.changes = Object.create(null);\n }\n }\n createFile(uri, optionsOrAnnotation, options) {\n this.initDocumentChanges();\n if (this._workspaceEdit.documentChanges === undefined) {\n throw new Error('Workspace edit is not configured for document changes.');\n }\n let annotation;\n if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {\n annotation = optionsOrAnnotation;\n }\n else {\n options = optionsOrAnnotation;\n }\n let operation;\n let id;\n if (annotation === undefined) {\n operation = CreateFile.create(uri, options);\n }\n else {\n id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);\n operation = CreateFile.create(uri, options, id);\n }\n this._workspaceEdit.documentChanges.push(operation);\n if (id !== undefined) {\n return id;\n }\n }\n renameFile(oldUri, newUri, optionsOrAnnotation, options) {\n this.initDocumentChanges();\n if (this._workspaceEdit.documentChanges === undefined) {\n throw new Error('Workspace edit is not configured for document changes.');\n }\n let annotation;\n if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {\n annotation = optionsOrAnnotation;\n }\n else {\n options = optionsOrAnnotation;\n }\n let operation;\n let id;\n if (annotation === undefined) {\n operation = RenameFile.create(oldUri, newUri, options);\n }\n else {\n id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);\n operation = RenameFile.create(oldUri, newUri, options, id);\n }\n this._workspaceEdit.documentChanges.push(operation);\n if (id !== undefined) {\n return id;\n }\n }\n deleteFile(uri, optionsOrAnnotation, options) {\n this.initDocumentChanges();\n if (this._workspaceEdit.documentChanges === undefined) {\n throw new Error('Workspace edit is not configured for document changes.');\n }\n let annotation;\n if (ChangeAnnotation.is(optionsOrAnnotation) || ChangeAnnotationIdentifier.is(optionsOrAnnotation)) {\n annotation = optionsOrAnnotation;\n }\n else {\n options = optionsOrAnnotation;\n }\n let operation;\n let id;\n if (annotation === undefined) {\n operation = DeleteFile.create(uri, options);\n }\n else {\n id = ChangeAnnotationIdentifier.is(annotation) ? annotation : this._changeAnnotations.manage(annotation);\n operation = DeleteFile.create(uri, options, id);\n }\n this._workspaceEdit.documentChanges.push(operation);\n if (id !== undefined) {\n return id;\n }\n }\n}\n/**\n * The TextDocumentIdentifier namespace provides helper functions to work with\n * {@link TextDocumentIdentifier} literals.\n */\nexport var TextDocumentIdentifier;\n(function (TextDocumentIdentifier) {\n /**\n * Creates a new TextDocumentIdentifier literal.\n * @param uri The document's uri.\n */\n function create(uri) {\n return { uri };\n }\n TextDocumentIdentifier.create = create;\n /**\n * Checks whether the given literal conforms to the {@link TextDocumentIdentifier} interface.\n */\n function is(value) {\n let candidate = value;\n return Is.defined(candidate) && Is.string(candidate.uri);\n }\n TextDocumentIdentifier.is = is;\n})(TextDocumentIdentifier || (TextDocumentIdentifier = {}));\n/**\n * The VersionedTextDocumentIdentifier namespace provides helper functions to work with\n * {@link VersionedTextDocumentIdentifier} literals.\n */\nexport var VersionedTextDocumentIdentifier;\n(function (VersionedTextDocumentIdentifier) {\n /**\n * Creates a new VersionedTextDocumentIdentifier literal.\n * @param uri The document's uri.\n * @param version The document's version.\n */\n function create(uri, version) {\n return { uri, version };\n }\n VersionedTextDocumentIdentifier.create = create;\n /**\n * Checks whether the given literal conforms to the {@link VersionedTextDocumentIdentifier} interface.\n */\n function is(value) {\n let candidate = value;\n return Is.defined(candidate) && Is.string(candidate.uri) && Is.integer(candidate.version);\n }\n VersionedTextDocumentIdentifier.is = is;\n})(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {}));\n/**\n * The OptionalVersionedTextDocumentIdentifier namespace provides helper functions to work with\n * {@link OptionalVersionedTextDocumentIdentifier} literals.\n */\nexport var OptionalVersionedTextDocumentIdentifier;\n(function (OptionalVersionedTextDocumentIdentifier) {\n /**\n * Creates a new OptionalVersionedTextDocumentIdentifier literal.\n * @param uri The document's uri.\n * @param version The document's version.\n */\n function create(uri, version) {\n return { uri, version };\n }\n OptionalVersionedTextDocumentIdentifier.create = create;\n /**\n * Checks whether the given literal conforms to the {@link OptionalVersionedTextDocumentIdentifier} interface.\n */\n function is(value) {\n let candidate = value;\n return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.integer(candidate.version));\n }\n OptionalVersionedTextDocumentIdentifier.is = is;\n})(OptionalVersionedTextDocumentIdentifier || (OptionalVersionedTextDocumentIdentifier = {}));\n/**\n * The TextDocumentItem namespace provides helper functions to work with\n * {@link TextDocumentItem} literals.\n */\nexport var TextDocumentItem;\n(function (TextDocumentItem) {\n /**\n * Creates a new TextDocumentItem literal.\n * @param uri The document's uri.\n * @param languageId The document's language identifier.\n * @param version The document's version number.\n * @param text The document's text.\n */\n function create(uri, languageId, version, text) {\n return { uri, languageId, version, text };\n }\n TextDocumentItem.create = create;\n /**\n * Checks whether the given literal conforms to the {@link TextDocumentItem} interface.\n */\n function is(value) {\n let candidate = value;\n return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.integer(candidate.version) && Is.string(candidate.text);\n }\n TextDocumentItem.is = is;\n})(TextDocumentItem || (TextDocumentItem = {}));\n/**\n * Describes the content type that a client supports in various\n * result literals like `Hover`, `ParameterInfo` or `CompletionItem`.\n *\n * Please note that `MarkupKinds` must not start with a `$`. This kinds\n * are reserved for internal usage.\n */\nexport var MarkupKind;\n(function (MarkupKind) {\n /**\n * Plain text is supported as a content format\n */\n MarkupKind.PlainText = 'plaintext';\n /**\n * Markdown is supported as a content format\n */\n MarkupKind.Markdown = 'markdown';\n /**\n * Checks whether the given value is a value of the {@link MarkupKind} type.\n */\n function is(value) {\n const candidate = value;\n return candidate === MarkupKind.PlainText || candidate === MarkupKind.Markdown;\n }\n MarkupKind.is = is;\n})(MarkupKind || (MarkupKind = {}));\nexport var MarkupContent;\n(function (MarkupContent) {\n /**\n * Checks whether the given value conforms to the {@link MarkupContent} interface.\n */\n function is(value) {\n const candidate = value;\n return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value);\n }\n MarkupContent.is = is;\n})(MarkupContent || (MarkupContent = {}));\n/**\n * The kind of a completion entry.\n */\nexport var CompletionItemKind;\n(function (CompletionItemKind) {\n CompletionItemKind.Text = 1;\n CompletionItemKind.Method = 2;\n CompletionItemKind.Function = 3;\n CompletionItemKind.Constructor = 4;\n CompletionItemKind.Field = 5;\n CompletionItemKind.Variable = 6;\n CompletionItemKind.Class = 7;\n CompletionItemKind.Interface = 8;\n CompletionItemKind.Module = 9;\n CompletionItemKind.Property = 10;\n CompletionItemKind.Unit = 11;\n CompletionItemKind.Value = 12;\n CompletionItemKind.Enum = 13;\n CompletionItemKind.Keyword = 14;\n CompletionItemKind.Snippet = 15;\n CompletionItemKind.Color = 16;\n CompletionItemKind.File = 17;\n CompletionItemKind.Reference = 18;\n CompletionItemKind.Folder = 19;\n CompletionItemKind.EnumMember = 20;\n CompletionItemKind.Constant = 21;\n CompletionItemKind.Struct = 22;\n CompletionItemKind.Event = 23;\n CompletionItemKind.Operator = 24;\n CompletionItemKind.TypeParameter = 25;\n})(CompletionItemKind || (CompletionItemKind = {}));\n/**\n * Defines whether the insert text in a completion item should be interpreted as\n * plain text or a snippet.\n */\nexport var InsertTextFormat;\n(function (InsertTextFormat) {\n /**\n * The primary text to be inserted is treated as a plain string.\n */\n InsertTextFormat.PlainText = 1;\n /**\n * The primary text to be inserted is treated as a snippet.\n *\n * A snippet can define tab stops and placeholders with `$1`, `$2`\n * and `${3:foo}`. `$0` defines the final tab stop, it defaults to\n * the end of the snippet. Placeholders with equal identifiers are linked,\n * that is typing in one will update others too.\n *\n * See also: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#snippet_syntax\n */\n InsertTextFormat.Snippet = 2;\n})(InsertTextFormat || (InsertTextFormat = {}));\n/**\n * Completion item tags are extra annotations that tweak the rendering of a completion\n * item.\n *\n * @since 3.15.0\n */\nexport var CompletionItemTag;\n(function (CompletionItemTag) {\n /**\n * Render a completion as obsolete, usually using a strike-out.\n */\n CompletionItemTag.Deprecated = 1;\n})(CompletionItemTag || (CompletionItemTag = {}));\n/**\n * The InsertReplaceEdit namespace provides functions to deal with insert / replace edits.\n *\n * @since 3.16.0\n */\nexport var InsertReplaceEdit;\n(function (InsertReplaceEdit) {\n /**\n * Creates a new insert / replace edit\n */\n function create(newText, insert, replace) {\n return { newText, insert, replace };\n }\n InsertReplaceEdit.create = create;\n /**\n * Checks whether the given literal conforms to the {@link InsertReplaceEdit} interface.\n */\n function is(value) {\n const candidate = value;\n return candidate && Is.string(candidate.newText) && Range.is(candidate.insert) && Range.is(candidate.replace);\n }\n InsertReplaceEdit.is = is;\n})(InsertReplaceEdit || (InsertReplaceEdit = {}));\n/**\n * How whitespace and indentation is handled during completion\n * item insertion.\n *\n * @since 3.16.0\n */\nexport var InsertTextMode;\n(function (InsertTextMode) {\n /**\n * The insertion or replace strings is taken as it is. If the\n * value is multi line the lines below the cursor will be\n * inserted using the indentation defined in the string value.\n * The client will not apply any kind of adjustments to the\n * string.\n */\n InsertTextMode.asIs = 1;\n /**\n * The editor adjusts leading whitespace of new lines so that\n * they match the indentation up to the cursor of the line for\n * which the item is accepted.\n *\n * Consider a line like this: <2tabs><cursor><3tabs>foo. Accepting a\n * multi line completion item is indented using 2 tabs and all\n * following lines inserted will be indented using 2 tabs as well.\n */\n InsertTextMode.adjustIndentation = 2;\n})(InsertTextMode || (InsertTextMode = {}));\nexport var CompletionItemLabelDetails;\n(function (CompletionItemLabelDetails) {\n function is(value) {\n const candidate = value;\n return candidate && (Is.string(candidate.detail) || candidate.detail === undefined) &&\n (Is.string(candidate.description) || candidate.description === undefined);\n }\n CompletionItemLabelDetails.is = is;\n})(CompletionItemLabelDetails || (CompletionItemLabelDetails = {}));\n/**\n * The CompletionItem namespace provides functions to deal with\n * completion items.\n */\nexport var CompletionItem;\n(function (CompletionItem) {\n /**\n * Create a completion item and seed it with a label.\n * @param label The completion item's label\n */\n function create(label) {\n return { label };\n }\n CompletionItem.create = create;\n})(CompletionItem || (CompletionItem = {}));\n/**\n * The CompletionList namespace provides functions to deal with\n * completion lists.\n */\nexport var CompletionList;\n(function (CompletionList) {\n /**\n * Creates a new completion list.\n *\n * @param items The completion items.\n * @param isIncomplete The list is not complete.\n */\n function create(items, isIncomplete) {\n return { items: items ? items : [], isIncomplete: !!isIncomplete };\n }\n CompletionList.create = create;\n})(CompletionList || (CompletionList = {}));\nexport var MarkedString;\n(function (MarkedString) {\n /**\n * Creates a marked string from plain text.\n *\n * @param plainText The plain text.\n */\n function fromPlainText(plainText) {\n return plainText.replace(/[\\\\`*_{}[\\]()#+\\-.!]/g, '\\\\$&'); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash\n }\n MarkedString.fromPlainText = fromPlainText;\n /**\n * Checks whether the given value conforms to the {@link MarkedString} type.\n */\n function is(value) {\n const candidate = value;\n return Is.string(candidate) || (Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value));\n }\n MarkedString.is = is;\n})(MarkedString || (MarkedString = {}));\nexport var Hover;\n(function (Hover) {\n /**\n * Checks whether the given value conforms to the {@link Hover} interface.\n */\n function is(value) {\n let candidate = value;\n return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) ||\n MarkedString.is(candidate.contents) ||\n Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === undefined || Range.is(value.range));\n }\n Hover.is = is;\n})(Hover || (Hover = {}));\n/**\n * The ParameterInformation namespace provides helper functions to work with\n * {@link ParameterInformation} literals.\n */\nexport var ParameterInformation;\n(function (ParameterInformation) {\n /**\n * Creates a new parameter information literal.\n *\n * @param label A label string.\n * @param documentation A doc string.\n */\n function create(label, documentation) {\n return documentation ? { label, documentation } : { label };\n }\n ParameterInformation.create = create;\n})(ParameterInformation || (ParameterInformation = {}));\n/**\n * The SignatureInformation namespace provides helper functions to work with\n * {@link SignatureInformation} literals.\n */\nexport var SignatureInformation;\n(function (SignatureInformation) {\n function create(label, documentation, ...parameters) {\n let result = { label };\n if (Is.defined(documentation)) {\n result.documentation = documentation;\n }\n if (Is.defined(parameters)) {\n result.parameters = parameters;\n }\n else {\n result.parameters = [];\n }\n return result;\n }\n SignatureInformation.create = create;\n})(SignatureInformation || (SignatureInformation = {}));\n/**\n * A document highlight kind.\n */\nexport var DocumentHighlightKind;\n(function (DocumentHighlightKind) {\n /**\n * A textual occurrence.\n */\n DocumentHighlightKind.Text = 1;\n /**\n * Read-access of a symbol, like reading a variable.\n */\n DocumentHighlightKind.Read = 2;\n /**\n * Write-access of a symbol, like writing to a variable.\n */\n DocumentHighlightKind.Write = 3;\n})(DocumentHighlightKind || (DocumentHighlightKind = {}));\n/**\n * DocumentHighlight namespace to provide helper functions to work with\n * {@link DocumentHighlight} literals.\n */\nexport var DocumentHighlight;\n(function (DocumentHighlight) {\n /**\n * Create a DocumentHighlight object.\n * @param range The range the highlight applies to.\n * @param kind The highlight kind\n */\n function create(range, kind) {\n let result = { range };\n if (Is.number(kind)) {\n result.kind = kind;\n }\n return result;\n }\n DocumentHighlight.create = create;\n})(DocumentHighlight || (DocumentHighlight = {}));\n/**\n * A symbol kind.\n */\nexport var SymbolKind;\n(function (SymbolKind) {\n SymbolKind.File = 1;\n SymbolKind.Module = 2;\n SymbolKind.Namespace = 3;\n SymbolKind.Package = 4;\n SymbolKind.Class = 5;\n SymbolKind.Method = 6;\n SymbolKind.Property = 7;\n SymbolKind.Field = 8;\n SymbolKind.Constructor = 9;\n SymbolKind.Enum = 10;\n SymbolKind.Interface = 11;\n SymbolKind.Function = 12;\n SymbolKind.Variable = 13;\n SymbolKind.Constant = 14;\n SymbolKind.String = 15;\n SymbolKind.Number = 16;\n SymbolKind.Boolean = 17;\n SymbolKind.Array = 18;\n SymbolKind.Object = 19;\n SymbolKind.Key = 20;\n SymbolKind.Null = 21;\n SymbolKind.EnumMember = 22;\n SymbolKind.Struct = 23;\n SymbolKind.Event = 24;\n SymbolKind.Operator = 25;\n SymbolKind.TypeParameter = 26;\n})(SymbolKind || (SymbolKind = {}));\n/**\n * Symbol tags are extra annotations that tweak the rendering of a symbol.\n *\n * @since 3.16\n */\nexport var SymbolTag;\n(function (SymbolTag) {\n /**\n * Render a symbol as obsolete, usually using a strike-out.\n */\n SymbolTag.Deprecated = 1;\n})(SymbolTag || (SymbolTag = {}));\nexport var SymbolInformation;\n(function (SymbolInformation) {\n /**\n * Creates a new symbol information literal.\n *\n * @param name The name of the symbol.\n * @param kind The kind of the symbol.\n * @param range The range of the location of the symbol.\n * @param uri The resource of the location of symbol.\n * @param containerName The name of the symbol containing the symbol.\n */\n function create(name, kind, range, uri, containerName) {\n let result = {\n name,\n kind,\n location: { uri, range }\n };\n if (containerName) {\n result.containerName = containerName;\n }\n return result;\n }\n SymbolInformation.create = create;\n})(SymbolInformation || (SymbolInformation = {}));\nexport var WorkspaceSymbol;\n(function (WorkspaceSymbol) {\n /**\n * Create a new workspace symbol.\n *\n * @param name The name of the symbol.\n * @param kind The kind of the symbol.\n * @param uri The resource of the location of the symbol.\n * @param range An options range of the location.\n * @returns A WorkspaceSymbol.\n */\n function create(name, kind, uri, range) {\n return range !== undefined\n ? { name, kind, location: { uri, range } }\n : { name, kind, location: { uri } };\n }\n WorkspaceSymbol.create = create;\n})(WorkspaceSymbol || (WorkspaceSymbol = {}));\nexport var DocumentSymbol;\n(function (DocumentSymbol) {\n /**\n * Creates a new symbol information literal.\n *\n * @param name The name of the symbol.\n * @param detail The detail of the symbol.\n * @param kind The kind of the symbol.\n * @param range The range of the symbol.\n * @param selectionRange The selectionRange of the symbol.\n * @param children Children of the symbol.\n */\n function create(name, detail, kind, range, selectionRange, children) {\n let result = {\n name,\n detail,\n kind,\n range,\n selectionRange\n };\n if (children !== undefined) {\n result.children = children;\n }\n return result;\n }\n DocumentSymbol.create = create;\n /**\n * Checks whether the given literal conforms to the {@link DocumentSymbol} interface.\n */\n function is(value) {\n let candidate = value;\n return candidate &&\n Is.string(candidate.name) && Is.number(candidate.kind) &&\n Range.is(candidate.range) && Range.is(candidate.selectionRange) &&\n (candidate.detail === undefined || Is.string(candidate.detail)) &&\n (candidate.deprecated === undefined || Is.boolean(candidate.deprecated)) &&\n (candidate.children === undefined || Array.isArray(candidate.children)) &&\n (candidate.tags === undefined || Array.isArray(candidate.tags));\n }\n DocumentSymbol.is = is;\n})(DocumentSymbol || (DocumentSymbol = {}));\n/**\n * A set of predefined code action kinds\n */\nexport var CodeActionKind;\n(function (CodeActionKind) {\n /**\n * Empty kind.\n */\n CodeActionKind.Empty = '';\n /**\n * Base kind for quickfix actions: 'quickfix'\n */\n CodeActionKind.QuickFix = 'quickfix';\n /**\n * Base kind for refactoring actions: 'refactor'\n */\n CodeActionKind.Refactor = 'refactor';\n /**\n * Base kind for refactoring extraction actions: 'refactor.extract'\n *\n * Example extract actions:\n *\n * - Extract method\n * - Extract function\n * - Extract variable\n * - Extract interface from class\n * - ...\n */\n CodeActionKind.RefactorExtract = 'refactor.extract';\n /**\n * Base kind for refactoring inline actions: 'refactor.inline'\n *\n * Example inline actions:\n *\n * - Inline function\n * - Inline variable\n * - Inline constant\n * - ...\n */\n CodeActionKind.RefactorInline = 'refactor.inline';\n /**\n * Base kind for refactoring rewrite actions: 'refactor.rewrite'\n *\n * Example rewrite actions:\n *\n * - Convert JavaScript function to class\n * - Add or remove parameter\n * - Encapsulate field\n * - Make method static\n * - Move method to base class\n * - ...\n */\n CodeActionKind.RefactorRewrite = 'refactor.rewrite';\n /**\n * Base kind for source actions: `source`\n *\n * Source code actions apply to the entire file.\n */\n CodeActionKind.Source = 'source';\n /**\n * Base kind for an organize imports source action: `source.organizeImports`\n */\n CodeActionKind.SourceOrganizeImports = 'source.organizeImports';\n /**\n * Base kind for auto-fix source actions: `source.fixAll`.\n *\n * Fix all actions automatically fix errors that have a clear fix that do not require user input.\n * They should not suppress errors or perform unsafe fixes such as generating new types or classes.\n *\n * @since 3.15.0\n */\n CodeActionKind.SourceFixAll = 'source.fixAll';\n})(CodeActionKind || (CodeActionKind = {}));\n/**\n * The reason why code actions were requested.\n *\n * @since 3.17.0\n */\nexport var CodeActionTriggerKind;\n(function (CodeActionTriggerKind) {\n /**\n * Code actions were explicitly requested by the user or by an extension.\n */\n CodeActionTriggerKind.Invoked = 1;\n /**\n * Code actions were requested automatically.\n *\n * This typically happens when current selection in a file changes, but can\n * also be triggered when file content changes.\n */\n CodeActionTriggerKind.Automatic = 2;\n})(CodeActionTriggerKind || (CodeActionTriggerKind = {}));\n/**\n * The CodeActionContext namespace provides helper functions to work with\n * {@link CodeActionContext} literals.\n */\nexport var CodeActionContext;\n(function (CodeActionContext) {\n /**\n * Creates a new CodeActionContext literal.\n */\n function create(diagnostics, only, triggerKind) {\n let result = { diagnostics };\n if (only !== undefined && only !== null) {\n result.only = only;\n }\n if (triggerKind !== undefined && triggerKind !== null) {\n result.triggerKind = triggerKind;\n }\n return result;\n }\n CodeActionContext.create = create;\n /**\n * Checks whether the given literal conforms to the {@link CodeActionContext} interface.\n */\n function is(value) {\n let candidate = value;\n return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is)\n && (candidate.only === undefined || Is.typedArray(candidate.only, Is.string))\n && (candidate.triggerKind === undefined || candidate.triggerKind === CodeActionTriggerKind.Invoked || candidate.triggerKind === CodeActionTriggerKind.Automatic);\n }\n CodeActionContext.is = is;\n})(CodeActionContext || (CodeActionContext = {}));\nexport var CodeAction;\n(function (CodeAction) {\n function create(title, kindOrCommandOrEdit, kind) {\n let result = { title };\n let checkKind = true;\n if (typeof kindOrCommandOrEdit === 'string') {\n checkKind = false;\n result.kind = kindOrCommandOrEdit;\n }\n else if (Command.is(kindOrCommandOrEdit)) {\n result.command = kindOrCommandOrEdit;\n }\n else {\n result.edit = kindOrCommandOrEdit;\n }\n if (checkKind && kind !== undefined) {\n result.kind = kind;\n }\n return result;\n }\n CodeAction.create = create;\n function is(value) {\n let candidate = value;\n return candidate && Is.string(candidate.title) &&\n (candidate.diagnostics === undefined || Is.typedArray(candidate.diagnostics, Diagnostic.is)) &&\n (candidate.kind === undefined || Is.string(candidate.kind)) &&\n (candidate.edit !== undefined || candidate.command !== undefined) &&\n (candidate.command === undefined || Command.is(candidate.command)) &&\n (candidate.isPreferred === undefined || Is.boolean(candidate.isPreferred)) &&\n (candidate.edit === undefined || WorkspaceEdit.is(candidate.edit));\n }\n CodeAction.is = is;\n})(CodeAction || (CodeAction = {}));\n/**\n * The CodeLens namespace provides helper functions to work with\n * {@link CodeLens} literals.\n */\nexport var CodeLens;\n(function (CodeLens) {\n /**\n * Creates a new CodeLens literal.\n */\n function create(range, data) {\n let result = { range };\n if (Is.defined(data)) {\n result.data = data;\n }\n return result;\n }\n CodeLens.create = create;\n /**\n * Checks whether the given literal conforms to the {@link CodeLens} interface.\n */\n function is(value) {\n let candidate = value;\n return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));\n }\n CodeLens.is = is;\n})(CodeLens || (CodeLens = {}));\n/**\n * The FormattingOptions namespace provides helper functions to work with\n * {@link FormattingOptions} literals.\n */\nexport var FormattingOptions;\n(function (FormattingOptions) {\n /**\n * Creates a new FormattingOptions literal.\n */\n function create(tabSize, insertSpaces) {\n return { tabSize, insertSpaces };\n }\n FormattingOptions.create = create;\n /**\n * Checks whether the given literal conforms to the {@link FormattingOptions} interface.\n */\n function is(value) {\n let candidate = value;\n return Is.defined(candidate) && Is.uinteger(candidate.tabSize) && Is.boolean(candidate.insertSpaces);\n }\n FormattingOptions.is = is;\n})(FormattingOptions || (FormattingOptions = {}));\n/**\n * The DocumentLink namespace provides helper functions to work with\n * {@link DocumentLink} literals.\n */\nexport var DocumentLink;\n(function (DocumentLink) {\n /**\n * Creates a new DocumentLink literal.\n */\n function create(range, target, data) {\n return { range, target, data };\n }\n DocumentLink.create = create;\n /**\n * Checks whether the given literal conforms to the {@link DocumentLink} interface.\n */\n function is(value) {\n let candidate = value;\n return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));\n }\n DocumentLink.is = is;\n})(DocumentLink || (DocumentLink = {}));\n/**\n * The SelectionRange namespace provides helper function to work with\n * SelectionRange literals.\n */\nexport var SelectionRange;\n(function (SelectionRange) {\n /**\n * Creates a new SelectionRange\n * @param range the range.\n * @param parent an optional parent.\n */\n function create(range, parent) {\n return { range, parent };\n }\n SelectionRange.create = create;\n function is(value) {\n let candidate = value;\n return Is.objectLiteral(candidate) && Range.is(candidate.range) && (candidate.parent === undefined || SelectionRange.is(candidate.parent));\n }\n SelectionRange.is = is;\n})(SelectionRange || (SelectionRange = {}));\n/**\n * A set of predefined token types. This set is not fixed\n * an clients can specify additional token types via the\n * corresponding client capabilities.\n *\n * @since 3.16.0\n */\nexport var SemanticTokenTypes;\n(function (SemanticTokenTypes) {\n SemanticTokenTypes[\"namespace\"] = \"namespace\";\n /**\n * Represents a generic type. Acts as a fallback for types which can't be mapped to\n * a specific type like class or enum.\n */\n SemanticTokenTypes[\"type\"] = \"type\";\n SemanticTokenTypes[\"class\"] = \"class\";\n SemanticTokenTypes[\"enum\"] = \"enum\";\n SemanticTokenTypes[\"interface\"] = \"interface\";\n SemanticTokenTypes[\"struct\"] = \"struct\";\n SemanticTokenTypes[\"typeParameter\"] = \"typeParameter\";\n SemanticTokenTypes[\"parameter\"] = \"parameter\";\n SemanticTokenTypes[\"variable\"] = \"variable\";\n SemanticTokenTypes[\"property\"] = \"property\";\n SemanticTokenTypes[\"enumMember\"] = \"enumMember\";\n SemanticTokenTypes[\"event\"] = \"event\";\n SemanticTokenTypes[\"function\"] = \"function\";\n SemanticTokenTypes[\"method\"] = \"method\";\n SemanticTokenTypes[\"macro\"] = \"macro\";\n SemanticTokenTypes[\"keyword\"] = \"keyword\";\n SemanticTokenTypes[\"modifier\"] = \"modifier\";\n SemanticTokenTypes[\"comment\"] = \"comment\";\n SemanticTokenTypes[\"string\"] = \"string\";\n SemanticTokenTypes[\"number\"] = \"number\";\n SemanticTokenTypes[\"regexp\"] = \"regexp\";\n SemanticTokenTypes[\"operator\"] = \"operator\";\n /**\n * @since 3.17.0\n */\n SemanticTokenTypes[\"decorator\"] = \"decorator\";\n})(SemanticTokenTypes || (SemanticTokenTypes = {}));\n/**\n * A set of predefined token modifiers. This set is not fixed\n * an clients can specify additional token types via the\n * corresponding client capabilities.\n *\n * @since 3.16.0\n */\nexport var SemanticTokenModifiers;\n(function (SemanticTokenModifiers) {\n SemanticTokenModifiers[\"declaration\"] = \"declaration\";\n SemanticTokenModifiers[\"definition\"] = \"definition\";\n SemanticTokenModifiers[\"readonly\"] = \"readonly\";\n SemanticTokenModifiers[\"static\"] = \"static\";\n SemanticTokenModifiers[\"deprecated\"] = \"deprecated\";\n SemanticTokenModifiers[\"abstract\"] = \"abstract\";\n SemanticTokenModifiers[\"async\"] = \"async\";\n SemanticTokenModifiers[\"modification\"] = \"modification\";\n SemanticTokenModifiers[\"documentation\"] = \"documentation\";\n SemanticTokenModifiers[\"defaultLibrary\"] = \"defaultLibrary\";\n})(SemanticTokenModifiers || (SemanticTokenModifiers = {}));\n/**\n * @since 3.16.0\n */\nexport var SemanticTokens;\n(function (SemanticTokens) {\n function is(value) {\n const candidate = value;\n return Is.objectLiteral(candidate) && (candidate.resultId === undefined || typeof candidate.resultId === 'string') &&\n Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === 'number');\n }\n SemanticTokens.is = is;\n})(SemanticTokens || (SemanticTokens = {}));\n/**\n * The InlineValueText namespace provides functions to deal with InlineValueTexts.\n *\n * @since 3.17.0\n */\nexport var InlineValueText;\n(function (InlineValueText) {\n /**\n * Creates a new InlineValueText literal.\n */\n function create(range, text) {\n return { range, text };\n }\n InlineValueText.create = create;\n function is(value) {\n const candidate = value;\n return candidate !== undefined && candidate !== null && Range.is(candidate.range) && Is.string(candidate.text);\n }\n InlineValueText.is = is;\n})(InlineValueText || (InlineValueText = {}));\n/**\n * The InlineValueVariableLookup namespace provides functions to deal with InlineValueVariableLookups.\n *\n * @since 3.17.0\n */\nexport var InlineValueVariableLookup;\n(function (InlineValueVariableLookup) {\n /**\n * Creates a new InlineValueText literal.\n */\n function create(range, variableName, caseSensitiveLookup) {\n return { range, variableName, caseSensitiveLookup };\n }\n InlineValueVariableLookup.create = create;\n function is(value) {\n const candidate = value;\n return candidate !== undefined && candidate !== null && Range.is(candidate.range) && Is.boolean(candidate.caseSensitiveLookup)\n && (Is.string(candidate.variableName) || candidate.variableName === undefined);\n }\n InlineValueVariableLookup.is = is;\n})(InlineValueVariableLookup || (InlineValueVariableLookup = {}));\n/**\n * The InlineValueEvaluatableExpression namespace provides functions to deal with InlineValueEvaluatableExpression.\n *\n * @since 3.17.0\n */\nexport var InlineValueEvaluatableExpression;\n(function (InlineValueEvaluatableExpression) {\n /**\n * Creates a new InlineValueEvaluatableExpression literal.\n */\n function create(range, expression) {\n return { range, expression };\n }\n InlineValueEvaluatableExpression.create = create;\n function is(value) {\n const candidate = value;\n return candidate !== undefined && candidate !== null && Range.is(candidate.range)\n && (Is.string(candidate.expression) || candidate.expression === undefined);\n }\n InlineValueEvaluatableExpression.is = is;\n})(InlineValueEvaluatableExpression || (InlineValueEvaluatableExpression = {}));\n/**\n * The InlineValueContext namespace provides helper functions to work with\n * {@link InlineValueContext} literals.\n *\n * @since 3.17.0\n */\nexport var InlineValueContext;\n(function (InlineValueContext) {\n /**\n * Creates a new InlineValueContext literal.\n */\n function create(frameId, stoppedLocation) {\n return { frameId, stoppedLocation };\n }\n InlineValueContext.create = create;\n /**\n * Checks whether the given literal conforms to the {@link InlineValueContext} interface.\n */\n function is(value) {\n const candidate = value;\n return Is.defined(candidate) && Range.is(value.stoppedLocation);\n }\n InlineValueContext.is = is;\n})(InlineValueContext || (InlineValueContext = {}));\n/**\n * Inlay hint kinds.\n *\n * @since 3.17.0\n */\nexport var InlayHintKind;\n(function (InlayHintKind) {\n /**\n * An inlay hint that for a type annotation.\n */\n InlayHintKind.Type = 1;\n /**\n * An inlay hint that is for a parameter.\n */\n InlayHintKind.Parameter = 2;\n function is(value) {\n return value === 1 || value === 2;\n }\n InlayHintKind.is = is;\n})(InlayHintKind || (InlayHintKind = {}));\nexport var InlayHintLabelPart;\n(function (InlayHintLabelPart) {\n function create(value) {\n return { value };\n }\n InlayHintLabelPart.create = create;\n function is(value) {\n const candidate = value;\n return Is.objectLiteral(candidate)\n && (candidate.tooltip === undefined || Is.string(candidate.tooltip) || MarkupContent.is(candidate.tooltip))\n && (candidate.location === undefined || Location.is(candidate.location))\n && (candidate.command === undefined || Command.is(candidate.command));\n }\n InlayHintLabelPart.is = is;\n})(InlayHintLabelPart || (InlayHintLabelPart = {}));\nexport var InlayHint;\n(function (InlayHint) {\n function create(position, label, kind) {\n const result = { position, label };\n if (kind !== undefined) {\n result.kind = kind;\n }\n return result;\n }\n InlayHint.create = create;\n function is(value) {\n const candidate = value;\n return Is.objectLiteral(candidate) && Position.is(candidate.position)\n && (Is.string(candidate.label) || Is.typedArray(candidate.label, InlayHintLabelPart.is))\n && (candidate.kind === undefined || InlayHintKind.is(candidate.kind))\n && (candidate.textEdits === undefined) || Is.typedArray(candidate.textEdits, TextEdit.is)\n && (candidate.tooltip === undefined || Is.string(candidate.tooltip) || MarkupContent.is(candidate.tooltip))\n && (candidate.paddingLeft === undefined || Is.boolean(candidate.paddingLeft))\n && (candidate.paddingRight === undefined || Is.boolean(candidate.paddingRight));\n }\n InlayHint.is = is;\n})(InlayHint || (InlayHint = {}));\nexport var StringValue;\n(function (StringValue) {\n function createSnippet(value) {\n return { kind: 'snippet', value };\n }\n StringValue.createSnippet = createSnippet;\n})(StringValue || (StringValue = {}));\nexport var InlineCompletionItem;\n(function (InlineCompletionItem) {\n function create(insertText, filterText, range, command) {\n return { insertText, filterText, range, command };\n }\n InlineCompletionItem.create = create;\n})(InlineCompletionItem || (InlineCompletionItem = {}));\nexport var InlineCompletionList;\n(function (InlineCompletionList) {\n function create(items) {\n return { items };\n }\n InlineCompletionList.create = create;\n})(InlineCompletionList || (InlineCompletionList = {}));\n/**\n * Describes how an {@link InlineCompletionItemProvider inline completion provider} was triggered.\n *\n * @since 3.18.0\n * @proposed\n */\nexport var InlineCompletionTriggerKind;\n(function (InlineCompletionTriggerKind) {\n /**\n * Completion was triggered explicitly by a user gesture.\n */\n InlineCompletionTriggerKind.Invoked = 0;\n /**\n * Completion was triggered automatically while editing.\n */\n InlineCompletionTriggerKind.Automatic = 1;\n})(InlineCompletionTriggerKind || (InlineCompletionTriggerKind = {}));\nexport var SelectedCompletionInfo;\n(function (SelectedCompletionInfo) {\n function create(range, text) {\n return { range, text };\n }\n SelectedCompletionInfo.create = create;\n})(SelectedCompletionInfo || (SelectedCompletionInfo = {}));\nexport var InlineCompletionContext;\n(function (InlineCompletionContext) {\n function create(triggerKind, selectedCompletionInfo) {\n return { triggerKind, selectedCompletionInfo };\n }\n InlineCompletionContext.create = create;\n})(InlineCompletionContext || (InlineCompletionContext = {}));\nexport var WorkspaceFolder;\n(function (WorkspaceFolder) {\n function is(value) {\n const candidate = value;\n return Is.objectLiteral(candidate) && URI.is(candidate.uri) && Is.string(candidate.name);\n }\n WorkspaceFolder.is = is;\n})(WorkspaceFolder || (WorkspaceFolder = {}));\nexport const EOL = ['\\n', '\\r\\n', '\\r'];\n/**\n * @deprecated Use the text document from the new vscode-languageserver-textdocument package.\n */\nexport var TextDocument;\n(function (TextDocument) {\n /**\n * Creates a new ITextDocument literal from the given uri and content.\n * @param uri The document's uri.\n * @param languageId The document's language Id.\n * @param version The document's version.\n * @param content The document's content.\n */\n function create(uri, languageId, version, content) {\n return new FullTextDocument(uri, languageId, version, content);\n }\n TextDocument.create = create;\n /**\n * Checks whether the given literal conforms to the {@link ITextDocument} interface.\n */\n function is(value) {\n let candidate = value;\n return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.uinteger(candidate.lineCount)\n && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false;\n }\n TextDocument.is = is;\n function applyEdits(document, edits) {\n let text = document.getText();\n let sortedEdits = mergeSort(edits, (a, b) => {\n let diff = a.range.start.line - b.range.start.line;\n if (diff === 0) {\n return a.range.start.character - b.range.start.character;\n }\n return diff;\n });\n let lastModifiedOffset = text.length;\n for (let i = sortedEdits.length - 1; i >= 0; i--) {\n let e = sortedEdits[i];\n let startOffset = document.offsetAt(e.range.start);\n let endOffset = document.offsetAt(e.range.end);\n if (endOffset <= lastModifiedOffset) {\n text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length);\n }\n else {\n throw new Error('Overlapping edit');\n }\n lastModifiedOffset = startOffset;\n }\n return text;\n }\n TextDocument.applyEdits = applyEdits;\n function mergeSort(data, compare) {\n if (data.length <= 1) {\n // sorted\n return data;\n }\n const p = (data.length / 2) | 0;\n const left = data.slice(0, p);\n const right = data.slice(p);\n mergeSort(left, compare);\n mergeSort(right, compare);\n let leftIdx = 0;\n let rightIdx = 0;\n let i = 0;\n while (leftIdx < left.length && rightIdx < right.length) {\n let ret = compare(left[leftIdx], right[rightIdx]);\n if (ret <= 0) {\n // smaller_equal -> take left to preserve order\n data[i++] = left[leftIdx++];\n }\n else {\n // greater -> take right\n data[i++] = right[rightIdx++];\n }\n }\n while (leftIdx < left.length) {\n data[i++] = left[leftIdx++];\n }\n while (rightIdx < right.length) {\n data[i++] = right[rightIdx++];\n }\n return data;\n }\n})(TextDocument || (TextDocument = {}));\n/**\n * @deprecated Use the text document from the new vscode-languageserver-textdocument package.\n */\nclass FullTextDocument {\n constructor(uri, languageId, version, content) {\n this._uri = uri;\n this._languageId = languageId;\n this._version = version;\n this._content = content;\n this._lineOffsets = undefined;\n }\n get uri() {\n return this._uri;\n }\n get languageId() {\n return this._languageId;\n }\n get version() {\n return this._version;\n }\n getText(range) {\n if (range) {\n let start = this.offsetAt(range.start);\n let end = this.offsetAt(range.end);\n return this._content.substring(start, end);\n }\n return this._content;\n }\n update(event, version) {\n this._content = event.text;\n this._version = version;\n this._lineOffsets = undefined;\n }\n getLineOffsets() {\n if (this._lineOffsets === undefined) {\n let lineOffsets = [];\n let text = this._content;\n let isLineStart = true;\n for (let i = 0; i < text.length; i++) {\n if (isLineStart) {\n lineOffsets.push(i);\n isLineStart = false;\n }\n let ch = text.charAt(i);\n isLineStart = (ch === '\\r' || ch === '\\n');\n if (ch === '\\r' && i + 1 < text.length && text.charAt(i + 1) === '\\n') {\n i++;\n }\n }\n if (isLineStart && text.length > 0) {\n lineOffsets.push(text.length);\n }\n this._lineOffsets = lineOffsets;\n }\n return this._lineOffsets;\n }\n positionAt(offset) {\n offset = Math.max(Math.min(offset, this._content.length), 0);\n let lineOffsets = this.getLineOffsets();\n let low = 0, high = lineOffsets.length;\n if (high === 0) {\n return Position.create(0, offset);\n }\n while (low < high) {\n let mid = Math.floor((low + high) / 2);\n if (lineOffsets[mid] > offset) {\n high = mid;\n }\n else {\n low = mid + 1;\n }\n }\n // low is the least x for which the line offset is larger than the current offset\n // or array.length if no line offset is larger than the current offset\n let line = low - 1;\n return Position.create(line, offset - lineOffsets[line]);\n }\n offsetAt(position) {\n let lineOffsets = this.getLineOffsets();\n if (position.line >= lineOffsets.length) {\n return this._content.length;\n }\n else if (position.line < 0) {\n return 0;\n }\n let lineOffset = lineOffsets[position.line];\n let nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length;\n return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);\n }\n get lineCount() {\n return this.getLineOffsets().length;\n }\n}\nvar Is;\n(function (Is) {\n const toString = Object.prototype.toString;\n function defined(value) {\n return typeof value !== 'undefined';\n }\n Is.defined = defined;\n function undefined(value) {\n return typeof value === 'undefined';\n }\n Is.undefined = undefined;\n function boolean(value) {\n return value === true || value === false;\n }\n Is.boolean = boolean;\n function string(value) {\n return toString.call(value) === '[object String]';\n }\n Is.string = string;\n function number(value) {\n return toString.call(value) === '[object Number]';\n }\n Is.number = number;\n function numberRange(value, min, max) {\n return toString.call(value) === '[object Number]' && min <= value && value <= max;\n }\n Is.numberRange = numberRange;\n function integer(value) {\n return toString.call(value) === '[object Number]' && -2147483648 <= value && value <= 2147483647;\n }\n Is.integer = integer;\n function uinteger(value) {\n return toString.call(value) === '[object Number]' && 0 <= value && value <= 2147483647;\n }\n Is.uinteger = uinteger;\n function func(value) {\n return toString.call(value) === '[object Function]';\n }\n Is.func = func;\n function objectLiteral(value) {\n // Strictly speaking class instances pass this check as well. Since the LSP\n // doesn't use classes we ignore this for now. If we do we need to add something\n // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`\n return value !== null && typeof value === 'object';\n }\n Is.objectLiteral = objectLiteral;\n function typedArray(value, check) {\n return Array.isArray(value) && value.every(check);\n }\n Is.typedArray = typedArray;\n})(Is || (Is = {}));\n","/**\n * Code action handler: provides Extract Fragment refactoring.\n * @module\n */\n\nimport type { SelectionNode } from \"graphql\";\nimport { type GraphQLSchema, parse, TypeInfo, visit, visitWithTypeInfo } from \"graphql\";\nimport ts from \"typescript\";\nimport { type CodeAction, CodeActionKind, type TextEdit } from \"vscode-languageserver-types\";\nimport { preprocessFragmentArgs } from \"../fragment-args-preprocessor\";\nimport { computeLineOffsets, createPositionMapper, offsetToPosition, type Position, positionToOffset } from \"../position-mapping\";\nimport type { ExtractedTemplate } from \"../types\";\n\nexport type HandleCodeActionInput = {\n readonly template: ExtractedTemplate;\n readonly schema: GraphQLSchema;\n readonly tsSource: string;\n readonly uri: string;\n readonly selectionRange: { readonly start: Position; readonly end: Position };\n};\n\n/** Handle a code action request for a GraphQL template. */\nexport const handleCodeAction = (input: HandleCodeActionInput): CodeAction[] => {\n const { template, schema, tsSource, uri, selectionRange } = input;\n\n // Only support queries/mutations/subscriptions, not fragment definitions\n if (template.kind === \"fragment\") {\n return [];\n }\n\n const { preprocessed } = preprocessFragmentArgs(template.content);\n\n const mapper = createPositionMapper({\n tsSource,\n contentStartOffset: template.contentRange.start,\n graphqlContent: template.content,\n });\n\n // Convert selection range to GraphQL offsets\n const gqlStart = mapper.tsToGraphql(selectionRange.start);\n const gqlEnd = mapper.tsToGraphql(selectionRange.end);\n if (!gqlStart || !gqlEnd) {\n return [];\n }\n\n const preprocessedLineOffsets = computeLineOffsets(preprocessed);\n const startOffset = positionToOffset(preprocessedLineOffsets, gqlStart);\n const endOffset = positionToOffset(preprocessedLineOffsets, gqlEnd);\n\n // Parse the GraphQL\n let ast: ReturnType<typeof parse>;\n try {\n ast = parse(preprocessed, { noLocation: false });\n } catch {\n return [];\n }\n\n // Walk AST with TypeInfo to find the selection set and parent type\n const typeInfo = new TypeInfo(schema);\n const extractResult = findExtractableSelections(ast, typeInfo, startOffset, endOffset);\n\n if (!extractResult) {\n return [];\n }\n\n const { selections: matchedSelections, parentTypeName } = extractResult;\n\n // Extract the selected fields' source text\n const firstSel = matchedSelections[0];\n const lastSel = matchedSelections[matchedSelections.length - 1];\n if (!firstSel?.loc || !lastSel?.loc) {\n return [];\n }\n\n const selectedText = template.content.slice(firstSel.loc.start, lastSel.loc.end);\n const escapedText = selectedText.replace(/`/g, \"\\\\`\").replace(/\\$\\{/g, \"\\\\${\");\n const fragmentName = \"ExtractedFragment\";\n\n // Build the fragment definition\n const fragmentDef = `fragment ${fragmentName} on ${parentTypeName} {\\n ${escapedText.trim()}\\n}`;\n\n // Build the new gql expression to insert\n const newGqlExpr = `export const ${fragmentName} = gql.${template.schemaName}(({ fragment }) => fragment\\`\\n ${fragmentDef}\\n\\`);\\n\\n`;\n\n // Find the insertion point: the start of the line containing the current gql expression\n // Walk backwards from contentRange.start to find the beginning of the export/const statement\n const insertionOffset = findStatementStart(tsSource, template.contentRange.start);\n\n const tsLineOffsets = computeLineOffsets(tsSource);\n const gqlLineOffsets = computeLineOffsets(preprocessed);\n\n // TextEdit 1: Replace selected fields with fragment spread\n const replaceStart = mapper.graphqlToTs(offsetToPosition(gqlLineOffsets, firstSel.loc.start));\n const replaceEnd = mapper.graphqlToTs(offsetToPosition(gqlLineOffsets, lastSel.loc.end));\n\n const replaceEdit: TextEdit = {\n range: { start: replaceStart, end: replaceEnd },\n newText: `...${fragmentName}`,\n };\n\n // TextEdit 2: Insert the new fragment gql expression\n const insertPos = offsetToPosition(tsLineOffsets, insertionOffset);\n const insertEdit: TextEdit = {\n range: { start: insertPos, end: insertPos },\n newText: newGqlExpr,\n };\n\n return [\n {\n title: `Extract Fragment \"${fragmentName}\"`,\n kind: CodeActionKind.RefactorExtract,\n edit: {\n changes: {\n [uri]: [insertEdit, replaceEdit],\n },\n },\n },\n ];\n};\n\ntype ExtractResult = {\n readonly selections: readonly SelectionNode[];\n readonly parentTypeName: string;\n};\n\n/** Find selections within the user's range that can be extracted into a fragment. */\nconst findExtractableSelections = (\n ast: ReturnType<typeof parse>,\n typeInfo: TypeInfo,\n startOffset: number,\n endOffset: number,\n): ExtractResult | null => {\n let result: ExtractResult | null = null;\n\n visit(\n ast,\n visitWithTypeInfo(typeInfo, {\n SelectionSet(node) {\n if (!node.loc || result) {\n return;\n }\n\n const selected = node.selections.filter((sel) => {\n if (!sel.loc) {\n return false;\n }\n return sel.loc.start >= startOffset && sel.loc.end <= endOffset;\n });\n\n if (selected.length > 0) {\n const typeName = typeInfo.getParentType()?.name;\n if (typeName) {\n result = { selections: selected, parentTypeName: typeName };\n }\n }\n },\n }),\n );\n\n return result;\n};\n\n/**\n * Compute brace depth at a given offset using TypeScript scanner.\n * Correctly handles strings, comments, regex, and template literals.\n */\nconst braceDepthAt = (source: string, offset: number): number => {\n const scanner = ts.createScanner(ts.ScriptTarget.Latest, false, ts.LanguageVariant.Standard, source);\n let depth = 0;\n let lastToken: ts.SyntaxKind = ts.SyntaxKind.Unknown;\n\n while (true) {\n let token = scanner.scan();\n if (token === ts.SyntaxKind.EndOfFileToken) break;\n\n // Re-scan / as regex literal when it follows certain tokens\n if (token === ts.SyntaxKind.SlashToken || token === ts.SyntaxKind.SlashEqualsToken) {\n if (\n lastToken === ts.SyntaxKind.FirstAssignment ||\n lastToken === ts.SyntaxKind.EqualsEqualsToken ||\n lastToken === ts.SyntaxKind.EqualsEqualsEqualsToken ||\n lastToken === ts.SyntaxKind.ExclamationEqualsToken ||\n lastToken === ts.SyntaxKind.ExclamationEqualsEqualsToken ||\n lastToken === ts.SyntaxKind.OpenParenToken ||\n lastToken === ts.SyntaxKind.CommaToken ||\n lastToken === ts.SyntaxKind.OpenBracketToken ||\n lastToken === ts.SyntaxKind.ColonToken ||\n lastToken === ts.SyntaxKind.SemicolonToken ||\n lastToken === ts.SyntaxKind.OpenBraceToken ||\n lastToken === ts.SyntaxKind.QuestionToken ||\n lastToken === ts.SyntaxKind.BarBarToken ||\n lastToken === ts.SyntaxKind.AmpersandAmpersandToken ||\n lastToken === ts.SyntaxKind.ExclamationToken ||\n lastToken === ts.SyntaxKind.ReturnKeyword ||\n lastToken === ts.SyntaxKind.CaseKeyword ||\n lastToken === ts.SyntaxKind.NewKeyword\n ) {\n token = scanner.reScanSlashToken();\n }\n }\n\n const tokenStart = scanner.getTokenStart();\n if (tokenStart >= offset) break;\n\n if (token === ts.SyntaxKind.OpenBraceToken) {\n depth++;\n } else if (token === ts.SyntaxKind.CloseBraceToken) {\n depth--;\n }\n\n // Track last non-trivia token for regex detection\n if (\n token !== ts.SyntaxKind.WhitespaceTrivia &&\n token !== ts.SyntaxKind.NewLineTrivia &&\n token !== ts.SyntaxKind.SingleLineCommentTrivia &&\n token !== ts.SyntaxKind.MultiLineCommentTrivia\n ) {\n lastToken = token;\n }\n }\n\n return depth;\n};\n\n/** Find the start of the top-level statement containing the given offset. */\nconst findStatementStart = (source: string, offset: number): number => {\n let pos = offset;\n\n // Find the start of the current line\n while (pos > 0 && source.charCodeAt(pos - 1) !== 10) {\n pos--;\n }\n\n // Walk back through lines to find the top-level statement start\n while (pos > 0) {\n const lineStart = pos;\n const lineText = source.slice(lineStart, source.indexOf(\"\\n\", lineStart)).trimStart();\n const depth = braceDepthAt(source, lineStart);\n\n if (\n depth === 0 &&\n (lineText.startsWith(\"export \") ||\n lineText.startsWith(\"const \") ||\n lineText.startsWith(\"let \") ||\n lineText.startsWith(\"var \") ||\n lineText.startsWith(\"function \") ||\n lineText.startsWith(\"async \"))\n ) {\n return lineStart;\n }\n\n // Go to previous line\n pos--;\n while (pos > 0 && source.charCodeAt(pos - 1) !== 10) {\n pos--;\n }\n\n // At top level, if we hit a statement boundary, the statement starts at lineStart\n if (depth === 0) {\n const prevLine = source.slice(pos, lineStart - 1).trim();\n if (prevLine.endsWith(\";\") || prevLine.endsWith(\"}\")) {\n return lineStart;\n }\n }\n }\n\n return pos;\n};\n","/**\n * Completion handler: provides GraphQL autocompletion in templates.\n * @module\n */\n\nimport type { FragmentDefinitionNode, GraphQLSchema } from \"graphql\";\nimport { getAutocompleteSuggestions } from \"graphql-language-service\";\nimport type { CompletionItem } from \"vscode-languageserver-types\";\nimport { reconstructGraphql } from \"../document-manager\";\nimport { preprocessFragmentArgs } from \"../fragment-args-preprocessor\";\nimport {\n computeLineOffsets,\n createPositionMapper,\n offsetToPosition,\n type Position,\n positionToOffset,\n toIPosition,\n} from \"../position-mapping\";\nimport type { ExtractedTemplate } from \"../types\";\n\nexport type HandleCompletionInput = {\n readonly template: ExtractedTemplate;\n readonly schema: GraphQLSchema;\n readonly tsSource: string;\n /** LSP Position (0-indexed line, 0-indexed character) in the TS file. */\n readonly tsPosition: Position;\n /** External fragment definitions for cross-file resolution. */\n readonly externalFragments?: readonly FragmentDefinitionNode[];\n};\n\n/** Handle a completion request for a GraphQL template. */\nexport const handleCompletion = (input: HandleCompletionInput): CompletionItem[] => {\n const { template, schema, tsSource, tsPosition } = input;\n const reconstructed = reconstructGraphql(template);\n const headerLen = reconstructed.length - template.content.length;\n const { preprocessed } = preprocessFragmentArgs(reconstructed);\n\n const mapper = createPositionMapper({\n tsSource,\n contentStartOffset: template.contentRange.start,\n graphqlContent: template.content,\n });\n\n const contentPos = mapper.tsToGraphql(tsPosition);\n if (!contentPos) {\n return [];\n }\n\n // Shift content position to reconstructed position (account for synthesized header)\n const contentLineOffsets = computeLineOffsets(template.content);\n const contentOffset = positionToOffset(contentLineOffsets, contentPos);\n const reconstructedOffset = contentOffset + headerLen;\n const reconstructedLineOffsets = computeLineOffsets(preprocessed);\n const gqlPosition = offsetToPosition(reconstructedLineOffsets, reconstructedOffset);\n\n // graphql-language-service expects IPosition with line/character (0-indexed)\n const suggestions = getAutocompleteSuggestions(\n schema,\n preprocessed,\n toIPosition(gqlPosition),\n undefined,\n input.externalFragments as FragmentDefinitionNode[] | undefined,\n );\n\n return suggestions as CompletionItem[];\n};\n","/**\n * Shared handler utilities for fragment spread and definition lookup.\n * @module\n */\n\nimport type { FragmentSpreadNode } from \"graphql\";\nimport { parse, visit } from \"graphql\";\nimport { computeLineOffsets, createPositionMapper, offsetToPosition, type Position } from \"../position-mapping\";\nimport type { FragmentSpreadLocation, IndexedFragment } from \"../types\";\n\n/**\n * Find the fragment spread node at the given GraphQL offset using AST.\n * Returns the FragmentSpreadNode if cursor is on a `...FragmentName` pattern.\n */\nexport const findFragmentSpreadAtOffset = (preprocessed: string, offset: number): FragmentSpreadNode | null => {\n try {\n const ast = parse(preprocessed, { noLocation: false });\n let found: FragmentSpreadNode | null = null;\n\n visit(ast, {\n FragmentSpread(node) {\n if (!node.loc) {\n return;\n }\n if (offset >= node.loc.start && offset < node.loc.end) {\n found = node;\n }\n },\n });\n\n return found;\n } catch {\n return findFragmentSpreadByText(preprocessed, offset);\n }\n};\n\n/**\n * Text-based fallback: find fragment spread name at offset.\n * Handles documents with parse errors.\n */\nexport const findFragmentSpreadByText = (text: string, offset: number): FragmentSpreadNode | null => {\n const spreadPattern = /\\.\\.\\.([A-Za-z_]\\w*)/g;\n let match: RegExpExecArray | null = null;\n\n while ((match = spreadPattern.exec(text)) !== null) {\n const start = match.index;\n const end = start + match[0].length;\n if (offset >= start && offset < end) {\n return {\n kind: \"FragmentSpread\" as const,\n name: { kind: \"Name\" as const, value: match[1] ?? \"\" },\n } as FragmentSpreadNode;\n }\n }\n\n return null;\n};\n\nexport type FragmentDefinitionMatch = {\n readonly name: string;\n readonly loc: { readonly start: number; readonly end: number };\n};\n\n/**\n * Find a FragmentDefinition at a given offset.\n * Returns the name and location, or null.\n */\nexport const findFragmentDefinitionAtOffset = (preprocessed: string, offset: number): FragmentDefinitionMatch | null => {\n try {\n const ast = parse(preprocessed, { noLocation: false });\n for (const def of ast.definitions) {\n if (def.kind === \"FragmentDefinition\" && def.name.loc) {\n if (offset >= def.name.loc.start && offset < def.name.loc.end) {\n return { name: def.name.value, loc: { start: def.name.loc.start, end: def.name.loc.end } };\n }\n }\n }\n } catch {\n // ignore parse errors\n }\n return null;\n};\n\n/**\n * Resolve the fragment name at a given offset, checking both definitions and spreads.\n */\nexport const resolveFragmentNameAtOffset = (preprocessed: string, offset: number): string | null => {\n const def = findFragmentDefinitionAtOffset(preprocessed, offset);\n if (def) {\n return def.name;\n }\n\n const spread = findFragmentSpreadAtOffset(preprocessed, offset);\n if (spread) {\n return spread.name.value;\n }\n\n return null;\n};\n\n/** Range result from fragment location computation. */\nexport type FragmentRange = {\n readonly uri: string;\n readonly range: { readonly start: Position; readonly end: Position };\n};\n\n/** Compute TS ranges for all definitions of a named fragment. */\nexport const computeFragmentDefinitionRanges = (\n fragmentName: string,\n allFragments: readonly IndexedFragment[],\n): FragmentRange[] => {\n const ranges: FragmentRange[] = [];\n\n for (const frag of allFragments) {\n if (frag.fragmentName !== fragmentName) {\n continue;\n }\n if (!frag.definition.name.loc) {\n continue;\n }\n\n const defMapper = createPositionMapper({\n tsSource: frag.tsSource,\n contentStartOffset: frag.contentRange.start,\n graphqlContent: frag.content,\n });\n\n const defGqlLineOffsets = computeLineOffsets(frag.content);\n const nameStart = offsetToPosition(defGqlLineOffsets, frag.definition.name.loc.start);\n const nameEnd = offsetToPosition(defGqlLineOffsets, frag.definition.name.loc.end);\n\n ranges.push({\n uri: frag.uri,\n range: {\n start: defMapper.graphqlToTs(nameStart),\n end: defMapper.graphqlToTs(nameEnd),\n },\n });\n }\n\n return ranges;\n};\n\n/** Compute TS ranges for all fragment spread locations. */\nexport const computeSpreadLocationRanges = (spreadLocations: readonly FragmentSpreadLocation[]): FragmentRange[] => {\n const ranges: FragmentRange[] = [];\n\n for (const loc of spreadLocations) {\n const spreadMapper = createPositionMapper({\n tsSource: loc.tsSource,\n contentStartOffset: loc.template.contentRange.start,\n graphqlContent: loc.template.content,\n });\n\n const spreadGqlLineOffsets = computeLineOffsets(loc.template.content);\n const spreadStart = offsetToPosition(spreadGqlLineOffsets, loc.nameOffset);\n const spreadEnd = offsetToPosition(spreadGqlLineOffsets, loc.nameOffset + loc.nameLength);\n\n ranges.push({\n uri: loc.uri,\n range: {\n start: spreadMapper.graphqlToTs(spreadStart),\n end: spreadMapper.graphqlToTs(spreadEnd),\n },\n });\n }\n\n return ranges;\n};\n","/**\n * Definition handler: provides go-to-definition for fragment spreads and schema fields/types.\n * @module\n */\n\nimport { pathToFileURL } from \"node:url\";\nimport type { GraphQLSchema, TypeDefinitionNode } from \"graphql\";\nimport { getNamedType, isTypeDefinitionNode, parse } from \"graphql\";\nimport {\n getContextAtPosition,\n getDefinitionQueryResultForField,\n getDefinitionQueryResultForFragmentSpread,\n type ObjectTypeInfo,\n} from \"graphql-language-service\";\nimport type { Location } from \"vscode-languageserver-types\";\nimport { reconstructGraphql } from \"../document-manager\";\nimport { preprocessFragmentArgs } from \"../fragment-args-preprocessor\";\nimport {\n computeLineOffsets,\n createPositionMapper,\n offsetToPosition,\n type Position,\n positionToOffset,\n toIPosition,\n} from \"../position-mapping\";\nimport type { SchemaFileInfo } from \"../schema-resolver\";\nimport type { ExtractedTemplate, IndexedFragment } from \"../types\";\nimport { findFragmentSpreadAtOffset } from \"./_utils\";\n\nexport type HandleDefinitionInput = {\n readonly template: ExtractedTemplate;\n readonly tsSource: string;\n /** LSP Position (0-indexed line, 0-indexed character) in the TS file. */\n readonly tsPosition: Position;\n /** External fragment definitions for cross-file resolution. */\n readonly externalFragments: readonly IndexedFragment[];\n /** GraphQL schema for field/type resolution. */\n readonly schema?: GraphQLSchema;\n /** Per-file schema source info for go-to-definition in schema files. */\n readonly schemaFiles?: readonly SchemaFileInfo[];\n};\n\n/** Build ObjectTypeInfo[] from schema file info for graphql-language-service definition APIs. */\nconst buildObjectTypeInfos = (files: readonly SchemaFileInfo[]): ObjectTypeInfo[] => {\n const result: ObjectTypeInfo[] = [];\n for (const file of files) {\n const doc = parse(file.content);\n for (const def of doc.definitions) {\n if (isTypeDefinitionNode(def)) {\n result.push({\n filePath: pathToFileURL(file.filePath).href,\n content: file.content,\n definition: def as TypeDefinitionNode,\n });\n }\n }\n }\n return result;\n};\n\n/** Handle a definition request for a GraphQL template. */\nexport const handleDefinition = async (input: HandleDefinitionInput): Promise<Location[]> => {\n const { template, tsSource, tsPosition, externalFragments } = input;\n const reconstructed = reconstructGraphql(template);\n const headerLen = reconstructed.length - template.content.length;\n const { preprocessed } = preprocessFragmentArgs(reconstructed);\n\n const mapper = createPositionMapper({\n tsSource,\n contentStartOffset: template.contentRange.start,\n graphqlContent: template.content,\n });\n\n const gqlPosition = mapper.tsToGraphql(tsPosition);\n if (!gqlPosition) {\n return [];\n }\n\n // Convert from content-relative position to reconstructed-relative offset\n const contentLineOffsets = computeLineOffsets(template.content);\n const contentOffset = positionToOffset(contentLineOffsets, gqlPosition);\n const reconstructedOffset = contentOffset + headerLen;\n\n // 1. Try fragment spread navigation (existing behavior)\n const fragmentSpread = findFragmentSpreadAtOffset(preprocessed, reconstructedOffset);\n if (fragmentSpread) {\n return resolveFragmentSpreadDefinition(preprocessed, fragmentSpread, externalFragments);\n }\n\n // 2. Try field/type navigation in schema files\n if (input.schema && input.schemaFiles && input.schemaFiles.length > 0) {\n const reconstructedLineOffsets = computeLineOffsets(preprocessed);\n const reconstructedPosition = offsetToPosition(reconstructedLineOffsets, reconstructedOffset);\n return resolveSchemaDefinition(preprocessed, reconstructedPosition, input.schema, input.schemaFiles);\n }\n\n return [];\n};\n\n/** Resolve fragment spread to its definition in an external TypeScript file. */\nconst resolveFragmentSpreadDefinition = async (\n preprocessed: string,\n fragmentSpread: ReturnType<typeof findFragmentSpreadAtOffset> & {},\n externalFragments: readonly IndexedFragment[],\n): Promise<Location[]> => {\n const fragmentInfos = externalFragments.map((f) => ({\n filePath: f.uri,\n content: f.content,\n definition: f.definition,\n }));\n\n try {\n const result = await getDefinitionQueryResultForFragmentSpread(preprocessed, fragmentSpread, fragmentInfos);\n\n return result.definitions.map((def): Location => {\n const defPosition = toIPosition(def.position);\n const endLine = def.range?.end?.line ?? defPosition.line;\n const endChar = def.range?.end?.character ?? defPosition.character;\n\n // Map GraphQL-relative positions to TS file positions for the target document\n const targetFragment = externalFragments.find((f) => f.uri === def.path);\n if (targetFragment) {\n const targetReconstructedLineOffsets = computeLineOffsets(targetFragment.content);\n const targetContentLineOffsets = computeLineOffsets(targetFragment.content.slice(targetFragment.headerLen));\n\n const toOriginalPos = (pos: { line: number; character: number }) => {\n const offset = positionToOffset(targetReconstructedLineOffsets, pos);\n const originalOffset = Math.max(0, offset - targetFragment.headerLen);\n return offsetToPosition(targetContentLineOffsets, originalOffset);\n };\n\n const targetMapper = createPositionMapper({\n tsSource: targetFragment.tsSource,\n contentStartOffset: targetFragment.contentRange.start,\n graphqlContent: targetFragment.content.slice(targetFragment.headerLen),\n });\n const tsStart = targetMapper.graphqlToTs(toOriginalPos({ line: defPosition.line, character: defPosition.character }));\n const tsEnd = targetMapper.graphqlToTs(toOriginalPos({ line: endLine, character: endChar }));\n return {\n uri: def.path,\n range: { start: tsStart, end: tsEnd },\n };\n }\n\n return {\n uri: def.path,\n range: {\n start: { line: defPosition.line, character: defPosition.character },\n end: { line: endLine, character: endChar },\n },\n };\n });\n } catch {\n return [];\n }\n};\n\n/** Resolve field or type name to its definition in a schema .graphql file. */\nconst resolveSchemaDefinition = (\n preprocessed: string,\n position: Position,\n schema: GraphQLSchema,\n schemaFiles: readonly SchemaFileInfo[],\n): Promise<Location[]> => {\n const context = getContextAtPosition(preprocessed, toIPosition(position), schema);\n if (!context) {\n return Promise.resolve([]);\n }\n\n const { typeInfo } = context;\n\n // Field definition: cursor is on a field name\n if (typeInfo.fieldDef && typeInfo.parentType) {\n const fieldName = typeInfo.fieldDef.name;\n const namedParentType = getNamedType(typeInfo.parentType);\n if (!namedParentType) {\n return Promise.resolve([]);\n }\n const parentTypeName = namedParentType.name;\n const objectTypeInfos = buildObjectTypeInfos(schemaFiles);\n return getDefinitionQueryResultForField(fieldName, parentTypeName, objectTypeInfos).then((result) =>\n result.definitions.map(\n (def): Location => ({\n uri: def.path ?? \"\",\n range: {\n start: { line: def.position.line, character: def.position.character },\n end: {\n line: def.range?.end?.line ?? def.position.line,\n character: def.range?.end?.character ?? def.position.character,\n },\n },\n }),\n ),\n );\n }\n\n return Promise.resolve([]);\n};\n","/**\n * Diagnostics handler: validates GraphQL templates against schema.\n * @module\n */\n\nimport type { FragmentDefinitionNode, GraphQLSchema } from \"graphql\";\nimport { getDiagnostics } from \"graphql-language-service\";\nimport type { Diagnostic } from \"vscode-languageserver-types\";\nimport { reconstructGraphql } from \"../document-manager\";\nimport { preprocessFragmentArgs } from \"../fragment-args-preprocessor\";\nimport { computeLineOffsets, createPositionMapper, offsetToPosition, positionToOffset } from \"../position-mapping\";\nimport type { ExtractedTemplate } from \"../types\";\n\nexport type ComputeDiagnosticsInput = {\n readonly template: ExtractedTemplate;\n readonly schema: GraphQLSchema;\n readonly tsSource: string;\n /** External fragment definitions for cross-file resolution. */\n readonly externalFragments?: readonly FragmentDefinitionNode[];\n};\n\n/** Compute LSP diagnostics for a single GraphQL template. */\nexport const computeTemplateDiagnostics = (input: ComputeDiagnosticsInput): readonly Diagnostic[] => {\n const { template, schema, tsSource } = input;\n const reconstructed = reconstructGraphql(template);\n const headerLen = reconstructed.length - template.content.length;\n const { preprocessed } = preprocessFragmentArgs(reconstructed);\n\n const mapper = createPositionMapper({\n tsSource,\n contentStartOffset: template.contentRange.start,\n graphqlContent: template.content,\n });\n\n // getDiagnostics returns positions relative to the reconstructed source\n const gqlDiagnostics = getDiagnostics(\n preprocessed,\n schema,\n undefined,\n undefined,\n input.externalFragments as FragmentDefinitionNode[] | undefined,\n );\n\n // Pattern to detect interpolation placeholder fragments\n const placeholderPattern = /__FRAG_SPREAD_\\d+__/;\n\n // Convert position from reconstructed source to template content\n const reconstructedLineOffsets = computeLineOffsets(preprocessed);\n const contentLineOffsets = computeLineOffsets(template.content);\n const toContentPosition = (pos: { line: number; character: number }) => {\n const offset = positionToOffset(reconstructedLineOffsets, pos);\n const contentOffset = Math.max(0, offset - headerLen);\n return offsetToPosition(contentLineOffsets, contentOffset);\n };\n\n return gqlDiagnostics\n .filter((diag) => {\n // Suppress diagnostics about placeholder fragments (from interpolation)\n if (placeholderPattern.test(diag.message)) {\n return false;\n }\n // Suppress diagnostics that point into the synthesized header\n const offset = positionToOffset(reconstructedLineOffsets, diag.range.start);\n if (offset < headerLen) {\n return false;\n }\n return true;\n })\n .map((diag): Diagnostic => {\n // Convert from reconstructed space to content space, then to TS space\n const startContent = toContentPosition(diag.range.start);\n const endContent = toContentPosition(diag.range.end);\n const startTs = mapper.graphqlToTs(startContent);\n const endTs = mapper.graphqlToTs(endContent);\n\n return {\n range: {\n start: { line: startTs.line, character: startTs.character },\n end: { line: endTs.line, character: endTs.character },\n },\n message: diag.message,\n severity: diag.severity,\n source: \"soda-gql\",\n };\n });\n};\n","/**\n * Document symbol handler: provides outline view for GraphQL templates.\n * @module\n */\n\nimport { getOutline } from \"graphql-language-service\";\nimport { type DocumentSymbol, SymbolKind } from \"vscode-languageserver-types\";\nimport { reconstructGraphql } from \"../document-manager\";\nimport { preprocessFragmentArgs } from \"../fragment-args-preprocessor\";\nimport { computeLineOffsets, createPositionMapper, offsetToPosition, positionToOffset } from \"../position-mapping\";\nimport type { ExtractedTemplate } from \"../types\";\n\nexport type HandleDocumentSymbolInput = {\n readonly templates: readonly ExtractedTemplate[];\n readonly tsSource: string;\n};\n\nconst KIND_MAP: Record<string, SymbolKind> = {\n OperationDefinition: SymbolKind.Function,\n FragmentDefinition: SymbolKind.Class,\n Field: SymbolKind.Field,\n FragmentSpread: SymbolKind.Constant,\n InlineFragment: SymbolKind.Struct,\n EnumValueDefinition: SymbolKind.EnumMember,\n InputValueDefinition: SymbolKind.Property,\n FieldDefinition: SymbolKind.Field,\n ObjectTypeDefinition: SymbolKind.Class,\n InputObjectTypeDefinition: SymbolKind.Class,\n InterfaceTypeDefinition: SymbolKind.Interface,\n EnumTypeDefinition: SymbolKind.Enum,\n};\n\ntype OutlineTree = {\n readonly representativeName?: string;\n readonly tokenizedText?: ReadonlyArray<{ readonly value: string }>;\n readonly kind: string;\n readonly startPosition: { readonly line: number; readonly character: number };\n readonly endPosition?: { readonly line: number; readonly character: number };\n readonly children: readonly OutlineTree[];\n};\n\nconst getSymbolName = (tree: OutlineTree): string => {\n if (tree.representativeName) {\n return tree.representativeName;\n }\n if (tree.tokenizedText) {\n return tree.tokenizedText.map((t) => t.value).join(\"\");\n }\n return tree.kind;\n};\n\ntype PositionConverter = (pos: { line: number; character: number }) => { line: number; character: number };\n\nconst convertTree = (\n tree: OutlineTree,\n toContentPos: PositionConverter,\n mapper: ReturnType<typeof createPositionMapper>,\n): DocumentSymbol | null => {\n const name = getSymbolName(tree);\n const kind = KIND_MAP[tree.kind] ?? SymbolKind.Variable;\n\n const startTs = mapper.graphqlToTs(toContentPos(tree.startPosition));\n const endTs = tree.endPosition ? mapper.graphqlToTs(toContentPos(tree.endPosition)) : startTs;\n\n const range = {\n start: { line: startTs.line, character: startTs.character },\n end: { line: endTs.line, character: endTs.character },\n };\n\n const children: DocumentSymbol[] = [];\n for (const child of tree.children) {\n const converted = convertTree(child, toContentPos, mapper);\n if (converted) {\n children.push(converted);\n }\n }\n\n return {\n name,\n kind,\n range,\n selectionRange: range,\n children: children.length > 0 ? children : undefined,\n };\n};\n\n/** Handle a documentSymbol request for all GraphQL templates in a document. */\nexport const handleDocumentSymbol = (input: HandleDocumentSymbolInput): DocumentSymbol[] => {\n const { templates, tsSource } = input;\n const symbols: DocumentSymbol[] = [];\n\n for (const template of templates) {\n const reconstructed = reconstructGraphql(template);\n const headerLen = reconstructed.length - template.content.length;\n const { preprocessed } = preprocessFragmentArgs(reconstructed);\n const outline = getOutline(preprocessed);\n if (!outline) {\n continue;\n }\n\n const mapper = createPositionMapper({\n tsSource,\n contentStartOffset: template.contentRange.start,\n graphqlContent: template.content,\n });\n\n // Convert position from reconstructed source to template content\n const reconstructedLineOffsets = computeLineOffsets(preprocessed);\n const contentLineOffsets = computeLineOffsets(template.content);\n const toContentPos: PositionConverter = (pos) => {\n const offset = positionToOffset(reconstructedLineOffsets, pos);\n const contentOffset = Math.max(0, offset - headerLen);\n return offsetToPosition(contentLineOffsets, contentOffset);\n };\n\n for (const tree of outline.outlineTrees as unknown as OutlineTree[]) {\n const symbol = convertTree(tree, toContentPos, mapper);\n if (symbol) {\n symbols.push(symbol);\n }\n }\n }\n\n return symbols;\n};\n","/**\n * Formatting handler: format GraphQL content within tagged templates.\n * @module\n */\n\nimport { parse as parseGraphql, print as printGraphql } from \"graphql\";\nimport type { TextEdit } from \"vscode-languageserver-types\";\nimport { computeLineOffsets, offsetToPosition } from \"../position-mapping\";\nimport type { ExtractedTemplate } from \"../types\";\n\n/** A function that formats GraphQL source text. */\nexport type FormatGraphqlFn = (source: string) => string;\n\nexport type HandleFormattingInput = {\n readonly templates: readonly ExtractedTemplate[];\n readonly tsSource: string;\n readonly formatGraphql?: FormatGraphqlFn;\n};\n\nconst defaultFormatGraphql: FormatGraphqlFn = (source) => {\n const ast = parseGraphql(source, { noLocation: false });\n return printGraphql(ast);\n};\n\n/** Handle a document formatting request for GraphQL templates. */\nexport const handleFormatting = (input: HandleFormattingInput): TextEdit[] => {\n const { templates, tsSource, formatGraphql } = input;\n const format = formatGraphql ?? defaultFormatGraphql;\n const tsLineOffsets = computeLineOffsets(tsSource);\n const edits: TextEdit[] = [];\n\n for (const template of templates) {\n let formatted: string;\n try {\n formatted = format(template.content);\n } catch {\n continue;\n }\n\n // Fast path: skip if formatter produces identical output\n if (formatted === template.content) {\n continue;\n }\n\n // Detect base indentation from the TS source\n const baseIndent = detectBaseIndent(tsSource, template.contentRange.start);\n\n // Re-indent the formatted output\n const reindented = reindent(formatted, baseIndent, template.content);\n\n // Skip if no changes after re-indentation\n if (reindented === template.content) {\n continue;\n }\n\n const start = offsetToPosition(tsLineOffsets, template.contentRange.start);\n const end = offsetToPosition(tsLineOffsets, template.contentRange.end);\n\n edits.push({\n range: { start, end },\n newText: reindented,\n });\n }\n\n return edits;\n};\n\n/**\n * Detect the base indentation for a template by looking at the line\n * containing the opening backtick.\n */\nconst detectBaseIndent = (tsSource: string, contentStartOffset: number): string => {\n // Find the start of the line containing contentStartOffset\n let lineStart = contentStartOffset;\n while (lineStart > 0 && tsSource.charCodeAt(lineStart - 1) !== 10) {\n lineStart--;\n }\n\n // Extract leading whitespace from that line\n let i = lineStart;\n while (i < tsSource.length && (tsSource.charCodeAt(i) === 32 || tsSource.charCodeAt(i) === 9)) {\n i++;\n }\n\n return tsSource.slice(lineStart, i);\n};\n\n/**\n * Re-indent formatted GraphQL to match the embedding context.\n *\n * The original template may start with a newline (common for multi-line templates)\n * or be inline. We match the original pattern:\n * - If original starts with newline, formatted output gets newline + indented lines\n * - If original is single-line, keep formatted as single-line if it fits\n */\nconst reindent = (formatted: string, baseIndent: string, originalContent: string): string => {\n const trimmedFormatted = formatted.trim();\n\n // If original was single-line and formatted is also single-line, keep it\n if (!originalContent.includes(\"\\n\") && !trimmedFormatted.includes(\"\\n\")) {\n return trimmedFormatted;\n }\n\n // For multi-line: use the indentation pattern from the original content\n const indent = `${baseIndent} `; // add one level of indentation\n const lines = trimmedFormatted.split(\"\\n\");\n const indentedLines = lines.map((line) => (line.trim() === \"\" ? \"\" : indent + line));\n\n // Match original leading/trailing newline pattern\n const startsWithNewline = originalContent.startsWith(\"\\n\");\n const endsWithNewline = originalContent.endsWith(\"\\n\");\n\n let result = indentedLines.join(\"\\n\");\n if (startsWithNewline) {\n result = `\\n${result}`;\n }\n if (endsWithNewline) {\n result = `${result}\\n${baseIndent}`;\n }\n\n return result;\n};\n","/**\n * Hover handler: provides type information on hover in GraphQL templates.\n * @module\n */\n\nimport type { GraphQLSchema } from \"graphql\";\nimport { getHoverInformation } from \"graphql-language-service\";\nimport type { Hover, MarkupContent } from \"vscode-languageserver-types\";\nimport { reconstructGraphql } from \"../document-manager\";\nimport { preprocessFragmentArgs } from \"../fragment-args-preprocessor\";\nimport {\n computeLineOffsets,\n createPositionMapper,\n offsetToPosition,\n type Position,\n positionToOffset,\n toIPosition,\n} from \"../position-mapping\";\nimport type { ExtractedTemplate } from \"../types\";\n\nexport type HandleHoverInput = {\n readonly template: ExtractedTemplate;\n readonly schema: GraphQLSchema;\n readonly tsSource: string;\n /** LSP Position (0-indexed line, 0-indexed character) in the TS file. */\n readonly tsPosition: Position;\n};\n\n/** Handle a hover request for a GraphQL template. */\nexport const handleHover = (input: HandleHoverInput): Hover | null => {\n const { template, schema, tsSource, tsPosition } = input;\n const reconstructed = reconstructGraphql(template);\n const headerLen = reconstructed.length - template.content.length;\n const { preprocessed } = preprocessFragmentArgs(reconstructed);\n\n const mapper = createPositionMapper({\n tsSource,\n contentStartOffset: template.contentRange.start,\n graphqlContent: template.content,\n });\n\n const contentPos = mapper.tsToGraphql(tsPosition);\n if (!contentPos) {\n return null;\n }\n\n // Shift content position to reconstructed position (account for synthesized header)\n const contentLineOffsets = computeLineOffsets(template.content);\n const contentOffset = positionToOffset(contentLineOffsets, contentPos);\n const reconstructedOffset = contentOffset + headerLen;\n const reconstructedLineOffsets = computeLineOffsets(preprocessed);\n const gqlPosition = offsetToPosition(reconstructedLineOffsets, reconstructedOffset);\n\n const hoverInfo = getHoverInformation(schema, preprocessed, toIPosition(gqlPosition), undefined, {\n useMarkdown: true,\n });\n\n // getHoverInformation returns Hover['contents'] which can be string, MarkupContent, or MarkedString[]\n if (!hoverInfo || hoverInfo === \"\" || (Array.isArray(hoverInfo) && hoverInfo.length === 0)) {\n return null;\n }\n\n // Normalize to MarkupContent\n let contents: MarkupContent;\n if (typeof hoverInfo === \"string\") {\n contents = { kind: \"markdown\", value: hoverInfo };\n } else if (Array.isArray(hoverInfo)) {\n const parts = hoverInfo.map((item) => (typeof item === \"string\" ? item : item.value));\n contents = { kind: \"markdown\", value: parts.join(\"\\n\\n\") };\n } else {\n contents = hoverInfo as MarkupContent;\n }\n\n return { contents };\n};\n","/**\n * References handler: find all usages of a fragment across the workspace.\n * @module\n */\n\nimport type { Location } from \"vscode-languageserver-types\";\nimport { preprocessFragmentArgs } from \"../fragment-args-preprocessor\";\nimport { computeLineOffsets, createPositionMapper, type Position, positionToOffset } from \"../position-mapping\";\nimport type { ExtractedTemplate, FragmentSpreadLocation, IndexedFragment } from \"../types\";\n\nimport { computeFragmentDefinitionRanges, computeSpreadLocationRanges, resolveFragmentNameAtOffset } from \"./_utils\";\n\nexport type HandleReferencesInput = {\n readonly template: ExtractedTemplate;\n readonly tsSource: string;\n readonly tsPosition: Position;\n readonly allFragments: readonly IndexedFragment[];\n readonly findSpreadLocations: (fragmentName: string) => readonly FragmentSpreadLocation[];\n};\n\n/** Handle a references request for a GraphQL template. */\nexport const handleReferences = (input: HandleReferencesInput): Location[] => {\n const { template, tsSource, tsPosition, allFragments, findSpreadLocations } = input;\n const { preprocessed } = preprocessFragmentArgs(template.content);\n\n const mapper = createPositionMapper({\n tsSource,\n contentStartOffset: template.contentRange.start,\n graphqlContent: template.content,\n });\n\n const gqlPosition = mapper.tsToGraphql(tsPosition);\n if (!gqlPosition) {\n return [];\n }\n\n const offset = positionToOffset(computeLineOffsets(preprocessed), gqlPosition);\n\n // Determine the fragment name at cursor\n const fragmentName = resolveFragmentNameAtOffset(preprocessed, offset);\n if (!fragmentName) {\n return [];\n }\n\n const locations: Location[] = [];\n\n // Collect fragment definition locations\n for (const r of computeFragmentDefinitionRanges(fragmentName, allFragments)) {\n locations.push({ uri: r.uri, range: r.range });\n }\n\n // Collect fragment spread locations\n for (const r of computeSpreadLocationRanges(findSpreadLocations(fragmentName))) {\n locations.push({ uri: r.uri, range: r.range });\n }\n\n return locations;\n};\n","/**\n * Rename handler: rename fragments across the workspace.\n * @module\n */\n\nimport type { Range, TextEdit, WorkspaceEdit } from \"vscode-languageserver-types\";\nimport { preprocessFragmentArgs } from \"../fragment-args-preprocessor\";\nimport { computeLineOffsets, createPositionMapper, offsetToPosition, type Position, positionToOffset } from \"../position-mapping\";\nimport type { ExtractedTemplate, FragmentSpreadLocation, IndexedFragment } from \"../types\";\nimport {\n computeFragmentDefinitionRanges,\n computeSpreadLocationRanges,\n findFragmentDefinitionAtOffset,\n findFragmentSpreadAtOffset,\n resolveFragmentNameAtOffset,\n} from \"./_utils\";\n\nexport type HandlePrepareRenameInput = {\n readonly template: ExtractedTemplate;\n readonly tsSource: string;\n readonly tsPosition: Position;\n};\n\nexport type HandleRenameInput = {\n readonly template: ExtractedTemplate;\n readonly tsSource: string;\n readonly tsPosition: Position;\n readonly newName: string;\n readonly allFragments: readonly IndexedFragment[];\n readonly findSpreadLocations: (fragmentName: string) => readonly FragmentSpreadLocation[];\n};\n\n/** Validate and return the range of the symbol to be renamed. */\nexport const handlePrepareRename = (input: HandlePrepareRenameInput): { range: Range; placeholder: string } | null => {\n const { template, tsSource, tsPosition } = input;\n const { preprocessed } = preprocessFragmentArgs(template.content);\n\n const mapper = createPositionMapper({\n tsSource,\n contentStartOffset: template.contentRange.start,\n graphqlContent: template.content,\n });\n\n const gqlPosition = mapper.tsToGraphql(tsPosition);\n if (!gqlPosition) {\n return null;\n }\n\n const offset = positionToOffset(computeLineOffsets(preprocessed), gqlPosition);\n\n // Check fragment definition name\n const defResult = findFragmentDefinitionAtOffset(preprocessed, offset);\n if (defResult) {\n const gqlLineOffsets = computeLineOffsets(preprocessed);\n const start = mapper.graphqlToTs(offsetToPosition(gqlLineOffsets, defResult.loc.start));\n const end = mapper.graphqlToTs(offsetToPosition(gqlLineOffsets, defResult.loc.end));\n return { range: { start, end }, placeholder: defResult.name };\n }\n\n // Check fragment spread\n const spread = findFragmentSpreadAtOffset(preprocessed, offset);\n if (spread?.name.value && spread.name.loc) {\n const gqlLineOffsets = computeLineOffsets(preprocessed);\n const start = mapper.graphqlToTs(offsetToPosition(gqlLineOffsets, spread.name.loc.start));\n const end = mapper.graphqlToTs(offsetToPosition(gqlLineOffsets, spread.name.loc.end));\n return { range: { start, end }, placeholder: spread.name.value };\n }\n\n return null;\n};\n\n/** Perform a rename across the workspace. */\nexport const handleRename = (input: HandleRenameInput): WorkspaceEdit | null => {\n const { template, tsSource, tsPosition, newName, allFragments, findSpreadLocations } = input;\n const { preprocessed } = preprocessFragmentArgs(template.content);\n\n const mapper = createPositionMapper({\n tsSource,\n contentStartOffset: template.contentRange.start,\n graphqlContent: template.content,\n });\n\n const gqlPosition = mapper.tsToGraphql(tsPosition);\n if (!gqlPosition) {\n return null;\n }\n\n const offset = positionToOffset(computeLineOffsets(preprocessed), gqlPosition);\n\n // Determine the fragment name at cursor\n const fragmentName = resolveFragmentNameAtOffset(preprocessed, offset);\n if (!fragmentName) {\n return null;\n }\n\n const changes: Record<string, TextEdit[]> = {};\n\n const addEdit = (uri: string, range: Range, text: string): void => {\n if (!changes[uri]) {\n changes[uri] = [];\n }\n changes[uri].push({ range, newText: text });\n };\n\n // Rename fragment definitions\n for (const r of computeFragmentDefinitionRanges(fragmentName, allFragments)) {\n addEdit(r.uri, r.range, newName);\n }\n\n // Rename fragment spreads\n for (const r of computeSpreadLocationRanges(findSpreadLocations(fragmentName))) {\n addEdit(r.uri, r.range, newName);\n }\n\n if (Object.keys(changes).length === 0) {\n return null;\n }\n\n return { changes };\n};\n","/**\n * LSP server: wires all components together via vscode-languageserver.\n * @module\n */\n\nimport { fileURLToPath } from \"node:url\";\nimport { findAllConfigFiles, findConfigFile } from \"@soda-gql/config\";\nimport {\n type Connection,\n createConnection,\n DidChangeWatchedFilesNotification,\n FileChangeType,\n type InitializeResult,\n ProposedFeatures,\n type TextDocumentChangeEvent,\n TextDocumentSyncKind,\n TextDocuments,\n} from \"vscode-languageserver/node\";\nimport { TextDocument } from \"vscode-languageserver-textdocument\";\nimport type { ConfigRegistry } from \"./config-registry\";\nimport { createConfigRegistry } from \"./config-registry\";\nimport { lspErrors } from \"./errors\";\nimport { handleCodeAction } from \"./handlers/code-action\";\nimport { handleCompletion } from \"./handlers/completion\";\nimport { handleDefinition } from \"./handlers/definition\";\nimport { computeTemplateDiagnostics } from \"./handlers/diagnostics\";\nimport { handleDocumentSymbol } from \"./handlers/document-symbol\";\nimport { handleFormatting } from \"./handlers/formatting\";\nimport { handleHover } from \"./handlers/hover\";\nimport { handleReferences } from \"./handlers/references\";\nimport { handlePrepareRename, handleRename } from \"./handlers/rename\";\n\nexport type LspServerOptions = {\n readonly connection?: Connection;\n};\n\nexport const createLspServer = (options?: LspServerOptions) => {\n const connection = options?.connection ?? createConnection(ProposedFeatures.all);\n const documents = new TextDocuments(TextDocument);\n\n let registry: ConfigRegistry | undefined;\n const swcNotification: SwcNotificationState = { shown: false };\n\n const publishDiagnosticsForDocument = (uri: string) => {\n if (!registry) {\n return;\n }\n\n const ctx = registry.resolveForUri(uri);\n if (!ctx) {\n connection.sendDiagnostics({ uri, diagnostics: [] });\n return;\n }\n\n const state = ctx.documentManager.get(uri);\n if (!state) {\n connection.sendDiagnostics({ uri, diagnostics: [] });\n return;\n }\n\n const allDiagnostics = state.templates.flatMap((template) => {\n const entry = ctx.schemaResolver.getSchema(template.schemaName);\n if (!entry) {\n return [];\n }\n const externalFragments = ctx.documentManager.getExternalFragments(uri, template.schemaName).map((f) => f.definition);\n return [...computeTemplateDiagnostics({ template, schema: entry.schema, tsSource: state.source, externalFragments })];\n });\n\n connection.sendDiagnostics({ uri, diagnostics: allDiagnostics });\n };\n\n const publishDiagnosticsForAllOpen = () => {\n for (const doc of documents.all()) {\n publishDiagnosticsForDocument(doc.uri);\n }\n };\n\n connection.onInitialize((params): InitializeResult => {\n const rootUri = params.rootUri ?? params.rootPath;\n if (!rootUri) {\n connection.window.showErrorMessage(\"soda-gql LSP: no workspace root provided\");\n return { capabilities: {} };\n }\n\n // Convert URI to path\n const rootPath = rootUri.startsWith(\"file://\") ? fileURLToPath(rootUri) : rootUri;\n\n // Discover all config files under the workspace\n let configPaths = findAllConfigFiles(rootPath);\n\n if (configPaths.length === 0) {\n // Fallback: try walking up from rootPath (for when workspace root != config dir)\n const singleConfigPath = findConfigFile(rootPath);\n if (!singleConfigPath) {\n connection.window.showErrorMessage(\"soda-gql LSP: no config file found\");\n return { capabilities: {} };\n }\n configPaths = [singleConfigPath];\n }\n\n const registryResult = createConfigRegistry(configPaths);\n if (registryResult.isErr()) {\n connection.window.showErrorMessage(`soda-gql LSP: ${registryResult.error.message}`);\n return { capabilities: {} };\n }\n\n registry = registryResult.value;\n\n return {\n capabilities: {\n textDocumentSync: TextDocumentSyncKind.Full,\n hoverProvider: true,\n documentSymbolProvider: true,\n definitionProvider: true,\n referencesProvider: true,\n renameProvider: { prepareProvider: true },\n documentFormattingProvider: true,\n completionProvider: {\n triggerCharacters: [\"{\", \"(\", \":\", \"@\", \"$\", \" \", \"\\n\", \".\"],\n },\n codeActionProvider: {\n codeActionKinds: [\"refactor.extract\"],\n },\n },\n };\n });\n\n connection.onInitialized(() => {\n // Register for file watcher on .graphql files\n connection.client.register(DidChangeWatchedFilesNotification.type, {\n watchers: [{ globPattern: \"**/*.graphql\" }],\n });\n });\n\n documents.onDidChangeContent((change: TextDocumentChangeEvent<TextDocument>) => {\n if (!registry) {\n return;\n }\n const ctx = registry.resolveForUri(change.document.uri);\n if (!ctx) {\n return;\n }\n const state = ctx.documentManager.update(change.document.uri, change.document.version, change.document.getText());\n checkSwcUnavailable(state.swcUnavailable, swcNotification, (msg) => connection.window.showErrorMessage(msg));\n publishDiagnosticsForDocument(change.document.uri);\n });\n\n documents.onDidClose((change: TextDocumentChangeEvent<TextDocument>) => {\n if (!registry) {\n return;\n }\n const ctx = registry.resolveForUri(change.document.uri);\n if (ctx) {\n ctx.documentManager.remove(change.document.uri);\n }\n connection.sendDiagnostics({ uri: change.document.uri, diagnostics: [] });\n });\n\n connection.onCompletion((params) => {\n if (!registry) {\n return [];\n }\n\n const ctx = registry.resolveForUri(params.textDocument.uri);\n if (!ctx) {\n return [];\n }\n\n const template = ctx.documentManager.findTemplateAtOffset(\n params.textDocument.uri,\n positionToOffset(documents.get(params.textDocument.uri)?.getText() ?? \"\", params.position),\n );\n\n if (!template) {\n return [];\n }\n\n const entry = ctx.schemaResolver.getSchema(template.schemaName);\n if (!entry) {\n return [];\n }\n\n const doc = documents.get(params.textDocument.uri);\n if (!doc) {\n return [];\n }\n\n const externalFragments = ctx.documentManager\n .getExternalFragments(params.textDocument.uri, template.schemaName)\n .map((f) => f.definition);\n\n return handleCompletion({\n template,\n schema: entry.schema,\n tsSource: doc.getText(),\n tsPosition: { line: params.position.line, character: params.position.character },\n externalFragments,\n });\n });\n\n connection.onHover((params) => {\n if (!registry) {\n return null;\n }\n\n const ctx = registry.resolveForUri(params.textDocument.uri);\n if (!ctx) {\n return null;\n }\n\n const doc = documents.get(params.textDocument.uri);\n if (!doc) {\n return null;\n }\n\n const template = ctx.documentManager.findTemplateAtOffset(\n params.textDocument.uri,\n positionToOffset(doc.getText(), params.position),\n );\n\n if (!template) {\n return null;\n }\n\n const entry = ctx.schemaResolver.getSchema(template.schemaName);\n if (!entry) {\n return null;\n }\n\n return handleHover({\n template,\n schema: entry.schema,\n tsSource: doc.getText(),\n tsPosition: { line: params.position.line, character: params.position.character },\n });\n });\n\n connection.onDefinition(async (params) => {\n if (!registry) {\n return [];\n }\n\n const ctx = registry.resolveForUri(params.textDocument.uri);\n if (!ctx) {\n return [];\n }\n\n const doc = documents.get(params.textDocument.uri);\n if (!doc) {\n return [];\n }\n\n const template = ctx.documentManager.findTemplateAtOffset(\n params.textDocument.uri,\n positionToOffset(doc.getText(), params.position),\n );\n\n if (!template) {\n return [];\n }\n\n const externalFragments = ctx.documentManager.getExternalFragments(params.textDocument.uri, template.schemaName);\n const entry = ctx.schemaResolver.getSchema(template.schemaName);\n\n return handleDefinition({\n template,\n tsSource: doc.getText(),\n tsPosition: { line: params.position.line, character: params.position.character },\n externalFragments,\n schema: entry?.schema,\n schemaFiles: entry?.files,\n });\n });\n\n connection.onReferences((params) => {\n if (!registry) {\n return [];\n }\n\n const ctx = registry.resolveForUri(params.textDocument.uri);\n if (!ctx) {\n return [];\n }\n\n const doc = documents.get(params.textDocument.uri);\n if (!doc) {\n return [];\n }\n\n const template = ctx.documentManager.findTemplateAtOffset(\n params.textDocument.uri,\n positionToOffset(doc.getText(), params.position),\n );\n\n if (!template) {\n return [];\n }\n\n return handleReferences({\n template,\n tsSource: doc.getText(),\n tsPosition: { line: params.position.line, character: params.position.character },\n allFragments: ctx.documentManager.getAllFragments(template.schemaName),\n findSpreadLocations: (name) => ctx.documentManager.findFragmentSpreadLocations(name, template.schemaName),\n });\n });\n\n connection.onPrepareRename((params) => {\n if (!registry) {\n return null;\n }\n\n const ctx = registry.resolveForUri(params.textDocument.uri);\n if (!ctx) {\n return null;\n }\n\n const doc = documents.get(params.textDocument.uri);\n if (!doc) {\n return null;\n }\n\n const template = ctx.documentManager.findTemplateAtOffset(\n params.textDocument.uri,\n positionToOffset(doc.getText(), params.position),\n );\n\n if (!template) {\n return null;\n }\n\n return handlePrepareRename({\n template,\n tsSource: doc.getText(),\n tsPosition: { line: params.position.line, character: params.position.character },\n });\n });\n\n connection.onRenameRequest((params) => {\n if (!registry) {\n return null;\n }\n\n const ctx = registry.resolveForUri(params.textDocument.uri);\n if (!ctx) {\n return null;\n }\n\n const doc = documents.get(params.textDocument.uri);\n if (!doc) {\n return null;\n }\n\n const template = ctx.documentManager.findTemplateAtOffset(\n params.textDocument.uri,\n positionToOffset(doc.getText(), params.position),\n );\n\n if (!template) {\n return null;\n }\n\n return handleRename({\n template,\n tsSource: doc.getText(),\n tsPosition: { line: params.position.line, character: params.position.character },\n newName: params.newName,\n allFragments: ctx.documentManager.getAllFragments(template.schemaName),\n findSpreadLocations: (name) => ctx.documentManager.findFragmentSpreadLocations(name, template.schemaName),\n });\n });\n\n connection.onDocumentSymbol((params) => {\n if (!registry) {\n return [];\n }\n\n const ctx = registry.resolveForUri(params.textDocument.uri);\n if (!ctx) {\n return [];\n }\n\n const state = ctx.documentManager.get(params.textDocument.uri);\n if (!state) {\n return [];\n }\n\n return handleDocumentSymbol({\n templates: state.templates,\n tsSource: state.source,\n });\n });\n\n connection.onDocumentFormatting((params) => {\n if (!registry) {\n return [];\n }\n\n const ctx = registry.resolveForUri(params.textDocument.uri);\n if (!ctx) {\n return [];\n }\n\n const state = ctx.documentManager.get(params.textDocument.uri);\n if (!state) {\n return [];\n }\n\n return handleFormatting({\n templates: state.templates,\n tsSource: state.source,\n });\n });\n\n connection.onCodeAction((params) => {\n if (!registry) {\n return [];\n }\n\n const ctx = registry.resolveForUri(params.textDocument.uri);\n if (!ctx) {\n return [];\n }\n\n const doc = documents.get(params.textDocument.uri);\n if (!doc) {\n return [];\n }\n\n const template = ctx.documentManager.findTemplateAtOffset(\n params.textDocument.uri,\n positionToOffset(doc.getText(), params.range.start),\n );\n\n if (!template) {\n return [];\n }\n\n const entry = ctx.schemaResolver.getSchema(template.schemaName);\n if (!entry) {\n return [];\n }\n\n return handleCodeAction({\n template,\n schema: entry.schema,\n tsSource: doc.getText(),\n uri: params.textDocument.uri,\n selectionRange: {\n start: { line: params.range.start.line, character: params.range.start.character },\n end: { line: params.range.end.line, character: params.range.end.character },\n },\n });\n });\n\n connection.onDidChangeWatchedFiles((_params) => {\n if (!registry) {\n return;\n }\n\n // Check if any .graphql files changed\n const graphqlChanged = _params.changes.some(\n (change) =>\n change.uri.endsWith(\".graphql\") && (change.type === FileChangeType.Changed || change.type === FileChangeType.Created),\n );\n\n if (graphqlChanged) {\n const result = registry.reloadAllSchemas();\n publishDiagnosticsForAllOpen();\n if (result.isErr()) {\n for (const error of result.error) {\n connection.window.showErrorMessage(`soda-gql LSP: schema reload failed: ${error.message}`);\n }\n }\n }\n });\n\n documents.listen(connection);\n\n return {\n start: () => {\n connection.listen();\n },\n };\n};\n\n/** One-time SWC unavailable notification state. */\nexport type SwcNotificationState = { shown: boolean };\n\n/** Check if SWC is unavailable and show a one-time error notification. */\nexport const checkSwcUnavailable = (\n swcUnavailable: boolean | undefined,\n state: SwcNotificationState,\n showError: (message: string) => void,\n): void => {\n if (swcUnavailable && !state.shown) {\n state.shown = true;\n showError(`soda-gql LSP: ${lspErrors.swcResolutionFailed().message}`);\n }\n};\n\n/** Convert LSP Position to byte offset in source text. */\nconst positionToOffset = (source: string, position: { line: number; character: number }): number => {\n let line = 0;\n let offset = 0;\n while (line < position.line && offset < source.length) {\n if (source.charCodeAt(offset) === 10) {\n line++;\n }\n offset++;\n }\n return offset + position.character;\n};\n"],"x_google_ignoreList":[6],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAM,qBAAqB,SAAiB,cAA8B;CACxE,IAAI,QAAQ;CACZ,IAAIA,WAA8B;AAElC,MAAK,IAAI,IAAI,YAAY,GAAG,IAAI,QAAQ,QAAQ,KAAK;EACnD,MAAM,KAAK,QAAQ;AACnB,MAAI,OAAO,UAAW;AAEtB,MAAI,UAAU;AACZ,OAAI,OAAO,UAAU;IACnB,IAAI,cAAc;AAClB,SAAK,IAAI,IAAI,IAAI,GAAG,KAAK,KAAK,QAAQ,OAAO,MAAM,KAAK;AACtD;;AAEF,QAAI,cAAc,MAAM,GAAG;AACzB,gBAAW;;;AAGf;;AAGF,MAAI,OAAO,QAAO,OAAO,KAAK;AAC5B,cAAW;AACX;;AAGF,MAAI,OAAO,KAA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