@volar/typescript
Advanced tools
Comparing version 2.3.0-alpha.13 to 2.3.0-alpha.14
@@ -9,5 +9,2 @@ "use strict"; | ||
const createLanguageServicePlugin_1 = require("./createLanguageServicePlugin"); | ||
const externalFiles = new WeakMap(); | ||
const decoratedLanguageServices = new WeakSet(); | ||
const decoratedLanguageServiceHosts = new WeakSet(); | ||
function createAsyncLanguageServicePlugin(extensions, scriptKind, create) { | ||
@@ -18,6 +15,6 @@ return modules => { | ||
create(info) { | ||
if (!decoratedLanguageServices.has(info.languageService) | ||
&& !decoratedLanguageServiceHosts.has(info.languageServiceHost)) { | ||
decoratedLanguageServices.add(info.languageService); | ||
decoratedLanguageServiceHosts.add(info.languageServiceHost); | ||
if (!createLanguageServicePlugin_1.decoratedLanguageServices.has(info.languageService) | ||
&& !createLanguageServicePlugin_1.decoratedLanguageServiceHosts.has(info.languageServiceHost)) { | ||
createLanguageServicePlugin_1.decoratedLanguageServices.add(info.languageService); | ||
createLanguageServicePlugin_1.decoratedLanguageServiceHosts.add(info.languageServiceHost); | ||
const emptySnapshot = ts.ScriptSnapshot.fromString(''); | ||
@@ -87,6 +84,6 @@ const getScriptSnapshot = info.languageServiceHost.getScriptSnapshot.bind(info.languageServiceHost); | ||
if (updateLevel >= (1) | ||
|| !externalFiles.has(project)) { | ||
const oldFiles = externalFiles.get(project); | ||
|| !createLanguageServicePlugin_1.externalFiles.has(project)) { | ||
const oldFiles = createLanguageServicePlugin_1.externalFiles.get(project); | ||
const newFiles = extensions.length ? (0, decorateLanguageServiceHost_1.searchExternalFiles)(ts, project, extensions) : []; | ||
externalFiles.set(project, newFiles); | ||
createLanguageServicePlugin_1.externalFiles.set(project, newFiles); | ||
if (oldFiles && !(0, createLanguageServicePlugin_1.arrayItemsEqual)(oldFiles, newFiles)) { | ||
@@ -96,3 +93,3 @@ project.refreshDiagnostics(); | ||
} | ||
return externalFiles.get(project); | ||
return createLanguageServicePlugin_1.externalFiles.get(project); | ||
}, | ||
@@ -99,0 +96,0 @@ }; |
import { Language, LanguagePlugin } from '@volar/language-core'; | ||
import type * as ts from 'typescript'; | ||
export declare const externalFiles: WeakMap<ts.server.Project, string[]>; | ||
export declare const projectExternalFileExtensions: WeakMap<ts.server.Project, string[]>; | ||
export declare const decoratedLanguageServices: WeakSet<ts.LanguageService>; | ||
export declare const decoratedLanguageServiceHosts: WeakSet<ts.LanguageServiceHost>; | ||
export declare function createLanguageServicePlugin(create: (ts: typeof import('typescript'), info: ts.server.PluginCreateInfo) => { | ||
@@ -4,0 +8,0 @@ languagePlugins: LanguagePlugin<string>[]; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.arrayItemsEqual = exports.createLanguageServicePlugin = void 0; | ||
exports.arrayItemsEqual = exports.createLanguageServicePlugin = exports.decoratedLanguageServiceHosts = exports.decoratedLanguageServices = exports.projectExternalFileExtensions = exports.externalFiles = void 0; | ||
const language_core_1 = require("@volar/language-core"); | ||
@@ -8,6 +8,6 @@ const common_1 = require("../common"); | ||
const decorateLanguageServiceHost_1 = require("../node/decorateLanguageServiceHost"); | ||
const externalFiles = new WeakMap(); | ||
const projectExternalFileExtensions = new WeakMap(); | ||
const decoratedLanguageServices = new WeakSet(); | ||
const decoratedLanguageServiceHosts = new WeakSet(); | ||
exports.externalFiles = new WeakMap(); | ||
exports.projectExternalFileExtensions = new WeakMap(); | ||
exports.decoratedLanguageServices = new WeakSet(); | ||
exports.decoratedLanguageServiceHosts = new WeakSet(); | ||
function createLanguageServicePlugin(create) { | ||
@@ -18,6 +18,6 @@ return modules => { | ||
create(info) { | ||
if (!decoratedLanguageServices.has(info.languageService) | ||
&& !decoratedLanguageServiceHosts.has(info.languageServiceHost)) { | ||
decoratedLanguageServices.add(info.languageService); | ||
decoratedLanguageServiceHosts.add(info.languageServiceHost); | ||
if (!exports.decoratedLanguageServices.has(info.languageService) | ||
&& !exports.decoratedLanguageServiceHosts.has(info.languageServiceHost)) { | ||
exports.decoratedLanguageServices.add(info.languageService); | ||
exports.decoratedLanguageServiceHosts.add(info.languageServiceHost); | ||
const { languagePlugins, setup } = create(ts, info); | ||
@@ -27,3 +27,3 @@ const extensions = languagePlugins | ||
.flat(); | ||
projectExternalFileExtensions.set(info.project, extensions); | ||
exports.projectExternalFileExtensions.set(info.project, extensions); | ||
const getScriptSnapshot = info.languageServiceHost.getScriptSnapshot.bind(info.languageServiceHost); | ||
@@ -57,7 +57,7 @@ const getScriptVersion = info.languageServiceHost.getScriptVersion.bind(info.languageServiceHost); | ||
if (updateLevel >= (1) | ||
|| !externalFiles.has(project)) { | ||
const oldFiles = externalFiles.get(project); | ||
const extensions = projectExternalFileExtensions.get(project); | ||
|| !exports.externalFiles.has(project)) { | ||
const oldFiles = exports.externalFiles.get(project); | ||
const extensions = exports.projectExternalFileExtensions.get(project); | ||
const newFiles = extensions?.length ? (0, decorateLanguageServiceHost_1.searchExternalFiles)(ts, project, extensions) : []; | ||
externalFiles.set(project, newFiles); | ||
exports.externalFiles.set(project, newFiles); | ||
if (oldFiles && !arrayItemsEqual(oldFiles, newFiles)) { | ||
@@ -67,3 +67,3 @@ project.refreshDiagnostics(); | ||
} | ||
return externalFiles.get(project); | ||
return exports.externalFiles.get(project); | ||
}, | ||
@@ -70,0 +70,0 @@ }; |
{ | ||
"name": "@volar/typescript", | ||
"version": "2.3.0-alpha.13", | ||
"version": "2.3.0-alpha.14", | ||
"license": "MIT", | ||
@@ -15,3 +15,3 @@ "files": [ | ||
"dependencies": { | ||
"@volar/language-core": "2.3.0-alpha.13", | ||
"@volar/language-core": "2.3.0-alpha.14", | ||
"path-browserify": "^1.0.1", | ||
@@ -23,5 +23,5 @@ "vscode-uri": "^3.0.8" | ||
"@types/path-browserify": "latest", | ||
"@volar/language-service": "2.3.0-alpha.13" | ||
"@volar/language-service": "2.3.0-alpha.14" | ||
}, | ||
"gitHead": "4effe4689ac845b17b7c821d50deda62c124f23b" | ||
"gitHead": "9a8179277fe224de1d13e6331115918b79b30721" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
192381
4060
+ Added@volar/language-core@2.3.0-alpha.14(transitive)
+ Added@volar/source-map@2.3.0-alpha.14(transitive)
- Removed@volar/language-core@2.3.0-alpha.13(transitive)
- Removed@volar/source-map@2.3.0-alpha.13(transitive)