@alloy-js/csharp 0.18.0-dev.7 → 0.18.0-dev.9

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.
Files changed (58) hide show
  1. package/dist/src/components/ClassDeclaration.d.ts +2 -0
  2. package/dist/src/components/ClassDeclaration.d.ts.map +1 -1
  3. package/dist/src/components/ClassDeclaration.js +6 -1
  4. package/dist/src/components/ClassMethod.d.ts +2 -0
  5. package/dist/src/components/ClassMethod.d.ts.map +1 -1
  6. package/dist/src/components/ClassMethod.js +6 -1
  7. package/dist/src/components/doc/comment.d.ts +70 -0
  8. package/dist/src/components/doc/comment.d.ts.map +1 -0
  9. package/dist/src/components/doc/comment.js +88 -0
  10. package/dist/src/components/doc/comment.test.d.ts +2 -0
  11. package/dist/src/components/doc/comment.test.d.ts.map +1 -0
  12. package/dist/src/components/doc/comment.test.js +348 -0
  13. package/dist/src/components/doc/from-markdown.d.ts +6 -0
  14. package/dist/src/components/doc/from-markdown.d.ts.map +1 -0
  15. package/dist/src/components/doc/from-markdown.js +58 -0
  16. package/dist/src/components/doc/from-markdown.test.d.ts +2 -0
  17. package/dist/src/components/doc/from-markdown.test.d.ts.map +1 -0
  18. package/dist/src/components/doc/from-markdown.test.js +83 -0
  19. package/dist/src/components/index.d.ts +2 -0
  20. package/dist/src/components/index.d.ts.map +1 -1
  21. package/dist/src/components/index.js +2 -0
  22. package/dist/src/components/interface/declaration.d.ts +2 -0
  23. package/dist/src/components/interface/declaration.d.ts.map +1 -1
  24. package/dist/src/components/interface/declaration.js +6 -1
  25. package/dist/src/components/interface/declaration.test.js +13 -0
  26. package/dist/src/components/interface/method.d.ts +2 -0
  27. package/dist/src/components/interface/method.d.ts.map +1 -1
  28. package/dist/src/components/interface/method.js +6 -1
  29. package/dist/src/components/interface/method.test.js +21 -0
  30. package/dist/src/components/interface/property.d.ts +2 -0
  31. package/dist/src/components/interface/property.d.ts.map +1 -1
  32. package/dist/src/components/interface/property.js +7 -2
  33. package/dist/src/components/interface/property.test.js +24 -0
  34. package/dist/test/class-method.test.js +21 -0
  35. package/dist/test/class.test.js +13 -0
  36. package/dist/test/vitest.setup.d.ts +2 -0
  37. package/dist/test/vitest.setup.d.ts.map +1 -0
  38. package/dist/test/vitest.setup.js +1 -0
  39. package/dist/tsconfig.tsbuildinfo +1 -1
  40. package/package.json +3 -2
  41. package/src/components/ClassDeclaration.tsx +4 -0
  42. package/src/components/ClassMethod.tsx +5 -0
  43. package/src/components/doc/comment.test.tsx +337 -0
  44. package/src/components/doc/comment.tsx +152 -0
  45. package/src/components/doc/from-markdown.test.tsx +103 -0
  46. package/src/components/doc/from-markdown.tsx +58 -0
  47. package/src/components/index.ts +2 -0
  48. package/src/components/interface/declaration.test.tsx +11 -0
  49. package/src/components/interface/declaration.tsx +5 -0
  50. package/src/components/interface/method.test.tsx +16 -0
  51. package/src/components/interface/method.tsx +5 -0
  52. package/src/components/interface/property.test.tsx +22 -0
  53. package/src/components/interface/property.tsx +5 -0
  54. package/temp/api.json +2140 -154
  55. package/test/class-method.test.tsx +16 -0
  56. package/test/class.test.tsx +11 -0
  57. package/test/vitest.setup.ts +1 -0
  58. package/vitest.config.ts +3 -0
@@ -102,3 +102,19 @@ it("defines params and return type", () => {
102
102
  }
103
103
  `);
104
104
  });
105
+
106
+ it("specify doc comment", () => {
107
+ expect(
108
+ <TestNamespace>
109
+ <InterfaceDeclaration name="Test">
110
+ <InterfaceMethod name="Method" doc="This is a test" />
111
+ </InterfaceDeclaration>
112
+ </TestNamespace>,
113
+ ).toRenderTo(`
114
+ interface Test
115
+ {
116
+ /// This is a test
117
+ void Method();
118
+ }
119
+ `);
120
+ });
@@ -16,6 +16,7 @@ import { useCSharpNamePolicy } from "../../name-policy.js";
16
16
  import { CSharpOutputSymbol } from "../../symbols/csharp-output-symbol.js";
17
17
  import { CSharpMemberScope, useCSharpScope } from "../../symbols/scopes.js";
18
18
  import { ParameterProps, Parameters } from "../Parameters.jsx";
19
+ import { DocWhen } from "../doc/comment.jsx";
19
20
 
20
21
  /** Method modifiers. Can only be one. */
21
22
  export interface InterfaceMethodModifiers {
@@ -33,6 +34,9 @@ export interface InterfaceMethodProps
33
34
  children?: Children;
34
35
  parameters?: Array<ParameterProps>;
35
36
  returns?: Children;
37
+
38
+ /** Doc comment */
39
+ doc?: Children;
36
40
  }
37
41
 
38
42
  // a C# interface method
@@ -66,6 +70,7 @@ export function InterfaceMethod(props: InterfaceMethodProps) {
66
70
  return (
67
71
  <MemberDeclaration symbol={methodSymbol}>
68
72
  <Scope value={methodScope}>
73
+ <DocWhen doc={props.doc} />
69
74
  {modifiers}
70
75
  {props.returns ?? "void"} {name}({params})
71
76
  {props.children ?
@@ -120,3 +120,25 @@ it("has getter and setter", () => {
120
120
  }
121
121
  `);
122
122
  });
123
+
124
+ it("specify doc comment", () => {
125
+ expect(
126
+ <TestNamespace>
127
+ <InterfaceDeclaration name="Test">
128
+ <InterfaceProperty
129
+ name="Method"
130
+ type="string"
131
+ get
132
+ set
133
+ doc="This is a test"
134
+ />
135
+ </InterfaceDeclaration>
136
+ </TestNamespace>,
137
+ ).toRenderTo(`
138
+ interface Test
139
+ {
140
+ /// This is a test
141
+ string Method { get; set; }
142
+ }
143
+ `);
144
+ });
@@ -16,6 +16,7 @@ import {
16
16
  import { useCSharpNamePolicy } from "../../name-policy.js";
17
17
  import { CSharpOutputSymbol } from "../../symbols/csharp-output-symbol.js";
18
18
  import { CSharpMemberScope, useCSharpScope } from "../../symbols/scopes.js";
19
+ import { DocWhen } from "../doc/comment.jsx";
19
20
 
20
21
  /** Method modifiers. Can only be one. */
21
22
  export interface InterfacePropertyModifiers {
@@ -41,6 +42,9 @@ export interface InterfacePropertyProps
41
42
 
42
43
  /** If property should have a setter */
43
44
  set?: boolean;
45
+
46
+ /** Doc comment */
47
+ doc?: Children;
44
48
  }
45
49
 
46
50
  // a C# interface property
@@ -71,6 +75,7 @@ export function InterfaceProperty(props: InterfacePropertyProps) {
71
75
  return (
72
76
  <MemberDeclaration symbol={propertySymbol}>
73
77
  <Scope value={propertyScope}>
78
+ <DocWhen doc={props.doc} />
74
79
  {modifiers}
75
80
  {props.type} {name}{" "}
76
81
  <Block newline inline>