@volar/language-server
Advanced tools
Comparing version 2.4.0-alpha.10 to 2.4.0-alpha.11
@@ -198,3 +198,3 @@ "use strict"; | ||
const serviceEnv = (0, simpleProject_1.createLanguageServiceEnvironment)(server, [workspaceFolder]); | ||
projectPromise = (0, typescriptProjectLs_1.createTypeScriptLS)(ts, tsLocalized, tsconfig, server, serviceEnv, workspaceFolder, { asUri: uriConverter.asUri, asFileName: uriConverter.asFileName }, create); | ||
projectPromise = (0, typescriptProjectLs_1.createTypeScriptLS)(ts, tsLocalized, tsconfig, server, serviceEnv, workspaceFolder, uriConverter, create); | ||
configProjects.set(tsconfigUri, projectPromise); | ||
@@ -209,3 +209,3 @@ } | ||
const serviceEnv = (0, simpleProject_1.createLanguageServiceEnvironment)(server, [workspaceFolder]); | ||
return (0, typescriptProjectLs_1.createTypeScriptLS)(ts, tsLocalized, inferOptions, server, serviceEnv, workspaceFolder, { asUri: uriConverter.asUri, asFileName: uriConverter.asFileName }, create); | ||
return (0, typescriptProjectLs_1.createTypeScriptLS)(ts, tsLocalized, inferOptions, server, serviceEnv, workspaceFolder, uriConverter, create); | ||
})()); | ||
@@ -212,0 +212,0 @@ } |
@@ -18,6 +18,8 @@ import { Language, LanguagePlugin, LanguageService, LanguageServiceEnvironment, ProjectContext, ProviderResult, UriMap } from '@volar/language-service'; | ||
sys: ReturnType<typeof createSys>; | ||
asUri(fileName: string): URI; | ||
asFileName(scriptId: URI): string; | ||
uriConverter: { | ||
asUri(fileName: string): URI; | ||
asFileName(uri: URI): string; | ||
}; | ||
} | ||
export declare function createTypeScriptLS(ts: typeof import('typescript'), tsLocalized: ts.MapLike<string> | undefined, tsconfig: string | ts.CompilerOptions, server: LanguageServer, serviceEnv: LanguageServiceEnvironment, workspaceFolder: URI, { asUri, asFileName }: { | ||
export declare function createTypeScriptLS(ts: typeof import('typescript'), tsLocalized: ts.MapLike<string> | undefined, tsconfig: string | ts.CompilerOptions, server: LanguageServer, serviceEnv: LanguageServiceEnvironment, workspaceFolder: URI, uriConverter: { | ||
asUri(fileName: string): URI; | ||
@@ -24,0 +26,0 @@ asFileName(uri: URI): string; |
@@ -10,10 +10,7 @@ "use strict"; | ||
const fsFileSnapshots = (0, language_service_1.createUriMap)(); | ||
async function createTypeScriptLS(ts, tsLocalized, tsconfig, server, serviceEnv, workspaceFolder, { asUri, asFileName }, create) { | ||
async function createTypeScriptLS(ts, tsLocalized, tsconfig, server, serviceEnv, workspaceFolder, uriConverter, create) { | ||
let parsedCommandLine; | ||
let projectVersion = 0; | ||
const getCurrentDirectory = () => asFileName(workspaceFolder); | ||
const sys = (0, typescript_1.createSys)(ts.sys, serviceEnv, getCurrentDirectory, { | ||
asFileName, | ||
asUri, | ||
}); | ||
const getCurrentDirectory = () => uriConverter.asFileName(workspaceFolder); | ||
const sys = (0, typescript_1.createSys)(ts.sys, serviceEnv, getCurrentDirectory, uriConverter); | ||
const projectHost = { | ||
@@ -28,3 +25,3 @@ getCurrentDirectory, | ||
getScriptSnapshot(fileName) { | ||
const uri = asUri(fileName); | ||
const uri = uriConverter.asUri(fileName); | ||
const documentKey = server.getSyncedDocumentKey(uri) ?? uri.toString(); | ||
@@ -50,4 +47,3 @@ const document = server.documents.get(documentKey); | ||
sys, | ||
asFileName, | ||
asUri, | ||
uriConverter, | ||
}); | ||
@@ -75,3 +71,3 @@ const askedFiles = (0, language_service_1.createUriMap)(); | ||
const cache = fsFileSnapshots.get(uri); | ||
const fileName = asFileName(uri); | ||
const fileName = uriConverter.asFileName(uri); | ||
const modifiedTime = sys.getModifiedTime?.(fileName)?.valueOf(); | ||
@@ -101,5 +97,4 @@ if (!cache || cache[0] !== modifiedTime) { | ||
sys, | ||
asUri, | ||
asFileName, | ||
...(0, typescript_1.createLanguageServiceHost)(ts, sys, language, asUri, projectHost), | ||
uriConverter, | ||
...(0, typescript_1.createLanguageServiceHost)(ts, sys, language, s => uriConverter.asUri(s), projectHost), | ||
}, | ||
@@ -130,3 +125,3 @@ }; | ||
const uri = vscode_uri_1.URI.parse(document.uri); | ||
const fileName = asFileName(uri); | ||
const fileName = uriConverter.asFileName(uri); | ||
if (fsFileSnapshots.has(uri) || sys.fileExists(fileName)) { | ||
@@ -138,3 +133,3 @@ const modifiedTime = sys.getModifiedTime?.(fileName); | ||
async function getRootFiles(languagePlugins) { | ||
parsedCommandLine = await createParsedCommandLine(ts, sys, asFileName(workspaceFolder), tsconfig, languagePlugins.map(plugin => plugin.typescript?.extraFileExtensions ?? []).flat()); | ||
parsedCommandLine = await createParsedCommandLine(ts, sys, uriConverter.asFileName(workspaceFolder), tsconfig, languagePlugins.map(plugin => plugin.typescript?.extraFileExtensions ?? []).flat()); | ||
return parsedCommandLine.fileNames; | ||
@@ -141,0 +136,0 @@ } |
@@ -40,4 +40,4 @@ "use strict"; | ||
if (tsProject?.configFileName) { | ||
const { configFileName, asUri } = tsProject; | ||
return { uri: asUri(configFileName).toString() }; | ||
const { configFileName, uriConverter } = tsProject; | ||
return { uri: uriConverter.asUri(configFileName).toString() }; | ||
} | ||
@@ -105,3 +105,3 @@ }); | ||
else { | ||
const uri = tsProject.asUri(fileName); | ||
const uri = tsProject.uriConverter.asUri(fileName); | ||
const sourceScript = languageService.context.language.scripts.get(uri); | ||
@@ -108,0 +108,0 @@ if (sourceScript?.generated) { |
{ | ||
"name": "@volar/language-server", | ||
"version": "2.4.0-alpha.10", | ||
"version": "2.4.0-alpha.11", | ||
"license": "MIT", | ||
@@ -15,6 +15,6 @@ "files": [ | ||
"dependencies": { | ||
"@volar/language-core": "2.4.0-alpha.10", | ||
"@volar/language-service": "2.4.0-alpha.10", | ||
"@volar/snapshot-document": "2.4.0-alpha.10", | ||
"@volar/typescript": "2.4.0-alpha.10", | ||
"@volar/language-core": "2.4.0-alpha.11", | ||
"@volar/language-service": "2.4.0-alpha.11", | ||
"@volar/snapshot-document": "2.4.0-alpha.11", | ||
"@volar/typescript": "2.4.0-alpha.11", | ||
"path-browserify": "^1.0.1", | ||
@@ -30,3 +30,3 @@ "request-light": "^0.7.0", | ||
}, | ||
"gitHead": "9f0cb9f2e41167baeb503e8f0eca88e9bea06269" | ||
"gitHead": "f4520e175d25305fc930982a8188da94104625a6" | ||
} |
115794
2427
+ Added@volar/language-core@2.4.0-alpha.11(transitive)
+ Added@volar/language-service@2.4.0-alpha.11(transitive)
+ Added@volar/snapshot-document@2.4.0-alpha.11(transitive)
+ Added@volar/source-map@2.4.0-alpha.11(transitive)
+ Added@volar/typescript@2.4.0-alpha.11(transitive)
- Removed@volar/language-core@2.4.0-alpha.10(transitive)
- Removed@volar/language-service@2.4.0-alpha.10(transitive)
- Removed@volar/snapshot-document@2.4.0-alpha.10(transitive)
- Removed@volar/source-map@2.4.0-alpha.10(transitive)
- Removed@volar/typescript@2.4.0-alpha.10(transitive)