Skip to content

Conversation

jchannon
Copy link
Member

Not sure what XS has done to the formatting 😟


public override void CreateNewType(AstNode newType, NewTypeContext context = NewTypeContext.CurrentNamespace)
{
var output = OutputNode(0, newType, true);
InsertText(0, output.Text);
var firstCurlyBraceIndex = this.CurrentDocument.Text.IndexOf("{");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code isn't quite right.... what if there is no namespace? You probably want to search for the first class instead and insert before that. You should use the AST for that.

Also, please include some tests so I can see what is going on. A test with a class with a namespace, class without namespace, namespace without a class etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants