@tamagui/language-service 0.0.0-bootstrap.0 → 3.0.0-beta.643.1

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.
Files changed (80) hide show
  1. package/README.md +140 -1
  2. package/dist/cjs/check.cjs +173 -0
  3. package/dist/cjs/check.native.cjs +369 -0
  4. package/dist/cjs/check.native.js +371 -0
  5. package/dist/cjs/check.native.js.map +1 -0
  6. package/dist/cjs/core.cjs +221 -0
  7. package/dist/cjs/core.native.cjs +305 -0
  8. package/dist/cjs/core.native.js +307 -0
  9. package/dist/cjs/core.native.js.map +1 -0
  10. package/dist/cjs/document.cjs +82 -0
  11. package/dist/cjs/document.native.cjs +158 -0
  12. package/dist/cjs/document.native.js +160 -0
  13. package/dist/cjs/document.native.js.map +1 -0
  14. package/dist/cjs/extract-estree.cjs +193 -0
  15. package/dist/cjs/extract-estree.native.cjs +296 -0
  16. package/dist/cjs/extract-estree.native.js +298 -0
  17. package/dist/cjs/extract-estree.native.js.map +1 -0
  18. package/dist/cjs/extract-sucrase.cjs +222 -0
  19. package/dist/cjs/extract-sucrase.native.cjs +256 -0
  20. package/dist/cjs/extract-sucrase.native.js +258 -0
  21. package/dist/cjs/extract-sucrase.native.js.map +1 -0
  22. package/dist/cjs/host.cjs +38 -0
  23. package/dist/cjs/host.native.cjs +61 -0
  24. package/dist/cjs/host.native.js +63 -0
  25. package/dist/cjs/host.native.js.map +1 -0
  26. package/dist/cjs/index.cjs +301 -0
  27. package/dist/cjs/index.native.cjs +414 -0
  28. package/dist/cjs/index.native.js +416 -0
  29. package/dist/cjs/index.native.js.map +1 -0
  30. package/dist/esm/check.mjs +148 -0
  31. package/dist/esm/check.mjs.map +1 -0
  32. package/dist/esm/check.native.js +342 -0
  33. package/dist/esm/check.native.js.map +1 -0
  34. package/dist/esm/core.mjs +198 -0
  35. package/dist/esm/core.mjs.map +1 -0
  36. package/dist/esm/core.native.js +280 -0
  37. package/dist/esm/core.native.js.map +1 -0
  38. package/dist/esm/document.mjs +61 -0
  39. package/dist/esm/document.mjs.map +1 -0
  40. package/dist/esm/document.native.js +135 -0
  41. package/dist/esm/document.native.js.map +1 -0
  42. package/dist/esm/extract-estree.mjs +172 -0
  43. package/dist/esm/extract-estree.mjs.map +1 -0
  44. package/dist/esm/extract-estree.native.js +273 -0
  45. package/dist/esm/extract-estree.native.js.map +1 -0
  46. package/dist/esm/extract-sucrase.mjs +201 -0
  47. package/dist/esm/extract-sucrase.mjs.map +1 -0
  48. package/dist/esm/extract-sucrase.native.js +233 -0
  49. package/dist/esm/extract-sucrase.native.js.map +1 -0
  50. package/dist/esm/host.mjs +17 -0
  51. package/dist/esm/host.mjs.map +1 -0
  52. package/dist/esm/host.native.js +38 -0
  53. package/dist/esm/host.native.js.map +1 -0
  54. package/dist/esm/index.mjs +281 -0
  55. package/dist/esm/index.mjs.map +1 -0
  56. package/dist/esm/index.native.js +392 -0
  57. package/dist/esm/index.native.js.map +1 -0
  58. package/index.cjs +1 -0
  59. package/package.json +79 -7
  60. package/src/check.ts +204 -0
  61. package/src/core.ts +355 -0
  62. package/src/document.ts +140 -0
  63. package/src/extract-estree.ts +251 -0
  64. package/src/extract-sucrase.ts +308 -0
  65. package/src/host.ts +32 -0
  66. package/src/index.ts +452 -0
  67. package/types/check.d.ts +31 -0
  68. package/types/check.d.ts.map +11 -0
  69. package/types/core.d.ts +68 -0
  70. package/types/core.d.ts.map +11 -0
  71. package/types/document.d.ts +42 -0
  72. package/types/document.d.ts.map +11 -0
  73. package/types/extract-estree.d.ts +19 -0
  74. package/types/extract-estree.d.ts.map +11 -0
  75. package/types/extract-sucrase.d.ts +26 -0
  76. package/types/extract-sucrase.d.ts.map +11 -0
  77. package/types/host.d.ts +10 -0
  78. package/types/host.d.ts.map +11 -0
  79. package/types/index.d.ts +9 -0
  80. package/types/index.d.ts.map +11 -0
