Skip to content

Commit ed84dc6

Browse files
committed
feat(language-service): Allow specific diagnostics to be suppressed
Allow the language service plugin to pass diagnostic codes that should be ignored via the PluginConfig. This change corresponds to PR angular/angular#57675. Fixes #1243
1 parent 9d27669 commit ed84dc6

File tree

9 files changed

+7008
-4540
lines changed

9 files changed

+7008
-4540
lines changed

.aspect/rules/external_repository_action_cache/npm_translate_lock_LTE4Nzc1MDcwNjU=

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Input hashes for repository rule npm_translate_lock(name = "npm", pnpm_lock = "//:pnpm-lock.yaml").
33
# This file should be checked into version control along with the pnpm-lock.yaml file.
44
.npmrc=974837034
5-
pnpm-lock.yaml=1398347878
6-
yarn.lock=-1005893296
7-
package.json=-657448584
5+
pnpm-lock.yaml=537629532
6+
yarn.lock=-619082575
7+
package.json=-545488057
88
pnpm-workspace.yaml=1711114604

client/src/client.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,12 @@ export class AngularLanguageClient implements vscode.Disposable {
355355
args.push('--forceStrictTemplates');
356356
}
357357

358+
const suppressAngularDiagnosticCodes =
359+
config.get<string>('angular.suppressAngularDiagnosticCodes');
360+
if (suppressAngularDiagnosticCodes) {
361+
args.push('--suppressAngularDiagnosticCodes', suppressAngularDiagnosticCodes);
362+
}
363+
358364
const tsdk = config.get('typescript.tsdk', '');
359365
if (tsdk.trim().length > 0) {
360366
args.push('--tsdk', tsdk);

package.json

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@
135135
"type": "boolean",
136136
"default": false,
137137
"markdownDescription": "Enabling this option will force the language service to use [strictTemplates](https://angular.io/guide/angular-compiler-options#stricttemplates) and ignore the user settings in the `tsconfig.json`."
138+
},
139+
"angular.suppressAngularDiagnosticCodes": {
140+
"type": "string",
141+
"default": "",
142+
"markdownDescription": "A comma-separated list of error codes in templates whose diagnostics should be ignored."
138143
}
139144
}
140145
},
@@ -164,7 +169,10 @@
164169
{
165170
"path": "./syntaxes/template.json",
166171
"scopeName": "template.ng",
167-
"injectTo": ["text.html.derivative", "source.ts"],
172+
"injectTo": [
173+
"text.html.derivative",
174+
"source.ts"
175+
],
168176
"embeddedLanguages": {
169177
"text.html": "html",
170178
"source.css": "css",
@@ -174,7 +182,10 @@
174182
{
175183
"path": "./syntaxes/template-blocks.json",
176184
"scopeName": "template.blocks.ng",
177-
"injectTo": ["text.html.derivative", "source.ts"],
185+
"injectTo": [
186+
"text.html.derivative",
187+
"source.ts"
188+
],
178189
"embeddedLanguages": {
179190
"text.html": "html",
180191
"control.block.expression.ng": "javascript",
@@ -184,7 +195,10 @@
184195
{
185196
"path": "./syntaxes/let-declaration.json",
186197
"scopeName": "template.let.ng",
187-
"injectTo": ["text.html.derivative", "source.ts"]
198+
"injectTo": [
199+
"text.html.derivative",
200+
"source.ts"
201+
]
188202
},
189203
{
190204
"path": "./syntaxes/template-tag.json",
@@ -231,7 +245,7 @@
231245
"test:legacy-syntaxes": "yarn compile:syntaxes-test && yarn build:syntaxes && jasmine dist/syntaxes/test/driver.js"
232246
},
233247
"dependencies": {
234-
"@angular/language-service": "~19.0.0-next.3",
248+
"@angular/language-service": "~19.0.0-next.4",
235249
"typescript": "5.6.1-rc",
236250
"vscode-html-languageservice": "^4.2.5",
237251
"vscode-jsonrpc": "6.0.0",

0 commit comments

Comments
 (0)