Skip to content
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

put new type under namespace #149

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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