Skip to content

Commit 3b6acbb

Browse files
committed
fix(typescript-plugin): change diagnostic category to Message for config file errors
1 parent 8cf9708 commit 3b6acbb

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

packages/typescript-plugin/index.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,9 @@ function decorateLanguageService(
157157
configFileBuildContext = await core.watchConfig(
158158
configFile,
159159
async (builtConfig, { errors, warnings }) => {
160-
configFileDiagnostics = [
161-
...errors.map(error => [error, ts.DiagnosticCategory.Error] as const),
162-
...warnings.map(error => [error, ts.DiagnosticCategory.Warning] as const),
163-
].map(([error, category]) => {
160+
configFileDiagnostics = [...errors, ...warnings].map(error => {
164161
const diag: typeof configFileDiagnostics[number] = {
165-
category,
162+
category: ts.DiagnosticCategory.Message,
166163
code: error.id as any,
167164
messageText: error.text,
168165
};
@@ -178,7 +175,7 @@ function decorateLanguageService(
178175
if (relatedFile) {
179176
diag.messageText = `Error building config file.`;
180177
diag.relatedInformation = [{
181-
category,
178+
category: ts.DiagnosticCategory.Message,
182179
code: error.id as any,
183180
messageText: error.text,
184181
file: relatedFile,
@@ -208,7 +205,7 @@ function decorateLanguageService(
208205
const relatedInfo = createRelatedInformation(ts, err, 0);
209206
if (relatedInfo) {
210207
configFileDiagnostics.push({
211-
category: ts.DiagnosticCategory.Error,
208+
category: ts.DiagnosticCategory.Message,
212209
code: 0,
213210
messageText: err.message,
214211
relatedInformation: [relatedInfo],
@@ -217,7 +214,7 @@ function decorateLanguageService(
217214
}
218215
if (prevLength === configFileDiagnostics.length) {
219216
configFileDiagnostics.push({
220-
category: ts.DiagnosticCategory.Error,
217+
category: ts.DiagnosticCategory.Message,
221218
code: 0,
222219
messageText: String(err),
223220
});
@@ -231,7 +228,7 @@ function decorateLanguageService(
231228
);
232229
} catch (err) {
233230
configFileDiagnostics.push({
234-
category: ts.DiagnosticCategory.Error,
231+
category: ts.DiagnosticCategory.Message,
235232
code: 'config-build-error' as any,
236233
messageText: String(err),
237234
});

0 commit comments

Comments
 (0)