@@ -0,0 +1,281 @@
1
+ import { isAbsolute, resolve } from "node:path";
2
+ import { completionSortText, createStyleTooling } from "./core.mjs";
3
+ import { resolveTamaguiHost } from "./host.mjs";
4
+
5
+ const completionSource = "@tamagui/language-service";
6
+ const diagnosticCode = 78711;
7
+ const defaultConfigPath = ".tamagui/tamagui.config.json";
8
+ const flatStyledModules = /* @__PURE__ */ new Set([
9
+ "tamagui",
10
+ "tamagui/unstyled",
11
+ "@tamagui/core",
12
+ "@tamagui/ui",
13
+ "@tamagui/web"
14
+ ]);
15
+ function loadTooling(info, configPath) {
16
+ const contents = info.serverHost.readFile(configPath);
17
+ if (contents === void 0) return null;
18
+ try {
19
+ return createStyleTooling(JSON.parse(contents));
20
+ } catch {
21
+ return null;
22
+ }
23
+ }
24
+ function findStringLiteralAtPosition(typescript, sourceFile, position) {
25
+ let found = null;
26
+ const visit = (node) => {
27
+ if (position < node.getFullStart() || position > node.getEnd()) return;
28
+ if (typescript.isStringLiteralLike(node) && position >= node.getStart(sourceFile) + 1 && position <= node.getEnd() - 1) {
29
+ found = node;
30
+ return;
31
+ }
32
+ typescript.forEachChild(node, visit);
33
+ };
34
+ visit(sourceFile);
35
+ return found;
36
+ }
37
+ function importedBindings(typescript, sourceFile) {
38
+ const styled = /* @__PURE__ */ new Set();
39
+ for (const statement of sourceFile.statements) {
40
+ if (!typescript.isImportDeclaration(statement) || !typescript.isStringLiteral(statement.moduleSpecifier)) {
41
+ continue;
42
+ }
43
+ const source = statement.moduleSpecifier.text;
44
+ if (!flatStyledModules.has(source)) continue;
45
+ const bindings = statement.importClause?.namedBindings;
46
+ if (!bindings) continue;
47
+ if (typescript.isNamespaceImport(bindings)) continue;
48
+ for (const element of bindings.elements) {
49
+ const imported = element.propertyName?.text || element.name.text;
50
+ if (imported === "styled") styled.add(element.name.text);
51
+ }
52
+ }
53
+ return { styled };
54
+ }
55
+ function propertyName(typescript, name) {
56
+ if (typescript.isIdentifier(name) || typescript.isStringLiteral(name)) {
57
+ return name.text;
58
+ }
59
+ return null;
60
+ }
61
+ function completionProperty(typescript, literal, tooling, checker, bindings) {
62
+ let parent = literal.parent;
63
+ if (typescript.isJsxExpression(parent)) parent = parent.parent;
64
+ if (typescript.isJsxAttribute(parent)) {
65
+ if (!typescript.isIdentifier(parent.name)) return null;
66
+ const property2 = parent.name.text;
67
+ if (!tooling.styleProps.has(property2)) return null;
68
+ const opening = parent.parent.parent;
69
+ if (!typescript.isJsxOpeningLikeElement(opening)) return null;
70
+ const host2 = resolveTamaguiHost(checker, opening.tagName);
71
+ if (!host2?.accepts(property2)) return null;
72
+ return { property: property2 };
73
+ }
74
+ if (!typescript.isPropertyAssignment(parent)) return null;
75
+ const property = propertyName(typescript, parent.name);
76
+ if (!property || !tooling.styleProps.has(property)) return null;
77
+ let current = parent;
78
+ while (current.parent && !typescript.isCallExpression(current.parent)) {
79
+ current = current.parent;
80
+ }
81
+ if (!current.parent || !typescript.isCallExpression(current.parent)) return null;
82
+ const call = current.parent;
83
+ if (call.arguments[1] !== current || !typescript.isIdentifier(call.expression) || !bindings.styled.has(call.expression.text)) {
84
+ return null;
85
+ }
86
+ const component = call.arguments[0];
87
+ const host = component && resolveTamaguiHost(checker, component);
88
+ if (!host?.accepts(property)) return null;
89
+ return { property };
90
+ }
91
+ function siteForLiteral(typescript, sourceFile, literal, tooling, checker, bindings) {
92
+ const site = completionProperty(typescript, literal, tooling, checker, bindings);
93
+ if (!site) return null;
94
+ const contentStart = literal.getStart(sourceFile) + 1;
95
+ const contentEnd = literal.getEnd() - 1;
96
+ const sourceInput = sourceFile.text.slice(contentStart, contentEnd);
97
+ if (literal.text !== sourceInput) return null;
98
+ return {
99
+ property: site.property,
100
+ value: literal.text,
101
+ contentStart,
102
+ literal
103
+ };
104
+ }
105
+ function collectLiteralSites(typescript, sourceFile, tooling, checker, bindings) {
106
+ const sites = [];
107
+ const visit = (node) => {
108
+ if (typescript.isStringLiteralLike(node)) {
109
+ const site = siteForLiteral(typescript, sourceFile, node, tooling, checker, bindings);
110
+ if (site) sites.push(site);
111
+ return;
112
+ }
113
+ typescript.forEachChild(node, visit);
114
+ };
115
+ visit(sourceFile);
116
+ return sites;
117
+ }
118
+ function copyLanguageService(service) {
119
+ const proxy = /* @__PURE__ */ Object.create(null);
120
+ for (const key of Object.keys(service)) {
121
+ const value = service[key];
122
+ proxy[key] = typeof value === "function" ? value.bind(service) : value;
123
+ }
124
+ return proxy;
125
+ }
126
+ const init = ({ typescript }) => ({ create(info) {
127
+ const pluginConfig = info.config;
128
+ const configuredPath = pluginConfig?.configPath || defaultConfigPath;
129
+ const configPath = isAbsolute(configuredPath) ? configuredPath : resolve(info.project.getCurrentDirectory(), configuredPath);
130
+ let tooling = loadTooling(info, configPath);
131
+ const watcher = info.serverHost.watchFile(configPath, () => {
132
+ tooling = loadTooling(info, configPath);
133
+ });
134
+ const proxy = copyLanguageService(info.languageService);
135
+ const baseCompletions = info.languageService.getCompletionsAtPosition.bind(info.languageService);
136
+ const baseDetails = info.languageService.getCompletionEntryDetails.bind(info.languageService);
137
+ const baseSemanticDiagnostics = info.languageService.getSemanticDiagnostics.bind(info.languageService);
138
+ const baseQuickInfo = info.languageService.getQuickInfoAtPosition.bind(info.languageService);
139
+ const baseDispose = info.languageService.dispose.bind(info.languageService);
140
+ const bindingsBySourceFile = /* @__PURE__ */ new WeakMap();
141
+ const fileContext = (fileName) => {
142
+ const program = info.languageService.getProgram();
143
+ const sourceFile = program?.getSourceFile(fileName);
144
+ if (!program || !sourceFile) return null;
145
+ let bindings = bindingsBySourceFile.get(sourceFile);
146
+ if (!bindings) {
147
+ bindings = importedBindings(typescript, sourceFile);
148
+ bindingsBySourceFile.set(sourceFile, bindings);
149
+ }
150
+ return {
151
+ sourceFile,
152
+ checker: program.getTypeChecker(),
153
+ bindings
154
+ };
155
+ };
156
+ proxy.getCompletionsAtPosition = (fileName, position, options, formattingSettings) => {
157
+ const getBaseCompletions = () => baseCompletions(fileName, position, options, formattingSettings);
158
+ if (!tooling) return getBaseCompletions();
159
+ const context = fileContext(fileName);
160
+ if (!context) return getBaseCompletions();
161
+ const { sourceFile, checker, bindings } = context;
162
+ const literal = findStringLiteralAtPosition(typescript, sourceFile, position);
163
+ if (!literal) return getBaseCompletions();
164
+ const site = siteForLiteral(typescript, sourceFile, literal, tooling, checker, bindings);
165
+ if (!site) return getBaseCompletions();
166
+ const cursorCompletions = tooling.completions(site.property, site.value, position - site.contentStart);
167
+ if (!cursorCompletions) return getBaseCompletions();
168
+ const replacementSpan = {
169
+ start: site.contentStart + cursorCompletions.replaceStart,
170
+ length: cursorCompletions.replaceLength
171
+ };
172
+ const entries = [];
173
+ let contextualType;
174
+ for (const completion of cursorCompletions.completions) {
175
+ const insertText = completion.insertText || completion.value;
176
+ const modifierKind = completion.kind === "modifier" ? tooling.modifierKind(completion.value) : void 0;
177
+ if (completion.kind === "keyword") {
178
+ contextualType ||= checker.getContextualType(literal);
179
+ if (!contextualType || !checker.isTypeAssignableTo(checker.getStringLiteralType(insertText), contextualType)) {
180
+ continue;
181
+ }
182
+ }
183
+ entries.push({
184
+ name: completion.value,
185
+ kind: typescript.ScriptElementKind.string,
186
+ kindModifiers: "",
187
+ sortText: completionSortText(completion, modifierKind),
188
+ insertText,
189
+ replacementSpan,
190
+ source: completionSource,
191
+ labelDetails: { description: modifierKind ? `Tamagui ${modifierKind} modifier` : completion.kind === "configured" ? "Tamagui configured value" : "Tamagui style keyword" }
192
+ });
193
+ }
194
+ if (entries.length === 0) return getBaseCompletions();
195
+ return {
196
+ isGlobalCompletion: false,
197
+ isMemberCompletion: false,
198
+ isNewIdentifierLocation: true,
199
+ isIncomplete: true,
200
+ entries
201
+ };
202
+ };
203
+ proxy.getCompletionEntryDetails = (fileName, position, entryName, formatOptions, source, preferences, data) => {
204
+ if (source === completionSource) {
205
+ return {
206
+ name: entryName,
207
+ kind: typescript.ScriptElementKind.string,
208
+ kindModifiers: "",
209
+ displayParts: [{
210
+ text: entryName,
211
+ kind: "stringLiteral"
212
+ }],
213
+ documentation: [{
214
+ text: "Resolved from the active Tamagui config.",
215
+ kind: "text"
216
+ }],
217
+ tags: []
218
+ };
219
+ }
220
+ return baseDetails(fileName, position, entryName, formatOptions, source, preferences, data);
221
+ };
222
+ proxy.getSemanticDiagnostics = (fileName) => {
223
+ const diagnostics = [...baseSemanticDiagnostics(fileName)];
224
+ if (!tooling) return diagnostics;
225
+ const context = fileContext(fileName);
226
+ if (!context) return diagnostics;
227
+ const { sourceFile, checker, bindings } = context;
228
+ for (const site of collectLiteralSites(typescript, sourceFile, tooling, checker, bindings)) {
229
+ for (const diagnostic of tooling.diagnostics(site.property, site.value)) {
230
+ diagnostics.push({
231
+ file: sourceFile,
232
+ start: site.contentStart + diagnostic.start,
233
+ length: Math.max(1, diagnostic.end - diagnostic.start),
234
+ messageText: diagnostic.message,
235
+ category: typescript.DiagnosticCategory.Error,
236
+ code: diagnosticCode,
237
+ source: completionSource
238
+ });
239
+ }
240
+ }
241
+ return diagnostics;
242
+ };
243
+ proxy.getQuickInfoAtPosition = (fileName, position) => {
244
+ const getBaseQuickInfo = () => baseQuickInfo(fileName, position);
245
+ if (!tooling) return getBaseQuickInfo();
246
+ const context = fileContext(fileName);
247
+ if (!context) return getBaseQuickInfo();
248
+ const { sourceFile, checker, bindings } = context;
249
+ const literal = findStringLiteralAtPosition(typescript, sourceFile, position);
250
+ if (!literal) return getBaseQuickInfo();
251
+ const site = siteForLiteral(typescript, sourceFile, literal, tooling, checker, bindings);
252
+ if (!site) return getBaseQuickInfo();
253
+ const hover = tooling.hover(site.property, site.value, position - site.contentStart);
254
+ if (!hover) return getBaseQuickInfo();
255
+ return {
256
+ kind: typescript.ScriptElementKind.string,
257
+ kindModifiers: "",
258
+ textSpan: {
259
+ start: site.contentStart + hover.start,
260
+ length: hover.end - hover.start
261
+ },
262
+ displayParts: [{
263
+ text: hover.text,
264
+ kind: "stringLiteral"
265
+ }],
266
+ documentation: [{
267
+ text: hover.markdown,
268
+ kind: "text"
269
+ }]
270
+ };
271
+ };
272
+ proxy.dispose = () => {
273
+ watcher.close();
274
+ baseDispose();
275
+ };
276
+ return proxy;
277
+ } });
278
+ var index_default = init;
279
+
280
+ export { index_default as default };
281
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["esm/index.js"],"sourcesContent":["import { isAbsolute, resolve } from \"node:path\";\nimport {\n completionSortText,\n createStyleTooling\n} from \"./core\";\nimport { resolveTamaguiHost } from \"./host\";\nconst completionSource = \"@tamagui/language-service\";\nconst diagnosticCode = 78711;\nconst defaultConfigPath = \".tamagui/tamagui.config.json\";\nconst flatStyledModules = /* @__PURE__ */ new Set([\n \"tamagui\",\n \"tamagui/unstyled\",\n \"@tamagui/core\",\n \"@tamagui/ui\",\n \"@tamagui/web\"\n]);\nfunction loadTooling(info, configPath) {\n const contents = info.serverHost.readFile(configPath);\n if (contents === void 0) return null;\n try {\n return createStyleTooling(JSON.parse(contents));\n } catch {\n return null;\n }\n}\nfunction findStringLiteralAtPosition(typescript, sourceFile, position) {\n let found = null;\n const visit = (node) => {\n if (position < node.getFullStart() || position > node.getEnd()) return;\n if (typescript.isStringLiteralLike(node) && position >= node.getStart(sourceFile) + 1 && position <= node.getEnd() - 1) {\n found = node;\n return;\n }\n typescript.forEachChild(node, visit);\n };\n visit(sourceFile);\n return found;\n}\nfunction importedBindings(typescript, sourceFile) {\n const styled = /* @__PURE__ */ new Set();\n for (const statement of sourceFile.statements) {\n if (!typescript.isImportDeclaration(statement) || !typescript.isStringLiteral(statement.moduleSpecifier)) {\n continue;\n }\n const source = statement.moduleSpecifier.text;\n if (!flatStyledModules.has(source)) continue;\n const bindings = statement.importClause?.namedBindings;\n if (!bindings) continue;\n if (typescript.isNamespaceImport(bindings)) continue;\n for (const element of bindings.elements) {\n const imported = element.propertyName?.text || element.name.text;\n if (imported === \"styled\") styled.add(element.name.text);\n }\n }\n return { styled };\n}\nfunction propertyName(typescript, name) {\n if (typescript.isIdentifier(name) || typescript.isStringLiteral(name)) {\n return name.text;\n }\n return null;\n}\nfunction completionProperty(typescript, literal, tooling, checker, bindings) {\n let parent = literal.parent;\n if (typescript.isJsxExpression(parent)) parent = parent.parent;\n if (typescript.isJsxAttribute(parent)) {\n if (!typescript.isIdentifier(parent.name)) return null;\n const property2 = parent.name.text;\n if (!tooling.styleProps.has(property2)) return null;\n const opening = parent.parent.parent;\n if (!typescript.isJsxOpeningLikeElement(opening)) return null;\n const host2 = resolveTamaguiHost(checker, opening.tagName);\n if (!host2?.accepts(property2)) return null;\n return { property: property2 };\n }\n if (!typescript.isPropertyAssignment(parent)) return null;\n const property = propertyName(typescript, parent.name);\n if (!property || !tooling.styleProps.has(property)) return null;\n let current = parent;\n while (current.parent && !typescript.isCallExpression(current.parent)) {\n current = current.parent;\n }\n if (!current.parent || !typescript.isCallExpression(current.parent)) return null;\n const call = current.parent;\n if (call.arguments[1] !== current || !typescript.isIdentifier(call.expression) || !bindings.styled.has(call.expression.text)) {\n return null;\n }\n const component = call.arguments[0];\n const host = component && resolveTamaguiHost(checker, component);\n if (!host?.accepts(property)) return null;\n return { property };\n}\nfunction siteForLiteral(typescript, sourceFile, literal, tooling, checker, bindings) {\n const site = completionProperty(typescript, literal, tooling, checker, bindings);\n if (!site) return null;\n const contentStart = literal.getStart(sourceFile) + 1;\n const contentEnd = literal.getEnd() - 1;\n const sourceInput = sourceFile.text.slice(contentStart, contentEnd);\n if (literal.text !== sourceInput) return null;\n return { property: site.property, value: literal.text, contentStart, literal };\n}\nfunction collectLiteralSites(typescript, sourceFile, tooling, checker, bindings) {\n const sites = [];\n const visit = (node) => {\n if (typescript.isStringLiteralLike(node)) {\n const site = siteForLiteral(\n typescript,\n sourceFile,\n node,\n tooling,\n checker,\n bindings\n );\n if (site) sites.push(site);\n return;\n }\n typescript.forEachChild(node, visit);\n };\n visit(sourceFile);\n return sites;\n}\nfunction copyLanguageService(service) {\n const proxy = /* @__PURE__ */ Object.create(null);\n for (const key of Object.keys(service)) {\n const value = service[key];\n proxy[key] = typeof value === \"function\" ? value.bind(service) : value;\n }\n return proxy;\n}\nconst init = ({ typescript }) => ({\n create(info) {\n const pluginConfig = info.config;\n const configuredPath = pluginConfig?.configPath || defaultConfigPath;\n const configPath = isAbsolute(configuredPath) ? configuredPath : resolve(info.project.getCurrentDirectory(), configuredPath);\n let tooling = loadTooling(info, configPath);\n const watcher = info.serverHost.watchFile(configPath, () => {\n tooling = loadTooling(info, configPath);\n });\n const proxy = copyLanguageService(info.languageService);\n const baseCompletions = info.languageService.getCompletionsAtPosition.bind(\n info.languageService\n );\n const baseDetails = info.languageService.getCompletionEntryDetails.bind(\n info.languageService\n );\n const baseSemanticDiagnostics = info.languageService.getSemanticDiagnostics.bind(\n info.languageService\n );\n const baseQuickInfo = info.languageService.getQuickInfoAtPosition.bind(\n info.languageService\n );\n const baseDispose = info.languageService.dispose.bind(info.languageService);\n const bindingsBySourceFile = /* @__PURE__ */ new WeakMap();\n const fileContext = (fileName) => {\n const program = info.languageService.getProgram();\n const sourceFile = program?.getSourceFile(fileName);\n if (!program || !sourceFile) return null;\n let bindings = bindingsBySourceFile.get(sourceFile);\n if (!bindings) {\n bindings = importedBindings(typescript, sourceFile);\n bindingsBySourceFile.set(sourceFile, bindings);\n }\n return { sourceFile, checker: program.getTypeChecker(), bindings };\n };\n proxy.getCompletionsAtPosition = (fileName, position, options, formattingSettings) => {\n const getBaseCompletions = () => baseCompletions(fileName, position, options, formattingSettings);\n if (!tooling) return getBaseCompletions();\n const context = fileContext(fileName);\n if (!context) return getBaseCompletions();\n const { sourceFile, checker, bindings } = context;\n const literal = findStringLiteralAtPosition(typescript, sourceFile, position);\n if (!literal) return getBaseCompletions();\n const site = siteForLiteral(\n typescript,\n sourceFile,\n literal,\n tooling,\n checker,\n bindings\n );\n if (!site) return getBaseCompletions();\n const cursorCompletions = tooling.completions(\n site.property,\n site.value,\n position - site.contentStart\n );\n if (!cursorCompletions) return getBaseCompletions();\n const replacementSpan = {\n start: site.contentStart + cursorCompletions.replaceStart,\n length: cursorCompletions.replaceLength\n };\n const entries = [];\n let contextualType;\n for (const completion of cursorCompletions.completions) {\n const insertText = completion.insertText || completion.value;\n const modifierKind = completion.kind === \"modifier\" ? tooling.modifierKind(completion.value) : void 0;\n if (completion.kind === \"keyword\") {\n contextualType ||= checker.getContextualType(literal);\n if (!contextualType || !checker.isTypeAssignableTo(\n checker.getStringLiteralType(insertText),\n contextualType\n )) {\n continue;\n }\n }\n entries.push({\n name: completion.value,\n kind: typescript.ScriptElementKind.string,\n kindModifiers: \"\",\n sortText: completionSortText(completion, modifierKind),\n insertText,\n replacementSpan,\n source: completionSource,\n labelDetails: {\n description: modifierKind ? `Tamagui ${modifierKind} modifier` : completion.kind === \"configured\" ? \"Tamagui configured value\" : \"Tamagui style keyword\"\n }\n });\n }\n if (entries.length === 0) return getBaseCompletions();\n return {\n isGlobalCompletion: false,\n isMemberCompletion: false,\n isNewIdentifierLocation: true,\n // A completion requested immediately after whitespace has an empty\n // replacement span. Ask the editor to request again as the modifier\n // prefix grows instead of dismissing suggestions when the cursor\n // moves beyond that initial span.\n isIncomplete: true,\n entries\n };\n };\n proxy.getCompletionEntryDetails = (fileName, position, entryName, formatOptions, source, preferences, data) => {\n if (source === completionSource) {\n return {\n name: entryName,\n kind: typescript.ScriptElementKind.string,\n kindModifiers: \"\",\n displayParts: [\n {\n text: entryName,\n kind: \"stringLiteral\"\n }\n ],\n documentation: [\n {\n text: \"Resolved from the active Tamagui config.\",\n kind: \"text\"\n }\n ],\n tags: []\n };\n }\n return baseDetails(\n fileName,\n position,\n entryName,\n formatOptions,\n source,\n preferences,\n data\n );\n };\n proxy.getSemanticDiagnostics = (fileName) => {\n const diagnostics = [...baseSemanticDiagnostics(fileName)];\n if (!tooling) return diagnostics;\n const context = fileContext(fileName);\n if (!context) return diagnostics;\n const { sourceFile, checker, bindings } = context;\n for (const site of collectLiteralSites(\n typescript,\n sourceFile,\n tooling,\n checker,\n bindings\n )) {\n for (const diagnostic of tooling.diagnostics(site.property, site.value)) {\n diagnostics.push({\n file: sourceFile,\n start: site.contentStart + diagnostic.start,\n length: Math.max(1, diagnostic.end - diagnostic.start),\n messageText: diagnostic.message,\n category: typescript.DiagnosticCategory.Error,\n code: diagnosticCode,\n source: completionSource\n });\n }\n }\n return diagnostics;\n };\n proxy.getQuickInfoAtPosition = (fileName, position) => {\n const getBaseQuickInfo = () => baseQuickInfo(fileName, position);\n if (!tooling) return getBaseQuickInfo();\n const context = fileContext(fileName);\n if (!context) return getBaseQuickInfo();\n const { sourceFile, checker, bindings } = context;\n const literal = findStringLiteralAtPosition(typescript, sourceFile, position);\n if (!literal) return getBaseQuickInfo();\n const site = siteForLiteral(\n typescript,\n sourceFile,\n literal,\n tooling,\n checker,\n bindings\n );\n if (!site) return getBaseQuickInfo();\n const hover = tooling.hover(site.property, site.value, position - site.contentStart);\n if (!hover) return getBaseQuickInfo();\n return {\n kind: typescript.ScriptElementKind.string,\n kindModifiers: \"\",\n textSpan: {\n start: site.contentStart + hover.start,\n length: hover.end - hover.start\n },\n displayParts: [{ text: hover.text, kind: \"stringLiteral\" }],\n documentation: [{ text: hover.markdown, kind: \"text\" }]\n };\n };\n proxy.dispose = () => {\n watcher.close();\n baseDispose();\n };\n return proxy;\n }\n});\nvar index_default = init;\nexport {\n index_default as default\n};\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;;AAMA,MAAM,mBAAmB;AACzB,MAAM,iBAAiB;AACvB,MAAM,oBAAoB;AAC1B,MAAM,oCAAoC,IAAI,IAAI;CAChD;CACA;CACA;CACA;CACA;AACF,CAAC;AACD,SAAS,YAAY,MAAM,YAAY;CACrC,MAAM,WAAW,KAAK,WAAW,SAAS,UAAU;CACpD,IAAI,aAAa,KAAK,GAAG,OAAO;CAChC,IAAI;EACF,OAAO,mBAAmB,KAAK,MAAM,QAAQ,CAAC;CAChD,QAAQ;EACN,OAAO;CACT;AACF;AACA,SAAS,4BAA4B,YAAY,YAAY,UAAU;CACrE,IAAI,QAAQ;CACZ,MAAM,SAAS,SAAS;EACtB,IAAI,WAAW,KAAK,aAAa,K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