DiagnosticDescriptors.cs 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using Microsoft.CodeAnalysis;
  2. namespace Lua.SourceGenerator;
  3. public static class DiagnosticDescriptors
  4. {
  5. const string Category = "Lua";
  6. public static readonly DiagnosticDescriptor MustBePartial = new(
  7. id: "LUACS001",
  8. title: "LuaObject type must be partial.",
  9. category: Category,
  10. messageFormat: "LuaObject type '{0}' must be partial",
  11. defaultSeverity: DiagnosticSeverity.Error,
  12. isEnabledByDefault: true);
  13. public static readonly DiagnosticDescriptor NestedNotAllowed = new(
  14. id: "LUACS002",
  15. title: "LuaObject type must not be nested",
  16. messageFormat: "LuaObject type '{0}' must be not nested",
  17. category: Category,
  18. defaultSeverity: DiagnosticSeverity.Error,
  19. isEnabledByDefault: true);
  20. public static readonly DiagnosticDescriptor AbstractNotAllowed = new(
  21. id: "LUACS003",
  22. title: "LuaObject type must not abstract",
  23. messageFormat: "LuaObject object '{0}' must be not abstract",
  24. category: Category,
  25. defaultSeverity: DiagnosticSeverity.Error,
  26. isEnabledByDefault: true);
  27. public static readonly DiagnosticDescriptor InvalidPropertyType = new(
  28. id: "LUACS004",
  29. title: "The type of the field or property must be LuaValue or a type that can be converted to LuaValue.",
  30. messageFormat: "The type of '{0}' must be LuaValue or a type that can be converted to LuaValue.",
  31. category: Category,
  32. defaultSeverity: DiagnosticSeverity.Error,
  33. isEnabledByDefault: true);
  34. public static readonly DiagnosticDescriptor InvalidReturnType = new(
  35. id: "LUACS005",
  36. title: "The return type must be LuaValue or types that can be converted to LuaValue.",
  37. messageFormat: "The return type '{0}' must be LuaValue or types that can be converted to LuaValue.",
  38. category: Category,
  39. defaultSeverity: DiagnosticSeverity.Error,
  40. isEnabledByDefault: true);
  41. public static readonly DiagnosticDescriptor InvalidParameterType = new(
  42. id: "LUACS006",
  43. title: "The parameters must be LuaValue or types that can be converted to LuaValue.",
  44. messageFormat: "The parameter '{0}' must be LuaValue or types that can be converted to LuaValue.",
  45. category: Category,
  46. defaultSeverity: DiagnosticSeverity.Error,
  47. isEnabledByDefault: true);
  48. public static readonly DiagnosticDescriptor DuplicateMetamethod = new(
  49. id: "LUACS007",
  50. title: "The type already contains same metamethod.",
  51. messageFormat: "Type '{0}' already contains a '{1}' metamethod.,",
  52. category: Category,
  53. defaultSeverity: DiagnosticSeverity.Error,
  54. isEnabledByDefault: true);
  55. }