@volar/typescript
Advanced tools
Comparing version 1.7.0 to 1.7.1-patch.1
@@ -0,4 +1,5 @@ | ||
export * from './documentRegistry'; | ||
export * from './dtsHost'; | ||
export * from './languageService'; | ||
export * from './languageServiceHost'; | ||
export * from './sys'; | ||
export * from './dtsHost'; |
@@ -17,6 +17,7 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./documentRegistry"), exports); | ||
__exportStar(require("./dtsHost"), exports); | ||
__exportStar(require("./languageService"), exports); | ||
__exportStar(require("./languageServiceHost"), exports); | ||
__exportStar(require("./sys"), exports); | ||
__exportStar(require("./dtsHost"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -7,3 +7,3 @@ "use strict"; | ||
const languageServiceHost_1 = require("./languageServiceHost"); | ||
let documentRegistry; | ||
const documentRegistry_1 = require("./documentRegistry"); | ||
function createLanguageService(core, ts, sys) { | ||
@@ -14,3 +14,3 @@ if (!ts) { | ||
const lsHost = (0, languageServiceHost_1.createLanguageServiceHost)(core, ts, sys); | ||
const ls = ts.createLanguageService(lsHost, documentRegistry ??= ts.createDocumentRegistry()); | ||
const ls = ts.createLanguageService(lsHost, (0, documentRegistry_1.getDocumentRegistry)(ts, sys.useCaseSensitiveFileNames, core.host.getCurrentDirectory())); | ||
return new Proxy({ | ||
@@ -98,2 +98,3 @@ organizeImports, | ||
: mode === 'implementation' ? ls.getImplementationAtPosition(fileName, position) | ||
// @ts-expect-error | ||
: mode === 'rename' && preferences ? ls.findRenameLocations(fileName, position, findInStrings, findInComments, preferences) | ||
@@ -100,0 +101,0 @@ : undefined; |
@@ -24,4 +24,4 @@ "use strict"; | ||
}, | ||
useCaseSensitiveFileNames: sys ? () => sys.useCaseSensitiveFileNames : undefined, | ||
getNewLine: sys ? () => sys.newLine : undefined, | ||
useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames, | ||
getNewLine: () => sys.newLine, | ||
readFile: fileName => { | ||
@@ -144,24 +144,16 @@ const snapshot = getScriptSnapshot(fileName); | ||
function getScriptVersion(fileName) { | ||
// virtual files | ||
// virtual files / root files / opened files | ||
const [virtualFile] = ctx.virtualFiles.getVirtualFile(fileName); | ||
const snapshot = virtualFile?.snapshot ?? ctx.host.getScriptSnapshot(fileName); | ||
if (snapshot) { | ||
let version = fileVersions.get(fileName); | ||
if (!version) { | ||
version = { | ||
value: 0, | ||
versions: new WeakMap(), | ||
}; | ||
fileVersions.set(fileName, version); | ||
if (!fileVersions.has(fileName)) { | ||
fileVersions.set(fileName, { value: 0, snapshot }); | ||
} | ||
if (!version.versions.has(snapshot)) { | ||
version.versions.set(snapshot, version.value++); | ||
const version = fileVersions.get(fileName); | ||
if (version.snapshot !== snapshot) { | ||
version.value++; | ||
version.snapshot = snapshot; | ||
} | ||
return version.versions.get(snapshot).toString(); | ||
return version.value.toString(); | ||
} | ||
// root files / opened files | ||
const version = ctx.host.getScriptVersion(fileName); | ||
if (version !== undefined) { | ||
return version; | ||
} | ||
// fs files | ||
@@ -168,0 +160,0 @@ return sys.getModifiedTime?.(fileName)?.valueOf().toString() ?? ''; |
@@ -85,5 +85,5 @@ "use strict"; | ||
} | ||
return sys.resolvePath(fsPath); | ||
return sys.resolvePath(fsPath).replace(/\\/g, '/'); | ||
} | ||
return path_1.posix.resolve(fsPath); | ||
return path_1.posix.resolve(fsPath).replace(/\\/g, '/'); | ||
} | ||
@@ -248,3 +248,2 @@ function getModifiedTime(fileName) { | ||
file.modifiedTime = time !== file.modifiedTime ? time : time + 1; | ||
version++; | ||
} | ||
@@ -270,3 +269,5 @@ else { | ||
promises.delete(promise); | ||
onReadDirectoryResult(dir, result); | ||
if (onReadDirectoryResult(dir, result)) { | ||
version++; | ||
} | ||
}); | ||
@@ -279,2 +280,3 @@ } | ||
function onReadDirectoryResult(dir, result) { | ||
let updated = false; | ||
for (const [name, fileType] of result) { | ||
@@ -285,3 +287,3 @@ if (fileType === 1 || fileType === 64) { | ||
dir.files[name].exists = true; | ||
version++; | ||
updated = true; | ||
} | ||
@@ -293,6 +295,7 @@ } | ||
childDir.exists = true; | ||
version++; | ||
updated = true; | ||
} | ||
} | ||
} | ||
return updated; | ||
} | ||
@@ -303,3 +306,5 @@ function getDir(dirName) { | ||
let currentDirName = path_1.posix.basename(currentDirPath); | ||
while (currentDirName !== '') { | ||
let lastDirName; | ||
while (lastDirName !== currentDirName) { | ||
lastDirName = currentDirName; | ||
dirNames.push(currentDirName); | ||
@@ -306,0 +311,0 @@ currentDirPath = path_1.posix.dirname(currentDirPath); |
{ | ||
"name": "@volar/typescript", | ||
"version": "1.7.0", | ||
"version": "1.7.1-patch.1", | ||
"main": "out/index.js", | ||
@@ -16,8 +16,7 @@ "license": "MIT", | ||
"dependencies": { | ||
"@volar/language-core": "1.7.0" | ||
"@volar/language-core": "1.7.1" | ||
}, | ||
"devDependencies": { | ||
"@volar/language-service": "1.7.0" | ||
}, | ||
"gitHead": "38ec4f727b32dbf2cf3284ab02695e3a8effacc5" | ||
"@volar/language-service": "1.7.1" | ||
} | ||
} |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
114742
26
2713
2
2
+ Added@volar/language-core@1.7.1(transitive)
+ Added@volar/source-map@1.7.1(transitive)
- Removed@volar/language-core@1.7.0(transitive)
- Removed@volar/source-map@1.7.0(transitive)
Updated@volar/language-core@1.7.1