-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(csharp): refactor writer, ast node, and code block into commons #4578
Conversation
*/ | ||
public writeNodeStatement(node: AbstractAstNode): void { | ||
node.write(this); | ||
this.write(";"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Details like this might need to be left out of the abstract classes - not every language ends statements with a ;
. I know most languages do use this syntax though, so we have a couple options:
- Leave this as-is and rely on method overrides in language-specific writers.
- Refactor the
AbstractWriter
to be fairly similar to the originalgenerators/commons.Writer
.
You might have already had (1) as the desired solution, but figured it was worth calling out.
* Writes text but then suffixes with a `;` | ||
* @param node | ||
*/ | ||
public controlFlow(prefix: string, statement: AbstractAstNode): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to above - control flow and blocks will differ based on the language, so the decision applies here too.
@@ -5,7 +5,7 @@ import { FernGeneratorCli } from "@fern-fern/generator-cli-sdk"; | |||
import { readFile } from "fs/promises"; | |||
import yaml from "js-yaml"; | |||
import path from "path"; | |||
import { ReferenceConfigBuilder } from "./ReferenceConfigBuilder"; | |||
import { ReferenceConfigBuilder } from "./reference"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👏
In this PR, we update the generator commons package to export an
AbstractWriter
,AbstractAstNode
andCodeBlock
. These core building blocks will help hit the ground running as new generators are added.