@astrojs/language-server
Advanced tools
@@ -1,3 +0,1 @@ | ||
| import type * as svelte from '@astrojs/svelte/dist/editor.cjs'; | ||
| import type * as vue from '@astrojs/vue/dist/editor.cjs'; | ||
| import type * as prettier from 'prettier'; | ||
@@ -20,4 +18,10 @@ type PackageVersion = { | ||
| export declare function getPackageInfo(packageName: string, fromPath: string[]): PackageInfo | undefined; | ||
| export declare function importSvelteIntegration(fromPath: string): typeof svelte | undefined; | ||
| export declare function importVueIntegration(fromPath: string): typeof vue | undefined; | ||
| type SvelteIntegration = { | ||
| toTSX(code: string, className: string): string; | ||
| }; | ||
| type VueIntegration = { | ||
| toTSX(code: string, className: string): string; | ||
| }; | ||
| export declare function importSvelteIntegration(fromPath: string): SvelteIntegration | undefined; | ||
| export declare function importVueIntegration(fromPath: string): VueIntegration | undefined; | ||
| export declare function importPrettier(fromPath: string): typeof prettier | undefined; | ||
@@ -24,0 +28,0 @@ export declare function getPrettierPluginPath(fromPath: string): string | undefined; |
| import type { CompletionItem, CompletionList, LanguageServiceContext } from '@volar/language-server'; | ||
| export declare function enhancedProvideCompletionItems(completions: CompletionList, documentText: string): CompletionList; | ||
| export declare function enhancedProvideCompletionItems(ts: typeof import('typescript'), completions: CompletionList, documentText: string): CompletionList; | ||
| export declare function enhancedResolveCompletionItem(resolvedCompletion: CompletionItem, context: LanguageServiceContext): CompletionItem; |
@@ -9,4 +9,4 @@ "use strict"; | ||
| const utils_js_1 = require("./utils.js"); | ||
| function enhancedProvideCompletionItems(completions, documentText) { | ||
| const importedAstroSources = (0, utils_js_1.getAlreadyImportedAstroComponentSources)(documentText); | ||
| function enhancedProvideCompletionItems(ts, completions, documentText) { | ||
| const importedAstroSources = (0, utils_js_1.getAlreadyImportedAstroComponentSources)(ts, documentText); | ||
| completions.items = completions.items | ||
@@ -13,0 +13,0 @@ .filter((completion) => { |
@@ -34,3 +34,3 @@ "use strict"; | ||
| return null; | ||
| return (0, completions_js_1.enhancedProvideCompletionItems)(originalCompletions, document.getText()); | ||
| return (0, completions_js_1.enhancedProvideCompletionItems)(ts, originalCompletions, document.getText()); | ||
| }, | ||
@@ -37,0 +37,0 @@ async resolveCompletionItem(item, token) { |
@@ -6,3 +6,3 @@ import type { TextEdit } from 'vscode-html-languageservice'; | ||
| export declare function rewriteAstroImportText(text: string): string; | ||
| export declare function getAlreadyImportedAstroComponentSources(documentText: string): Set<string>; | ||
| export declare function getAlreadyImportedAstroComponentSources(ts: typeof import('typescript'), documentText: string): Set<string>; | ||
| export declare function mapEdit(edit: TextEdit, code: AstroVirtualCode, languageId: string): TextEdit; |
@@ -9,3 +9,2 @@ "use strict"; | ||
| const utils_js_1 = require("../utils.js"); | ||
| const ts = require('typescript'); | ||
| const ASTRO_COMPONENT_SUFFIX = 'AstroComponent'; | ||
@@ -37,3 +36,3 @@ const ASTRO_IMPORT_FROM_PATTERN = /\bfrom\s+['"][^'"]+\.astro['"]/; | ||
| } | ||
| function getAlreadyImportedAstroComponentSources(documentText) { | ||
| function getAlreadyImportedAstroComponentSources(ts, documentText) { | ||
| const sources = new Set(); | ||
@@ -40,0 +39,0 @@ const sourceFile = ts.createSourceFile('component-imports.tsx', getImportParseText(documentText), ts.ScriptTarget.Latest, false, ts.ScriptKind.TSX); |
+4
-5
| { | ||
| "name": "@astrojs/language-server", | ||
| "version": "2.16.7", | ||
| "version": "2.16.8", | ||
| "author": "withastro", | ||
@@ -65,8 +65,7 @@ "license": "MIT", | ||
| "scripts": { | ||
| "build": "tsc", | ||
| "dev": "tsc --watch", | ||
| "build": "tsc -b", | ||
| "dev": "tsc -b --watch", | ||
| "test": "astro-scripts test \"**/*.test.ts\" --teardown-test ./test/misc/teardown.ts --tsx true --setup ./test/setup.ts", | ||
| "test:match": "pnpm run test --match", | ||
| "typecheck:tests": "tsc --build test/tsconfig.json" | ||
| "test:match": "pnpm run test --match" | ||
| } | ||
| } |
208173
0.02%4656
0.06%