Skip to content

Commit 57c096c

Browse files
committed
2 parents 5b63e6f + f6ced48 commit 57c096c

File tree

1 file changed

+24
-38
lines changed

1 file changed

+24
-38
lines changed

YarnSpinner.Compiler/DiagnosticDescriptor.cs

Lines changed: 24 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -216,19 +216,6 @@ public string FormatMessage(params object[] args)
216216
description: "Code that will never be executed"
217217
);
218218

219-
/// <summary>
220-
/// YS0009: Node is never referenced.
221-
/// </summary>
222-
/// <remarks>
223-
/// <para>Format placeholders: 0: node title.</para>
224-
/// </remarks>
225-
public static readonly DiagnosticDescriptor UnusedNode = new DiagnosticDescriptor(
226-
code: "YS0009",
227-
messageTemplate: "Node '{0}' is never referenced",
228-
defaultSeverity: Diagnostic.DiagnosticSeverity.Info,
229-
description: "Node exists but is never jumped to"
230-
);
231-
232219
/// <summary>
233220
/// YS0010: Variable is declared but never used.
234221
/// </summary>
@@ -354,19 +341,19 @@ public string FormatMessage(params object[] args)
354341
/// </summary>
355342
public static readonly DiagnosticDescriptor LineContentAfterCommand = new DiagnosticDescriptor(
356343
code: "YS0019",
357-
messageTemplate: "Line content after '<<{0}>>' command. Commands should be on their own line.",
344+
messageTemplate: "Dialogue \"{0}\" content found following a command. Commands should be on their own line.",
358345
defaultSeverity: Diagnostic.DiagnosticSeverity.Warning,
359-
description: "Non-flow-control commands should be on their own line"
346+
description: "Commands must start on their own line and should not have dialogue following them, this is often indicative of a mistake."
360347
);
361348

362349
/// <summary>
363350
/// YS0020: Line content before a non-flow-control command.
364351
/// </summary>
365352
public static readonly DiagnosticDescriptor LineContentBeforeCommand = new DiagnosticDescriptor(
366353
code: "YS0020",
367-
messageTemplate: "Line content before '<<{0}>>' command. Commands should start on a new line.",
368-
defaultSeverity: Diagnostic.DiagnosticSeverity.Warning,
369-
description: "Non-flow-control commands should start on their own line"
354+
messageTemplate: "Command \"{0}\" found following a line of dialogue. Commands should start on a new line.",
355+
defaultSeverity: Diagnostic.DiagnosticSeverity.Error,
356+
description: "Commands must start on their own line, only line conditions are allowed to follow a line of dialogue."
370357
);
371358

372359
/// <summary>
@@ -375,7 +362,7 @@ public string FormatMessage(params object[] args)
375362
public static readonly DiagnosticDescriptor StrayCommandEnd = new DiagnosticDescriptor(
376363
code: "YS0021",
377364
messageTemplate: "Stray '>>' without matching '<<'. Did you forget to open the command?",
378-
defaultSeverity: Diagnostic.DiagnosticSeverity.Error,
365+
defaultSeverity: Diagnostic.DiagnosticSeverity.Warning,
379366
description: "Command end marker without corresponding start marker"
380367
);
381368

@@ -405,111 +392,111 @@ public string FormatMessage(params object[] args)
405392
#endregion
406393

407394
/// <summary>
408-
/// YSXXX1: Redeclaration of existing variable
395+
/// YS0039: Redeclaration of existing variable
409396
/// </summary>
410397
/// <remarks>
411398
/// <para>Format placeholders: 0: variable name.</para>
412399
/// </remarks>
413400
public static readonly DiagnosticDescriptor RedeclarationOfExistingVariable = new DiagnosticDescriptor(
414-
code: "YSXXX1",
401+
code: "YS0039",
415402
messageTemplate: "Redeclaration of existing variable {0}",
416403
defaultSeverity: Diagnostic.DiagnosticSeverity.Error,
417404
description: "Variables can only have a single declaration."
418405
);
419406

420407
/// <summary>
421-
/// YSXXX2: Redeclaration of existing type
408+
/// YS0040: Redeclaration of existing type
422409
/// </summary>
423410
/// <remarks>
424411
/// <para>Format placeholders: 0: type name.</para>
425412
/// </remarks>
426413
public static readonly DiagnosticDescriptor RedeclarationOfExistingType = new DiagnosticDescriptor(
427-
code: "YSXXX2",
414+
code: "YS0040",
428415
messageTemplate: "Redeclaration of existing type {0}",
429416
defaultSeverity: Diagnostic.DiagnosticSeverity.Error,
430417
description: "A type with this name already exists."
431418
);
432419

433420
/// <summary>
434-
/// YSXXX3: Internal error.
421+
/// YS0041: Internal error.
435422
/// </summary>
436423
/// <remarks>
437424
/// <para>Format placeholders: 0: error description.</para>
438425
/// </remarks>
439426
public static readonly DiagnosticDescriptor InternalError = new DiagnosticDescriptor(
440-
code: "YSXXX3",
427+
code: "YS0041",
441428
messageTemplate: "Internal compiler error: {0}",
442429
defaultSeverity: Diagnostic.DiagnosticSeverity.Error,
443430
description: "An internal error was detected by the compiler. Please file an issue."
444431
);
445432

