@volar/typescript
Advanced tools
Comparing version 1.0.22 to 1.0.24
@@ -45,5 +45,5 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
if (sourceFile) { | ||
const source = core.virtualFiles.getSourceByVirtualFileName(sourceFile.fileName); | ||
if (source) { | ||
if (!source[2].capabilities.diagnostic) | ||
const [virtualFile, source] = core.virtualFiles.getVirtualFile(sourceFile.fileName); | ||
if (virtualFile && source) { | ||
if (!virtualFile.capabilities.diagnostic) | ||
return []; | ||
@@ -77,8 +77,8 @@ const errors = transformDiagnostics((_b = (_a = ls.getProgram()) === null || _a === void 0 ? void 0 : _a[api](sourceFile, cancellationToken)) !== null && _b !== void 0 ? _b : []); | ||
&& diagnostic.length !== undefined) { | ||
const source = core.virtualFiles.getSourceByVirtualFileName(diagnostic.file.fileName); | ||
if (source) { | ||
if (((_b = (_a = core.typescript.languageServiceHost).fileExists) === null || _b === void 0 ? void 0 : _b.call(_a, source[0])) === false) | ||
const [virtualFile, source] = core.virtualFiles.getVirtualFile(diagnostic.file.fileName); | ||
if (virtualFile && source) { | ||
if (((_b = (_a = core.typescript.languageServiceHost).fileExists) === null || _b === void 0 ? void 0 : _b.call(_a, source.fileName)) === false) | ||
continue; | ||
for (const [sourceFileName, map] of core.virtualFiles.getMaps(source[2])) { | ||
if (sourceFileName !== source[0]) | ||
for (const [sourceFileName, map] of core.virtualFiles.getMaps(virtualFile)) { | ||
if (sourceFileName !== source.fileName) | ||
continue; | ||
@@ -91,3 +91,3 @@ for (const start of map.toSourceOffsets(diagnostic.start)) { | ||
continue; | ||
onMapping(diagnostic, source[0], start[0], end[0], source[1].getText(0, source[1].getLength())); | ||
onMapping(diagnostic, source.fileName, start[0], end[0], source.snapshot.getText(0, source.snapshot.getLength())); | ||
break; | ||
@@ -94,0 +94,0 @@ } |
@@ -12,3 +12,2 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
// only support for .ts for now, not support for .vue | ||
getCompletionsAtPosition, | ||
getDefinitionAtPosition, | ||
@@ -49,3 +48,3 @@ getDefinitionAndBoundSpan, | ||
let edits = []; | ||
const file = (_a = core.virtualFiles.get(args.fileName)) === null || _a === void 0 ? void 0 : _a[1]; | ||
const file = (_a = core.virtualFiles.getSource(args.fileName)) === null || _a === void 0 ? void 0 : _a.root; | ||
if (file) { | ||
@@ -63,9 +62,2 @@ embedded.forEachEmbeddedFile(file, embedded => { | ||
} | ||
function getCompletionsAtPosition(fileName, position, options) { | ||
const finalResult = ls.getCompletionsAtPosition(fileName, position, options); | ||
if (finalResult) { | ||
finalResult.entries = finalResult.entries.filter(entry => entry.name.indexOf('__VLS_') === -1); | ||
} | ||
return finalResult; | ||
} | ||
function getReferencesAtPosition(fileName, position) { | ||
@@ -92,3 +84,2 @@ return findLocations(fileName, position, 'references'); | ||
function withMirrors(fileName, position) { | ||
var _a; | ||
if (loopChecker.has(fileName + ':' + position)) | ||
@@ -108,3 +99,3 @@ return; | ||
loopChecker.add(ref.fileName + ':' + ref.textSpan.start); | ||
const virtualFile = (_a = core.virtualFiles.getSourceByVirtualFileName(ref.fileName)) === null || _a === void 0 ? void 0 : _a[2]; | ||
const [virtualFile] = core.virtualFiles.getVirtualFile(ref.fileName); | ||
if (!virtualFile) | ||
@@ -141,3 +132,2 @@ continue; | ||
function withMirrors(fileName, position) { | ||
var _a; | ||
if (loopChecker.has(fileName + ':' + position)) | ||
@@ -157,3 +147,3 @@ return; | ||
loopChecker.add(ref.fileName + ':' + ref.textSpan.start); | ||
const virtualFile = (_a = core.virtualFiles.getSourceByVirtualFileName(ref.fileName)) === null || _a === void 0 ? void 0 : _a[2]; | ||
const [virtualFile] = core.virtualFiles.getVirtualFile(ref.fileName); | ||
if (!virtualFile) | ||
@@ -180,3 +170,2 @@ continue; | ||
function withMirrors(fileName, position) { | ||
var _a; | ||
if (loopChecker.has(fileName + ':' + position)) | ||
@@ -192,3 +181,3 @@ return; | ||
loopChecker.add(ref.fileName + ':' + ref.textSpan.start); | ||
const virtualFile = (_a = core.virtualFiles.getSourceByVirtualFileName(ref.fileName)) === null || _a === void 0 ? void 0 : _a[2]; | ||
const [virtualFile] = core.virtualFiles.getVirtualFile(ref.fileName); | ||
if (!virtualFile) | ||
@@ -212,5 +201,5 @@ continue; | ||
function transformFileTextChanges(changes) { | ||
const source = core.virtualFiles.getSourceByVirtualFileName(changes.fileName); | ||
const [_, source] = core.virtualFiles.getVirtualFile(changes.fileName); | ||
if (source) { | ||
return Object.assign(Object.assign({}, changes), { fileName: source[0], textChanges: changes.textChanges.map(c => { | ||
return Object.assign(Object.assign({}, changes), { fileName: source.fileName, textChanges: changes.textChanges.map(c => { | ||
const span = transformSpan(changes.fileName, c.span); | ||
@@ -256,6 +245,6 @@ if (span) { | ||
return; | ||
const source = core.virtualFiles.getSourceByVirtualFileName(fileName); | ||
if (source) { | ||
for (const [sourceFileName, map] of core.virtualFiles.getMaps(source[2])) { | ||
if (source[0] !== sourceFileName) | ||
const [virtualFile, source] = core.virtualFiles.getVirtualFile(fileName); | ||
if (virtualFile && source) { | ||
for (const [sourceFileName, map] of core.virtualFiles.getMaps(virtualFile)) { | ||
if (source.fileName !== sourceFileName) | ||
continue; | ||
@@ -265,3 +254,3 @@ const sourceLoc = map.toSourceOffset(textSpan.start); | ||
return { | ||
fileName: source[0], | ||
fileName: source.fileName, | ||
textSpan: { | ||
@@ -268,0 +257,0 @@ start: sourceLoc[0], |
{ | ||
"name": "@volar/typescript", | ||
"version": "1.0.22", | ||
"version": "1.0.24", | ||
"main": "out/index.js", | ||
@@ -16,5 +16,5 @@ "license": "MIT", | ||
"dependencies": { | ||
"@volar/language-core": "1.0.22" | ||
"@volar/language-core": "1.0.24" | ||
}, | ||
"gitHead": "eed05323d6fe1d8eda712f63bb765ba57bdd40ae" | ||
"gitHead": "46da609e8914e29642f4707dec31507ad51b03fc" | ||
} |
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
21320
407
+ Added@volar/language-core@1.0.24(transitive)
+ Added@volar/source-map@1.0.24(transitive)
- Removed@volar/language-core@1.0.22(transitive)
- Removed@volar/source-map@1.0.22(transitive)
Updated@volar/language-core@1.0.24