Skip to content

Commit

Permalink
refactor: prepare for v19 refactorings
Browse files Browse the repository at this point in the history
Refactorings can create warnings too. This commit integrates this into
the language service extension.
  • Loading branch information
devversion committed Oct 2, 2024
1 parent 1e4c92c commit ca9537e
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 5 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions server/src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand All @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit ca9537e

Please sign in to comment.