From ca9537ecd9317982eed4d8f32e736843c831071b Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Thu, 26 Sep 2024 14:54:21 +0000 Subject: [PATCH] refactor: prepare for v19 refactorings Refactorings can create warnings too. This commit integrates this into the language service extension. --- .../npm_translate_lock_LTE4Nzc1MDcwNjU= | 6 +++--- package.json | 2 +- pnpm-lock.yaml | 11 +++++------ server/src/session.ts | 12 ++++++++---- yarn.lock | 8 ++++---- 5 files changed, 21 insertions(+), 18 deletions(-) diff --git a/.aspect/rules/external_repository_action_cache/npm_translate_lock_LTE4Nzc1MDcwNjU= b/.aspect/rules/external_repository_action_cache/npm_translate_lock_LTE4Nzc1MDcwNjU= index e3c0834a92..1aa392479d 100755 --- a/.aspect/rules/external_repository_action_cache/npm_translate_lock_LTE4Nzc1MDcwNjU= +++ b/.aspect/rules/external_repository_action_cache/npm_translate_lock_LTE4Nzc1MDcwNjU= @@ -2,7 +2,7 @@ # Input hashes for repository rule npm_translate_lock(name = "npm", pnpm_lock = "//:pnpm-lock.yaml"). # This file should be checked into version control along with the pnpm-lock.yaml file. .npmrc=974837034 -pnpm-lock.yaml=637567929 -yarn.lock=-433368679 -package.json=-91285837 +pnpm-lock.yaml=1954799938 +yarn.lock=-1787848221 +package.json=1299652465 pnpm-workspace.yaml=1711114604 diff --git a/package.json b/package.json index efe37d93a5..d3865cd7b8 100644 --- a/package.json +++ b/package.json @@ -245,7 +245,7 @@ "test:legacy-syntaxes": "yarn compile:syntaxes-test && yarn build:syntaxes && jasmine dist/syntaxes/test/driver.js" }, "dependencies": { - "@angular/language-service": "~19.0.0-next.6", + "@angular/language-service": "~19.0.0-next.8", "typescript": "5.6.1-rc", "vscode-html-languageservice": "^4.2.5", "vscode-jsonrpc": "6.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6bb8a80fe1..97d78009c5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: dependencies: '@angular/language-service': - specifier: ~19.0.0-next.6 - version: 19.0.0-next.6 + specifier: ~19.0.0-next.8 + version: 19.0.0-next.8 typescript: specifier: 5.6.1-rc version: 5.6.1-rc @@ -335,8 +335,8 @@ packages: tslib: 2.6.3 dev: true - /@angular/language-service@19.0.0-next.6: - resolution: {integrity: sha512-CGitv/BdTv8viFJiYTeJZKK3/HoG9dthNApNwi0GJFRL4wmOU4VVqmb+XBdLm8293KkpU65PpOjbpOkms89Yag==} + /@angular/language-service@19.0.0-next.8: + resolution: {integrity: sha512-AuCraKqmEZ0zQ6DOikIpbP48kpw2gjR1mXcZLdLayteqqBtlCTu+cG1t0dyZ0nm463QFJl7XkUl0/Nr74Juisg==} engines: {node: ^18.19.1 || ^20.11.1 || >=22.0.0} dev: false @@ -1724,7 +1724,7 @@ packages: /@bazel/typescript@5.5.0(typescript@4.7.4): resolution: {integrity: sha512-Ord0+nCj+B1M4NDbe0uqZf2FyOCzaDAlc4DAsr5UKJrArCipIbMTEAxlsEk+WAYBNAFGO/FS9/zlDtLceqpHqw==} - deprecated: No longer maintained, https://github.com/aspect-build/rules_ts is the recommended replacement + deprecated: This package is no longer maintained, see https://github.com/aspect-build/rules_ts for replacement hasBin: true requiresBuild: true peerDependencies: @@ -8531,7 +8531,6 @@ packages: /vsce@1.100.1: resolution: {integrity: sha512-1VjLyse5g6e2eQ6jUpslu7IDq44velwF8Jy8s7ePdwGNuG8EzfmaOfVyig3ZSMJ0l8DiJmZllx5bRAB4RMdnHg==} engines: {node: '>= 10'} - deprecated: vsce has been renamed to @vscode/vsce. Install using @vscode/vsce instead. hasBin: true dependencies: azure-devops-node-api: 11.2.0 diff --git a/server/src/session.ts b/server/src/session.ts index a517636140..a2cf170090 100644 --- a/server/src/session.ts +++ b/server/src/session.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {isNgLanguageService, NgLanguageService, PluginConfig} from '@angular/language-service/api'; +import {ApplyRefactoringResult, isNgLanguageService, NgLanguageService, PluginConfig} from '@angular/language-service/api'; import * as ts from 'typescript/lib/tsserverlibrary'; import {promisify} from 'util'; import {getLanguageService as getHTMLLanguageService} from 'vscode-html-languageservice'; @@ -277,7 +277,7 @@ export class Session { const progress = await this.connection.window.createWorkDoneProgress(); progress.begin('Refactoring', 0); - let edits: ts.RefactorEditInfo|undefined = undefined; + let edits: ApplyRefactoringResult|undefined = undefined; try { edits = await lsInfo.languageService.applyRefactoring( filePath, codeActionResolve.range, codeActionResolve.name, @@ -291,8 +291,12 @@ export class Session { progress.done(); } - if (edits?.notApplicableReason !== undefined) { - this.connection.window.showErrorMessage(edits.notApplicableReason); + + if (edits?.warningMessage !== undefined) { + this.connection.window.showWarningMessage(edits.warningMessage); + } + if (edits?.errorMessage !== undefined) { + this.connection.window.showErrorMessage(edits.errorMessage); } if (!edits) { return param; diff --git a/yarn.lock b/yarn.lock index cec58b17ae..4d5fc8b2ab 100644 --- a/yarn.lock +++ b/yarn.lock @@ -173,10 +173,10 @@ uuid "^8.3.2" yargs "^17.0.0" -"@angular/language-service@~19.0.0-next.6": - version "19.0.0-next.6" - resolved "https://registry.yarnpkg.com/@angular/language-service/-/language-service-19.0.0-next.6.tgz#ff029bfb89d39970d7bb20317191a83deb879601" - integrity sha512-CGitv/BdTv8viFJiYTeJZKK3/HoG9dthNApNwi0GJFRL4wmOU4VVqmb+XBdLm8293KkpU65PpOjbpOkms89Yag== +"@angular/language-service@~19.0.0-next.8": + version "19.0.0-next.8" + resolved "https://registry.yarnpkg.com/@angular/language-service/-/language-service-19.0.0-next.8.tgz#c733b255603dcc6bb257f29fd6a94776f256b5e7" + integrity sha512-AuCraKqmEZ0zQ6DOikIpbP48kpw2gjR1mXcZLdLayteqqBtlCTu+cG1t0dyZ0nm463QFJl7XkUl0/Nr74Juisg== "@assemblyscript/loader@^0.10.1": version "0.10.1"