diff --git a/ngp-vscode-ng-language-service/client/src/extension.ts b/ngp-vscode-ng-language-service/client/src/extension.ts index 05b20569142..c0500bfe20f 100644 --- a/ngp-vscode-ng-language-service/client/src/extension.ts +++ b/ngp-vscode-ng-language-service/client/src/extension.ts @@ -93,8 +93,12 @@ export async function activate(context: vscode.ExtensionContext) { function launchTs7Client(tsGoPath: string, context: vscode.ExtensionContext) { const isNative = + tsGoPath.includes(`typescript-${process.platform}-${process.arch}`) || tsGoPath.includes(`native-preview-${process.platform}-${process.arch}`) || + tsGoPath.endsWith('/lib/tsc') || + tsGoPath.endsWith('/tsc.exe') || tsGoPath.endsWith('/tsgo.exe') || + tsGoPath.endsWith('/built/local/tsc') || tsGoPath.endsWith('/built/local/tsgo'); const ts7ServerOptions: ServerOptions = isNative ? { @@ -210,9 +214,14 @@ async function resolveTsGoPath(): Promise { const workspaceRoot = path.resolve(__dirname, '../../..'); - const platformName = `@typescript/native-preview-${process.platform}-${process.arch}`; + const ext = process.platform === 'win32' ? '.exe' : ''; + const tsPlatformName = `@typescript/typescript-${process.platform}-${process.arch}`; + const previewPlatformName = `@typescript/native-preview-${process.platform}-${process.arch}`; const localCandidates = [ - path.join(workspaceRoot, 'node_modules', platformName, 'lib', 'tsgo'), + path.join(workspaceRoot, 'node_modules', tsPlatformName, 'lib', `tsc${ext}`), + path.join(workspaceRoot, 'node_modules', '@typescript', 'native-preview', 'lib', 'tsc.js'), + path.join(workspaceRoot, 'node_modules', '@typescript', 'native-preview', 'bin', 'tsc'), + path.join(workspaceRoot, 'node_modules', previewPlatformName, 'lib', `tsgo${ext}`), path.join(workspaceRoot, 'node_modules', '@typescript', 'native-preview', 'bin', 'tsgo'), path.join(workspaceRoot, 'node_modules', '@typescript', 'native-preview', 'bin', 'tsgo.js'), ]; @@ -229,6 +238,12 @@ async function resolveTsGoPath(): Promise { if (tsGoExtension) { const extensionPath = tsGoExtension.extensionPath; const candidates = [ + path.join(extensionPath, 'lib', 'tsc'), + path.join(extensionPath, 'lib', 'tsc.exe'), + path.join(extensionPath, 'bin', 'tsc'), + path.join(extensionPath, 'bin', 'tsc.exe'), + path.join(extensionPath, 'tsc'), + path.join(extensionPath, 'tsc.exe'), path.join(extensionPath, 'bin', 'tsgo'), path.join(extensionPath, 'bin', 'tsgo.exe'), path.join(extensionPath, 'lib', 'tsgo'), diff --git a/ngp-vscode-ng-language-service/package.json b/ngp-vscode-ng-language-service/package.json index af8a818e673..01b04217fae 100644 --- a/ngp-vscode-ng-language-service/package.json +++ b/ngp-vscode-ng-language-service/package.json @@ -152,7 +152,7 @@ "watch": "pnpm --prefix client run watch & pnpm --prefix server run watch" }, "dependencies": { - "@typescript/native-preview": "7.0.0-dev.20260707.2", + "@typescript/native-preview": "npm:typescript@7.1.0-dev.20261109.1", "vscode-languageclient": "^10.1.0", "vscode-languageserver": "^10.1.0", "vscode-languageserver-textdocument": "^1.0.12", diff --git a/ngp-vscode-ng-language-service/server/package.json b/ngp-vscode-ng-language-service/server/package.json index baf47294f27..a21790c99c8 100644 --- a/ngp-vscode-ng-language-service/server/package.json +++ b/ngp-vscode-ng-language-service/server/package.json @@ -4,7 +4,7 @@ "private": true, "main": "out/server.js", "dependencies": { - "@typescript/native-preview": "7.0.0-dev.20260707.2", + "@typescript/native-preview": "npm:typescript@7.1.0-dev.20261109.1", "vscode-languageserver": "^10.1.0", "vscode-languageserver-textdocument": "^1.0.12", "vscode-uri": "^3.1.0" diff --git a/ngp-vscode-ng-language-service/server/src/project_manager.ts b/ngp-vscode-ng-language-service/server/src/project_manager.ts index 29cd5358640..ad51df9fbfc 100644 --- a/ngp-vscode-ng-language-service/server/src/project_manager.ts +++ b/ngp-vscode-ng-language-service/server/src/project_manager.ts @@ -8,7 +8,7 @@ import * as fs from 'node:fs/promises'; import {readConfiguration} from '@angular/compiler-cli'; -import {API, Snapshot} from '@typescript/native-preview/unstable/async'; +import {API, Snapshot} from '@typescript/native-preview/async'; import {HybridCompiler} from '../../../packages/compiler-cli/preprocessor/src/hybrid_compiler.js'; import {NapiAnalyzer} from '../../../packages/compiler-cli/preprocessor/src/analyzer_napi.js'; import {buildTypeCheckingConfig} from '../../../packages/compiler-cli/preprocessor/src/tcb'; @@ -29,7 +29,7 @@ export interface ProjectInstance { export interface ProjectManagerOptions { facade: TsGoFacade; - api?: API; + api?: API; nodeModulesPathOverride?: string; onLog?: (msg: string) => void; onError?: (msg: string) => void; @@ -39,7 +39,7 @@ export class ProjectManager { private projects = new Map(); private pendingProjects = new Map>(); private facade: TsGoFacade; - private api?: API; + private api?: API; private currentSnapshot?: Snapshot; private nodeModulesPathOverride?: string; /** @@ -59,7 +59,7 @@ export class ProjectManager { this.err = options.onError ?? (() => {}); } - setApi(api: API): void { + setApi(api: API): void { this.api = api; this.currentSnapshot = undefined; } @@ -228,7 +228,7 @@ export class ProjectManager { } } - this.currentSnapshot = await this.api.updateSnapshot(); + this.currentSnapshot = await this.api.getCurrentLanguageServerSnapshot(); const defaultProject = await this.currentSnapshot.getDefaultProjectForFile(targetPath); if (defaultProject?.configFileName && (await pathExists(defaultProject.configFileName))) { return await normalizePath(defaultProject.configFileName); diff --git a/ngp-vscode-ng-language-service/server/src/server.ts b/ngp-vscode-ng-language-service/server/src/server.ts index 16d88d05a55..ccd96c3a29d 100644 --- a/ngp-vscode-ng-language-service/server/src/server.ts +++ b/ngp-vscode-ng-language-service/server/src/server.ts @@ -36,7 +36,7 @@ import {HandlerContext} from './handlers/utils'; import * as fs from 'node:fs/promises'; import * as rpc from 'vscode-jsonrpc/node'; -import {API} from '@typescript/native-preview/unstable/async'; +import {API} from '@typescript/native-preview/async'; import {TsGoFacade} from '../../../packages/compiler-cli/preprocessor/language-service/src/facade'; import {fileURLToPath} from 'node:url'; import {getTcbPath} from '../../../packages/compiler-cli/preprocessor/language-service/src/tcb_ls_util.js'; @@ -141,7 +141,7 @@ connection.onDidChangeWatchedFiles((params: DidChangeWatchedFilesParams) => { connection.onInitialize(async (params: InitializeParams) => { connection.console.log(`Initializing Angular Hybrid Language Server`); - let api: API | undefined; + let api: API | undefined; if (params.initializationOptions?.tsApiPipe) { try { api = await API.fromLSPConnection({pipe: params.initializationOptions.tsApiPipe}); diff --git a/packages/compiler-cli/preprocessor/language-service/package.json b/packages/compiler-cli/preprocessor/language-service/package.json index 8073caf2668..874722f75e6 100644 --- a/packages/compiler-cli/preprocessor/language-service/package.json +++ b/packages/compiler-cli/preprocessor/language-service/package.json @@ -3,7 +3,7 @@ "version": "0.0.1", "private": true, "dependencies": { - "@typescript/native-preview": "7.0.0-dev.20260707.2", + "@typescript/native-preview": "npm:typescript@7.1.0-dev.20261109.1", "vscode-jsonrpc": "^9.0.1", "vscode-languageserver": "^10.1.0", "vscode-languageserver-textdocument": "^1.0.12", diff --git a/packages/compiler-cli/preprocessor/language-service/tests/test_helpers.ts b/packages/compiler-cli/preprocessor/language-service/tests/test_helpers.ts index 21230c06f38..fca94b362be 100644 --- a/packages/compiler-cli/preprocessor/language-service/tests/test_helpers.ts +++ b/packages/compiler-cli/preprocessor/language-service/tests/test_helpers.ts @@ -146,26 +146,34 @@ export async function resolveTsGoPath(): Promise { return process.env['TSGO_BINARY_PATH']; } + const ext = process.platform === 'win32' ? '.exe' : ''; try { const req = createRequire(import.meta.url); const previewPkg = req.resolve('@typescript/native-preview/package.json'); const previewReq = createRequire(previewPkg); - const platformPkgName = `@typescript/native-preview-${process.platform}-${process.arch}`; - const platPkg = previewReq.resolve(`${platformPkgName}/package.json`); - const exe = path.join( - path.dirname(platPkg), - 'lib', - `tsgo${process.platform === 'win32' ? '.exe' : ''}`, - ); - if (await pathExists(exe)) { - return exe; + const platformTargets = [ + {pkg: `@typescript/typescript-${process.platform}-${process.arch}`, bin: `tsc${ext}`}, + {pkg: `@typescript/native-preview-${process.platform}-${process.arch}`, bin: `tsgo${ext}`}, + ]; + for (const target of platformTargets) { + try { + const platPkg = previewReq.resolve(`${target.pkg}/package.json`); + const exe = path.join(path.dirname(platPkg), 'lib', target.bin); + if (await pathExists(exe)) { + return exe; + } + } catch {} } } catch {} const workspaceRoot = path.resolve(TESTS_DIR, '../..'); - const platformName = `@typescript/native-preview-${process.platform}-${process.arch}`; + const tsPlatformName = `@typescript/typescript-${process.platform}-${process.arch}`; + const previewPlatformName = `@typescript/native-preview-${process.platform}-${process.arch}`; const localCandidates = [ - path.join(workspaceRoot, 'node_modules', platformName, 'lib', 'tsgo'), + path.join(workspaceRoot, 'node_modules', tsPlatformName, 'lib', `tsc${ext}`), + path.join(workspaceRoot, 'node_modules', '@typescript', 'native-preview', 'lib', 'tsc.js'), + path.join(workspaceRoot, 'node_modules', '@typescript', 'native-preview', 'bin', 'tsc'), + path.join(workspaceRoot, 'node_modules', previewPlatformName, 'lib', `tsgo${ext}`), path.join(workspaceRoot, 'node_modules', '@typescript', 'native-preview', 'bin', 'tsgo.js'), path.join(workspaceRoot, 'node_modules', '@typescript', 'native-preview', 'bin', 'tsgo'), ]; @@ -176,12 +184,15 @@ export async function resolveTsGoPath(): Promise { } } - throw new Error('Could not find tsgo binary.'); + throw new Error('Could not find TypeScript 7 (tsc/tsgo) binary.'); } export async function startTsgo(workspacePath: string) { const binaryPath = await resolveTsGoPath(); - const isJs = binaryPath.endsWith('.js'); + const isJs = + binaryPath.endsWith('.js') || + binaryPath.endsWith(`${path.sep}bin${path.sep}tsc`) || + binaryPath.endsWith(`${path.sep}bin${path.sep}tsgo`); const cmd = isJs ? process.execPath : binaryPath; const args = isJs ? [binaryPath, '--lsp', '--stdio'] : ['--lsp', '--stdio']; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e148e4acce2..183aedcec57 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1060,8 +1060,8 @@ importers: ngp-vscode-ng-language-service: dependencies: '@typescript/native-preview': - specifier: 7.0.0-dev.20260707.2 - version: 7.0.0-dev.20260707.2 + specifier: npm:typescript@7.1.0-dev.20261109.1 + version: typescript@7.1.0-dev.20261109.1 vscode-jsonrpc: specifier: ^9.0.1 version: 9.0.3 @@ -1116,8 +1116,8 @@ importers: ngp-vscode-ng-language-service/server: dependencies: '@typescript/native-preview': - specifier: 7.0.0-dev.20260707.2 - version: 7.0.0-dev.20260707.2 + specifier: npm:typescript@7.1.0-dev.20261109.1 + version: typescript@7.1.0-dev.20261109.1 vscode-languageserver: specifier: ^10.1.0 version: 10.1.2 @@ -1220,8 +1220,8 @@ importers: packages/compiler-cli/preprocessor/language-service: dependencies: '@typescript/native-preview': - specifier: 7.0.0-dev.20260707.2 - version: 7.0.0-dev.20260707.2 + specifier: npm:typescript@7.1.0-dev.20261109.1 + version: typescript@7.1.0-dev.20261109.1 vscode-jsonrpc: specifier: ^9.0.1 version: 9.0.3 @@ -4985,53 +4985,48 @@ packages: '@types/yarnpkg__lockfile@1.1.9': resolution: {integrity: sha512-GD4Fk15UoP5NLCNor51YdfL9MSdldKCqOC9EssrRw3HVfar9wUZ5y8Lfnp+qVD6hIinLr8ygklDYnmlnlQo12Q==} - '@typescript/native-preview-darwin-arm64@7.0.0-dev.20260707.2': - resolution: {integrity: sha512-wny2pgKjGbiZtnOIHVa3tXC1UfDqxNEFzyPGmiqybedG8hipG2Nfp0l5UxbaKCjkLacUpH/W5bP2hBOMVhCOzg==} + '@typescript/typescript-darwin-arm64@7.1.0-dev.20261109.1': + resolution: {integrity: sha512-k5X3MB7j6U7c1Xs+rSscULDKX+KQzEzJny+mTN92vWgWE8ampF8RRS6uT2BbzlugySYif6FAQbpT7XoLUSKuLg==} engines: {node: '>=16.20.0'} cpu: [arm64] os: [darwin] - '@typescript/native-preview-darwin-x64@7.0.0-dev.20260707.2': - resolution: {integrity: sha512-Afc7M5zOwo+GpfcYwz5Z8HMB2tPVsui7nNIqEuuFB73MPdVqNn/Wmpe4tP4MRri0AtJnJknoHBaTJ/VDAp/Jhw==} + '@typescript/typescript-darwin-x64@7.1.0-dev.20261109.1': + resolution: {integrity: sha512-8NvwXDDZHunOkNNw96hoQ0ev2LIVSsZdGTUI9W5S5HD6Iwvm4aSqs9V4w1zCtNqCwtZaEiOjURip6PVMLRsF6A==} engines: {node: '>=16.20.0'} cpu: [x64] os: [darwin] - '@typescript/native-preview-linux-arm64@7.0.0-dev.20260707.2': - resolution: {integrity: sha512-iITBa2WjjTI5N9t5l7Z4KoOSI+2zBlhbvFzsD/f8qX8QoKjz/Y4DPyBDgezYi8nkqjjksbgSOJ3/ykzhwrB9cg==} + '@typescript/typescript-linux-arm64@7.1.0-dev.20261109.1': + resolution: {integrity: sha512-UVHu4IKa2xc8ggnJdzFwrJCAMj8bcNKG2Ygp69fAuqLWQaORu2PbGsyuBMn0OgNMr00P8FKRL2eRSceTb4HAKw==} engines: {node: '>=16.20.0'} cpu: [arm64] os: [linux] - '@typescript/native-preview-linux-arm@7.0.0-dev.20260707.2': - resolution: {integrity: sha512-hJm/UOqZTr9FHmR7uNm8VGX4oKtfWk0Jem0zPeJFNC8ckGUfSBueyiEYMZB+XmRc1aG4x1E46y3CplP4CLHvGQ==} + '@typescript/typescript-linux-arm@7.1.0-dev.20261109.1': + resolution: {integrity: sha512-NLakeoS9l5pSHrfTIAipq3hrUGRCxfBaGC7kMvgwuwvgGT8jmlLmfCdR+koxlnVIQxlJZXQOIWXKJ/EP4PeaFw==} engines: {node: '>=16.20.0'} cpu: [arm] os: [linux] - '@typescript/native-preview-linux-x64@7.0.0-dev.20260707.2': - resolution: {integrity: sha512-du0dzi6y97Po5vDNdPJTyyijHCpaS22JLRnKZEJXBDaO9gCIymOv/5QQokFRuOlQm0bWl3i9PF4OVdGP6uAOQA==} + '@typescript/typescript-linux-x64@7.1.0-dev.20261109.1': + resolution: {integrity: sha512-ds2dWbkP603iCvpW3vLuurYJFCKRZBc/swX4w6GYV1irzZrgCZOSfnhifQIQNDZmWAJTmOyXdSP3zoIpHsSK0g==} engines: {node: '>=16.20.0'} cpu: [x64] os: [linux] - '@typescript/native-preview-win32-arm64@7.0.0-dev.20260707.2': - resolution: {integrity: sha512-SsAwfhyHJ1akgBc+99z4+hwdbHsdWaKB8EwCNIMA6JfSLMeUjffrYvxu+vfMyxVtOVOz7RrRXRoiDiu4a2sCtg==} + '@typescript/typescript-win32-arm64@7.1.0-dev.20261109.1': + resolution: {integrity: sha512-QlGuYPxAySkNsOWyriI0HficVfAvY53vaCKsvGOBmXnzqB6Cf+vfABRikRJdOHKQ3Fo92U0lg2TtUcB5INiG4g==} engines: {node: '>=16.20.0'} cpu: [arm64] os: [win32] - '@typescript/native-preview-win32-x64@7.0.0-dev.20260707.2': - resolution: {integrity: sha512-DL4u27stv0fo71sVhOzHSwE+YMZsbBijVI+kg5dLDLilSH79WFTJ8RSQ46vJrCMt+Gjlv/JOZP1PuLJDfioYeQ==} + '@typescript/typescript-win32-x64@7.1.0-dev.20261109.1': + resolution: {integrity: sha512-DwVTepbRmBpsPPzEqGn3GBVwtL81M0fIL6RiUSjYRduHWSBNOyErjccMHvXrpeSotlQ3Ik5yYq2R9hVt6HmhGw==} engines: {node: '>=16.20.0'} cpu: [x64] os: [win32] - '@typescript/native-preview@7.0.0-dev.20260707.2': - resolution: {integrity: sha512-oUGp+Rep/hqMhPunyinsALUwSlzHINSxitifPiSaeqoKOKD2OlR9NE3TaPqwsl4NlGslsOSUXI1JotWQzpYCPg==} - engines: {node: '>=16.20.0'} - hasBin: true - '@typescript/vfs@1.6.6': resolution: {integrity: sha512-gXw0+tpchiQUjTcbnNIPnyLFIhbwJ7M1VaxLQ1vXhjQxtTBK3sdDLY1ih0jxCu1I5K3V0dDxq8CkVZtIMspC3A==} peerDependencies: @@ -10909,6 +10904,11 @@ packages: engines: {node: '>=14.17'} hasBin: true + typescript@7.1.0-dev.20261109.1: + resolution: {integrity: sha512-gWvPmRpUJ1SzahmGN6138gT0aLLK4bMUCC8MoTKJtVdRIJc65f/UuvpZpHGctvD0y/Nu3w3b5gLY9e/7+GSeJw==} + engines: {node: '>=16.20.0'} + hasBin: true + ua-parser-js@0.7.41: resolution: {integrity: sha512-O3oYyCMPYgNNHuO7Jjk3uacJWZF8loBgwrfd/5LE/HyZ3lUIOdniQ7DNXJcIgZbwioZxk0fLfI4EVnetdiX5jg==} hasBin: true @@ -15436,37 +15436,27 @@ snapshots: '@types/yarnpkg__lockfile@1.1.9': {} - '@typescript/native-preview-darwin-arm64@7.0.0-dev.20260707.2': + '@typescript/typescript-darwin-arm64@7.1.0-dev.20261109.1': optional: true - '@typescript/native-preview-darwin-x64@7.0.0-dev.20260707.2': + '@typescript/typescript-darwin-x64@7.1.0-dev.20261109.1': optional: true - '@typescript/native-preview-linux-arm64@7.0.0-dev.20260707.2': + '@typescript/typescript-linux-arm64@7.1.0-dev.20261109.1': optional: true - '@typescript/native-preview-linux-arm@7.0.0-dev.20260707.2': + '@typescript/typescript-linux-arm@7.1.0-dev.20261109.1': optional: true - '@typescript/native-preview-linux-x64@7.0.0-dev.20260707.2': + '@typescript/typescript-linux-x64@7.1.0-dev.20261109.1': optional: true - '@typescript/native-preview-win32-arm64@7.0.0-dev.20260707.2': + '@typescript/typescript-win32-arm64@7.1.0-dev.20261109.1': optional: true - '@typescript/native-preview-win32-x64@7.0.0-dev.20260707.2': + '@typescript/typescript-win32-x64@7.1.0-dev.20261109.1': optional: true - '@typescript/native-preview@7.0.0-dev.20260707.2': - optionalDependencies: - '@typescript/native-preview-darwin-arm64': 7.0.0-dev.20260707.2 - '@typescript/native-preview-darwin-x64': 7.0.0-dev.20260707.2 - '@typescript/native-preview-linux-arm': 7.0.0-dev.20260707.2 - '@typescript/native-preview-linux-arm64': 7.0.0-dev.20260707.2 - '@typescript/native-preview-linux-x64': 7.0.0-dev.20260707.2 - '@typescript/native-preview-win32-arm64': 7.0.0-dev.20260707.2 - '@typescript/native-preview-win32-x64': 7.0.0-dev.20260707.2 - '@typescript/vfs@1.6.6(supports-color@11.0.0)(typescript@6.0.3)': dependencies: debug: 4.4.3(supports-color@11.0.0) @@ -22353,6 +22343,16 @@ snapshots: typescript@6.0.3: {} + typescript@7.1.0-dev.20261109.1: + optionalDependencies: + '@typescript/typescript-darwin-arm64': 7.1.0-dev.20261109.1 + '@typescript/typescript-darwin-x64': 7.1.0-dev.20261109.1 + '@typescript/typescript-linux-arm': 7.1.0-dev.20261109.1 + '@typescript/typescript-linux-arm64': 7.1.0-dev.20261109.1 + '@typescript/typescript-linux-x64': 7.1.0-dev.20261109.1 + '@typescript/typescript-win32-arm64': 7.1.0-dev.20261109.1 + '@typescript/typescript-win32-x64': 7.1.0-dev.20261109.1 + ua-parser-js@0.7.41: {} uglify-js@3.19.3: