@typespec/prettier-plugin-typespec 0.49.0-dev.0 → 0.49.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -807,7 +807,8 @@ const diagnostics = {
807
807
  "invalid-deprecation-argument": {
808
808
  severity: "error",
809
809
  messages: {
810
- default: "Invalid deprecation argument",
810
+ default: paramMessage `#deprecation directive is expecting a string literal as the message but got a "${"kind"}"`,
811
+ missing: "#deprecation directive is expecting a message argument but none was provided.",
811
812
  },
812
813
  },
813
814
  "duplicate-deprecation": {
@@ -4301,7 +4302,7 @@ const commentHandler = {
4301
4302
  ownLine: (comment, text, options, ast, isLastComment) => [
4302
4303
  addEmptyInterfaceComment,
4303
4304
  addEmptyModelComment,
4304
- addStatementDecoratorComment,
4305
+ addCommentBetweenAnnotationsAndNode,
4305
4306
  handleOnlyComments,
4306
4307
  ].some((x) => x({ comment, text, options, ast: ast, isLastComment })),
4307
4308
  };
@@ -4314,7 +4315,7 @@ const commentHandler = {
4314
4315
  * // My comment
4315
4316
  * }
4316
4317
  */
4317
- function addEmptyInterfaceComment({ comment }) {
4318
+ function addEmptyInterfaceComment({ comment, ast }) {
4318
4319
  const { precedingNode, enclosingNode } = comment;
4319
4320
  if (enclosingNode &&
4320
4321
  enclosingNode.kind === SyntaxKind.InterfaceStatement &&
@@ -4327,7 +4328,7 @@ function addEmptyInterfaceComment({ comment }) {
4327
4328
  return false;
4328
4329
  }
4329
4330
  /**
4330
- * When a comment is in between decorators.
4331
+ * When a comment is in between a node and its annotations(Decorator, directives, doc comments).
4331
4332
  *
4332
4333
  * @example
4333
4334
  *
@@ -4337,10 +4338,12 @@ function addEmptyInterfaceComment({ comment }) {
4337
4338
  * model Foo {
4338
4339
  * }
4339
4340
  */
4340
- function addStatementDecoratorComment({ comment }) {
4341
+ function addCommentBetweenAnnotationsAndNode({ comment }) {
4341
4342
  const { enclosingNode, precedingNode } = comment;
4342
4343
  if (precedingNode &&
4343
- precedingNode.kind === SyntaxKind.DecoratorExpression &&
4344
+ (precedingNode.kind === SyntaxKind.DecoratorExpression ||
4345
+ precedingNode.kind === SyntaxKind.DirectiveExpression ||
4346
+ precedingNode.kind === SyntaxKind.Doc) &&
4344
4347
  enclosingNode &&
4345
4348
  (enclosingNode.kind === SyntaxKind.NamespaceStatement ||
4346
4349
  enclosingNode.kind === SyntaxKind.ModelStatement ||
@@ -4671,7 +4674,6 @@ function canAttachComment(node) {
4671
4674
  kind !== SyntaxKind.LineComment &&
4672
4675
  kind !== SyntaxKind.BlockComment &&
4673
4676
  kind !== SyntaxKind.EmptyStatement &&
4674
- kind !== SyntaxKind.Doc &&
4675
4677
  kind !== SyntaxKind.DocParamTag &&
4676
4678
  kind !== SyntaxKind.DocReturnsTag &&
4677
4679
  kind !== SyntaxKind.DocTemplateTag &&