Skip to content

Commit a918671

Browse files
committed
Merge branch 'main' into version-lens
2 parents a859f83 + 0aafc62 commit a918671

14 files changed

Lines changed: 86 additions & 44 deletions

File tree

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"--skip-release-notes",
1313
"--skip-welcome",
1414
"--extensionDevelopmentPath=${workspaceFolder}/extensions/vscode",
15-
"${workspaceFolder}/playground"
15+
"${workspaceFolder}/playground/playground.code-workspace"
1616
],
1717
"outFiles": [
1818
"${workspaceFolder}/extensions/vscode/dist/**/*.js"

packages/language-core/src/workspace.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ export class WorkspaceContext {
9292
this.packageManager = await this.adapter.detectPackageManager(this.rootPath)
9393

9494
if (this.packageManager !== 'npm') {
95-
const workspaceFilename = workspaceFileMapping[this.packageManager]
96-
this.workspaceFilePath = `${this.rootPath}/${workspaceFilename}`
95+
this.workspaceFilePath = join(this.rootPath, workspaceFileMapping[this.packageManager])
9796
this.#catalogs.resolve(
9897
await this.adapter.fileExists(this.workspaceFilePath)
9998
? (await this.loadWorkspaceFileInfo(this.workspaceFilePath))?.catalogs

packages/language-server/src/workspace.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ function createLanguageServerAdapter(folderUri: URI, connection: Connection, ser
3737
}
3838
},
3939

40-
async detectPackageManager(): Promise<'npm' | 'pnpm' | 'yarn'> {
40+
async detectPackageManager(rootPath): Promise<'npm' | 'pnpm' | 'yarn'> {
4141
try {
4242
const result = await connection.sendRequest(getPackageManagerRequestType, {
43-
uri: folderUri.toString(),
43+
uri: rootPath,
4444
})
4545
return result || 'npm'
4646
} catch {
@@ -106,13 +106,14 @@ export class WorkspaceState implements IWorkspaceState {
106106
[URI]
107107
>(
108108
async (folderUri) => {
109-
this.#connection.console.info(`[workspace-context] built ${folderUri.path}`)
110-
this.#cachedFolderPaths.add(folderUri.path)
111-
112-
return await WorkspaceContext.create(
109+
const ctx = await WorkspaceContext.create(
113110
folderUri.path,
114111
createLanguageServerAdapter(folderUri, this.#connection, this.#server),
115112
)
113+
this.#cachedFolderPaths.add(folderUri.path)
114+
115+
this.#connection.console.info(`[workspace-context] built for ${folderUri}, packageManager: ${ctx.packageManager}`)
116+
return ctx
116117
},
117118
{
118119
name: 'workspace-context',

playground/index.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"npm.packageManager": "npm"
3+
}

playground/npm/package.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "@playground/npm-pkg",
3+
"version": "1.0.0",
4+
"private": true,
5+
"type": "module",
6+
"engines": {
7+
"node": ">16"
8+
},
9+
"dependencies": {
10+
"@prismicio/client": "~7.21.0-canary.147e3f2",
11+
"lodash": "^4.17.21",
12+
"axios": "^1.7.0"
13+
},
14+
"devDependencies": {
15+
"ofetch": "^1.4.0",
16+
"array-includes": "^3.1.8"
17+
}
18+
}

playground/package.json

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"folders": [
3+
{
4+
"path": "npm"
5+
},
6+
{
7+
"path": "pnpm"
8+
},
9+
{
10+
"path": "yarn"
11+
}
12+
]
13+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"npm.packageManager": "pnpm"
3+
}

playground/pnpm/package.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "@playground/pnpm-pkg",
3+
"version": "1.0.0",
4+
"private": true,
5+
"type": "module",
6+
"engines": {
7+
"node": ">16"
8+
},
9+
"dependencies": {
10+
"@prismicio/client": "~7.21.0-canary.147e3f2",
11+
"lodash": "catalog:",
12+
"axios": "^1.7.0"
13+
},
14+
"devDependencies": {
15+
"ofetch": "^1.4.0",
16+
"array-includes": "^3.1.8",
17+
"is-number": "catalog:dev"
18+
}
19+
}

0 commit comments

Comments
 (0)