Skip to content

Commit 5ec03c8

Browse files
committed
fix(extension): disable rename override to allow built in TS renaming (#1687)
This is a rollback of #1589 due to breaking rename scenarios in projects. #1683 (comment) Fixes #1685 (cherry picked from commit 7233c7d)
1 parent d1bd734 commit 5ec03c8

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

client/src/client.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,16 @@ export class AngularLanguageClient implements vscode.Disposable {
6363
prepareRename: async (
6464
document: vscode.TextDocument, position: vscode.Position,
6565
token: vscode.CancellationToken, next: lsp.PrepareRenameSignature) => {
66-
if (await this.isInAngularProject(document)) {
66+
// We are able to provide renames for many types of string literals: template strings,
67+
// pipe names, and hopefully in the future selectors and input/output aliases. Because
68+
// TypeScript isn't able to provide renames for these, we can more or less
69+
// guarantee that the Angular Language service will be called for the rename as the
70+
// fallback. We specifically do not provide renames outside of string literals
71+
// because we cannot ensure our extension is prioritized for renames in TS files (see
72+
// https://github.com/microsoft/vscode/issues/115354) we disable renaming completely so we
73+
// can provide consistent expectations.
74+
if (await this.isInAngularProject(document) &&
75+
isInsideStringLiteral(document, position)) {
6776
return next(document, position, token);
6877
}
6978
},

override_rename_ts_plugin/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
Note: This is currently disabled. See conversations in https://github.com/angular/vscode-ng-language-service/issues/1685 and https://github.com/angular/vscode-ng-language-service/issues/1683
2+
13
This package is applied to the built-in TS extension by the config [`typescriptServerPlugins`][1] and is used to disable rename provider of the built-in TS extension so VSCode asks the Angular Language Service for the answer instead.
24

35
Detail about this package is [here][2].

package.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,6 @@
180180
"path": "./syntaxes/expression.json",
181181
"scopeName": "expression.ng"
182182
}
183-
],
184-
"typescriptServerPlugins": [
185-
{
186-
"name": "@angular/override-rename-ts-plugin",
187-
"enableForWorkspaceTypeScriptVersions": true
188-
}
189183
]
190184
},
191185
"activationEvents": [
@@ -209,7 +203,6 @@
209203
"test:syntaxes": "yarn compile:syntaxes-test && yarn build:syntaxes && jasmine dist/syntaxes/test/driver.js"
210204
},
211205
"dependencies": {
212-
"@angular/override-rename-ts-plugin": "file:override_rename_ts_plugin",
213206
"@angular/language-service": "14.0.0",
214207
"typescript": "4.5.4",
215208
"vscode-jsonrpc": "6.0.0",

scripts/build.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ cp package.json angular.png CHANGELOG.md README.md dist/npm
5353
# Copy files to server directory
5454
cp -r server/package.json server/README.md server/bin dist/npm/server
5555
cp -r v12_language_service dist/npm/v12_language_service
56-
cp -r override_rename_ts_plugin dist/npm/override_rename_ts_plugin
5756
# Build and copy files to syntaxes directory
5857
yarn run build:syntaxes
5958
mkdir dist/npm/syntaxes

yarn.lock

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,6 @@
165165
resolved "https://registry.yarnpkg.com/@angular/language-service/-/language-service-14.0.0.tgz#749b52642fe0ba04f8475667d2eac0b3cf60d400"
166166
integrity sha512-05P+3IJ+pT9WQdUcXVM4NGY1a8V1bGKRVEE6BFFPYG+ElrM2aR7e0j997zAPIwPLWT1Z8/oC1wJ3MCBBTbECVQ==
167167

168-
"@angular/override-rename-ts-plugin@file:override_rename_ts_plugin":
169-
version "0.0.1"
170-
171168
"@assemblyscript/loader@^0.10.1":
172169
version "0.10.1"
173170
resolved "https://registry.yarnpkg.com/@assemblyscript/loader/-/loader-0.10.1.tgz#70e45678f06c72fa2e350e8553ec4a4d72b92e06"

0 commit comments

Comments
 (0)