446433
/// <summary>
447-
/// YSXXX4: Unknown line ID {0} for shadow line.
434+
/// YS0042: Unknown line ID {0} for shadow line.
448435
/// </summary>
449436
/// <remarks>
450437
/// <para>Format placeholders: 0: line ID.</para>
451438
/// </remarks>
452439
public static readonly DiagnosticDescriptor UnknownLineIDForShadowLine = new DiagnosticDescriptor(
453-
code: "YSXXX4",
440+
code: "YS0042",
454441
messageTemplate: "Unknown line ID {0} for shadow line",
455442
defaultSeverity: Diagnostic.DiagnosticSeverity.Error,
456443
description: "Shadow lines must map to existing line IDs."
457444
);
458445

459446
/// <summary>
460-
/// YSXXX5: Shadow lines must not have expressions
447+
/// YS0043: Shadow lines must not have expressions
461448
/// </summary>
462449
public static readonly DiagnosticDescriptor ShadowLinesCantHaveExpressions = new DiagnosticDescriptor(
463-
code: "YSXXX5",
450+
code: "YS0043",
464451
messageTemplate: "Shadow lines must not have expressions",
465452
defaultSeverity: Diagnostic.DiagnosticSeverity.Error,
466453
description: "Shadow lines must be text, and not contain any expressions."
467454
);
468455

469456
/// <summary>
470-
/// YSXXX6: Shadow lines must have the same text as their source
457+
/// YS0044: Shadow lines must have the same text as their source
471458
/// </summary>
472459
public static readonly DiagnosticDescriptor ShadowLinesMustHaveSameTextAsSource = new DiagnosticDescriptor(
473-
code: "YSXXX6",
460+
code: "YS0044",
474461
messageTemplate: "Shadow lines must have the same text as their source",
475462
defaultSeverity: Diagnostic.DiagnosticSeverity.Error,
476463
description: "Shadow lines are copies of their source lines, and must have the exact same text as their source line."
477464
);
478465

479466
/// <summary>
480-
/// YSXXX7: Smart variables cannot contain reference loops.
467+
/// YS0045: Smart variables cannot contain reference loops.
481468
/// </summary>
482469
/// <remarks>
483470
/// <para>Format placeholders: 0: variable reference, 1: smart variable name.</para>
484471
/// </remarks>
485472
public static readonly DiagnosticDescriptor SmartVariableLoop = new DiagnosticDescriptor(
486-
code: "YSXXX7",
473+
code: "YS0045",
487474
messageTemplate: "Smart variables cannot contain reference loops (referencing {0} here creates a loop for the smart variable {1}).",
488475
defaultSeverity: Diagnostic.DiagnosticSeverity.Error,
489476
description: "A smart variable's expression references itself through a chain of other smart variables."
490477
);
491478

492479
/// <summary>
493-
/// YSXXX8: Variable declaration has a null default value.
480+
/// YS0046: Variable declaration has a null default value.
494481
/// </summary>
495482
/// <remarks>
496483
/// <para>Format placeholders: 0: variable name, 1: type name.</para>
497484
/// </remarks>
498485
public static readonly DiagnosticDescriptor NullDefaultValue = new DiagnosticDescriptor(
499-
code: "YSXXX8",
486+
code: "YS0046",
500487
messageTemplate: "Variable declaration {0} (type {1}) has a null default value. This is not allowed.",
501488
defaultSeverity: Diagnostic.DiagnosticSeverity.Error,
502489
description: "A variable declaration must have a non-null default value."
503490
);
504491

505492
/// <summary>
506-
/// YSXXX9: Expression failed to resolve in a reasonable time.
493+
/// YS0047: Expression failed to resolve in a reasonable time.
507494
/// </summary>
508495
/// <remarks>
509496
/// <para>Format placeholders: 0: time limit in seconds.</para>
510497
/// </remarks>
511498
public static readonly DiagnosticDescriptor TypeSolverTimeout = new DiagnosticDescriptor(
512-
code: "YSXXX9",
499+
code: "YS0047",
513500
messageTemplate: "Expression failed to resolve in a reasonable time ({0}). Try simplifying this expression.",
514501
defaultSeverity: Diagnostic.DiagnosticSeverity.Error,
515502
description: "The type solver exceeded its time limit while resolving this expression."
@@ -670,7 +657,6 @@ public string FormatMessage(params object[] args)
670657
{ UnclosedCommand.Code, UnclosedCommand },
671658
{ UnclosedScope.Code, UnclosedScope },
672659
{ UnreachableCode.Code, UnreachableCode },
673-
{ UnusedNode.Code, UnusedNode },
674660
{ UnusedVariable.Code, UnusedVariable },
675661
{ DuplicateNodeTitle.Code, DuplicateNodeTitle },
676662
{ UndefinedNode.Code, UndefinedNode },

0 commit comments

Comments
 (0)