@volar/typescript
Advanced tools
Comparing version 1.7.0 to 1.7.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() ?? ''; |
@@ -247,3 +247,2 @@ "use strict"; | ||
file.modifiedTime = time !== file.modifiedTime ? time : time + 1; | ||
version++; | ||
} | ||
@@ -269,3 +268,5 @@ else { | ||
promises.delete(promise); | ||
onReadDirectoryResult(dir, result); | ||
if (onReadDirectoryResult(dir, result)) { | ||
version++; | ||
} | ||
}); | ||
@@ -278,2 +279,3 @@ } | ||
function onReadDirectoryResult(dir, result) { | ||
let updated = false; | ||
for (const [name, fileType] of result) { | ||
@@ -284,3 +286,3 @@ if (fileType === 1 || fileType === 64) { | ||
dir.files[name].exists = true; | ||
version++; | ||
updated = true; | ||
} | ||
@@ -292,6 +294,7 @@ } | ||
childDir.exists = true; | ||
version++; | ||
updated = true; | ||
} | ||
} | ||
} | ||
return updated; | ||
} | ||
@@ -298,0 +301,0 @@ function getDir(dirName) { |
{ | ||
"name": "@volar/typescript", | ||
"version": "1.7.0", | ||
"version": "1.7.1", | ||
"main": "out/index.js", | ||
@@ -16,8 +16,8 @@ "license": "MIT", | ||
"dependencies": { | ||
"@volar/language-core": "1.7.0" | ||
"@volar/language-core": "1.7.1" | ||
}, | ||
"devDependencies": { | ||
"@volar/language-service": "1.7.0" | ||
"@volar/language-service": "1.7.1" | ||
}, | ||
"gitHead": "38ec4f727b32dbf2cf3284ab02695e3a8effacc5" | ||
"gitHead": "6d092d684c65ce43af8a401bc90d0b2769a2bf49" | ||
} |
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
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
114674
26
2711
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