@volar/typescript
Advanced tools
Comparing version 2.2.0-alpha.4 to 2.2.0-alpha.5
@@ -12,2 +12,3 @@ "use strict"; | ||
const getGlobalDiagnostics = program.getGlobalDiagnostics; | ||
const getSourceFileByPath = program.getSourceFileByPath; | ||
// for tsc --noEmit --watch | ||
@@ -46,4 +47,16 @@ // @ts-ignore | ||
}; | ||
// fix https://github.com/vuejs/language-tools/issues/4099 | ||
program.getSourceFileByPath = path => { | ||
const sourceFile = getSourceFileByPath(path); | ||
if (sourceFile) { | ||
const [serviceScript, sourceScript] = (0, utils_1.getServiceScript)(language, sourceFile.fileName); | ||
if (serviceScript) { | ||
sourceFile.text = sourceScript.snapshot.getText(0, sourceScript.snapshot.getLength()) | ||
+ sourceFile.text.substring(sourceScript.snapshot.getLength()); | ||
} | ||
} | ||
return sourceFile; | ||
}; | ||
} | ||
exports.decorateProgram = decorateProgram; | ||
//# sourceMappingURL=decorateProgram.js.map |
@@ -0,3 +1,3 @@ | ||
import { LanguagePlugin } from '@volar/language-core'; | ||
import type * as ts from 'typescript'; | ||
import { LanguagePlugin } from '@volar/language-core'; | ||
export declare function proxyCreateProgram(ts: typeof import('typescript'), original: typeof ts['createProgram'], getLanguagePlugins: (ts: typeof import('typescript'), options: ts.CreateProgramOptions) => LanguagePlugin[], getLanguageId: (fileName: string) => string): typeof import("typescript").createProgram; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.proxyCreateProgram = void 0; | ||
const decorateProgram_1 = require("./decorateProgram"); | ||
const language_core_1 = require("@volar/language-core"); | ||
const resolveModuleName_1 = require("../resolveModuleName"); | ||
const decorateProgram_1 = require("./decorateProgram"); | ||
function proxyCreateProgram(ts, original, getLanguagePlugins, getLanguageId) { | ||
@@ -8,0 +8,0 @@ return new Proxy(original, { |
@@ -5,3 +5,2 @@ import { Language, CodeInformation, SourceMap, SourceScript } from '@volar/language-core'; | ||
export declare function transformDiagnostic<T extends ts.Diagnostic>(language: Language, diagnostic: T): T | undefined; | ||
export declare function transformSourceFile(sourceFile: ts.SourceFile, sourceText: string): ts.SourceFile; | ||
export declare function transformFileTextChanges(language: Language, changes: ts.FileTextChanges, filter: (data: CodeInformation) => boolean): ts.FileTextChanges | undefined; | ||
@@ -8,0 +7,0 @@ export declare function transformDocumentSpan<T extends ts.DocumentSpan>(language: Language, documentSpan: T, filter: (data: CodeInformation) => boolean, shouldFallback?: boolean): T | undefined; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.toGeneratedOffset = exports.toSourceOffset = exports.transformTextSpan = exports.transformTextChange = exports.transformSpan = exports.transformDocumentSpan = exports.transformFileTextChanges = exports.transformSourceFile = exports.transformDiagnostic = exports.transformCallHierarchyItem = void 0; | ||
exports.toGeneratedOffset = exports.toSourceOffset = exports.transformTextSpan = exports.transformTextChange = exports.transformSpan = exports.transformDocumentSpan = exports.transformFileTextChanges = exports.transformDiagnostic = exports.transformCallHierarchyItem = void 0; | ||
const language_core_1 = require("@volar/language-core"); | ||
const utils_1 = require("./utils"); | ||
const transformedDiagnostics = new WeakMap(); | ||
const transformedSourceFiles = new WeakMap(); | ||
function transformCallHierarchyItem(language, item, filter) { | ||
@@ -38,3 +37,2 @@ const span = transformSpan(language, item.file, item.span, filter); | ||
length: sourceSpan.length, | ||
file: transformSourceFile(diagnostic.file, sourceScript.snapshot.getText(0, sourceScript.snapshot.getLength())), | ||
}); | ||
@@ -54,12 +52,2 @@ } | ||
exports.transformDiagnostic = transformDiagnostic; | ||
function transformSourceFile(sourceFile, sourceText) { | ||
if (!transformedSourceFiles.has(sourceFile)) { | ||
transformedSourceFiles.set(sourceFile, { | ||
...sourceFile, | ||
text: sourceText, | ||
}); | ||
} | ||
return transformedSourceFiles.get(sourceFile); | ||
} | ||
exports.transformSourceFile = transformSourceFile; | ||
function transformFileTextChanges(language, changes, filter) { | ||
@@ -66,0 +54,0 @@ const [_, source] = (0, utils_1.getServiceScript)(language, changes.fileName); |
{ | ||
"name": "@volar/typescript", | ||
"version": "2.2.0-alpha.4", | ||
"version": "2.2.0-alpha.5", | ||
"license": "MIT", | ||
@@ -15,3 +15,3 @@ "files": [ | ||
"dependencies": { | ||
"@volar/language-core": "2.2.0-alpha.4", | ||
"@volar/language-core": "2.2.0-alpha.5", | ||
"path-browserify": "^1.0.1" | ||
@@ -22,5 +22,5 @@ }, | ||
"@types/path-browserify": "latest", | ||
"@volar/language-service": "2.2.0-alpha.4" | ||
"@volar/language-service": "2.2.0-alpha.5" | ||
}, | ||
"gitHead": "bd85b9c56d71c411fa3342696014c4b5f7436568" | ||
"gitHead": "d28a26415df929b2cc949df276fc27e7961b0925" | ||
} |
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
172252
+ Added@volar/language-core@2.2.0-alpha.5(transitive)
+ Added@volar/source-map@2.2.0-alpha.5(transitive)
- Removed@volar/language-core@2.2.0-alpha.4(transitive)
- Removed@volar/source-map@2.2.0-alpha.4(transitive)