Giter Club home page Giter Club logo

Comments (11)

LittleLittleCloud avatar LittleLittleCloud commented on July 18, 2024 1

@prithvi2226 that would be awesome!

from autogen.

prithvi2226 avatar prithvi2226 commented on July 18, 2024 1

@LittleLittleCloud If possible, could you please assign this task to me? However, if this action doesn't make a significant difference, I am fine with it. The main priority is to ensure the issue is resolved and the repository progresses smoothly.

from autogen.

LittleLittleCloud avatar LittleLittleCloud commented on July 18, 2024 1

@prithvi2226 Do you need more time on this one? Also please let me know if you need help!

from autogen.

LittleLittleCloud avatar LittleLittleCloud commented on July 18, 2024 1

You nailed it!

from autogen.

prithvi2226 avatar prithvi2226 commented on July 18, 2024

Hi @LittleLittleCloud! This task seems to be interesting! Can I work on this task?

from autogen.

LittleLittleCloud avatar LittleLittleCloud commented on July 18, 2024

@prithvi2226 Any update on this issue

from autogen.

prithvi2226 avatar prithvi2226 commented on July 18, 2024

@prithvi2226 Any update on this issue

Hey @LittleLittleCloud , I am still working on it, been remote for a while, I can give you an update by Tuesday!? If that's okay?

from autogen.

prithvi2226 avatar prithvi2226 commented on July 18, 2024

Hi @LittleLittleCloud! Thank you very much for checking up on me, and thank you very much for taking the time to help me out with this. I am very sorry from my side, for not giving an update, to solve this bug.

Please Correct me if I am wrong, I have decided to work on the file dotnet/src/AutoGen.SourceGenerator/DocumentCommentExtension.cs , and DocumentCommentExtension class contains methods for handling documentation comments, and it's where I am going to add the logic to escape double quotes in the comments. And, in the method 'GetParameterDescriptionFromDocumentationCommentTriviaSyntax' looks like it processes descriptions for parameters from documentation comments. I hope I am on the right track! Thank you very much!

from autogen.

LittleLittleCloud avatar LittleLittleCloud commented on July 18, 2024

@prithvi2226 Thanks for your response.

IMO you don't need to go that further into DocumentCommentExtension.cs, the quickest solution is to encode " properly in

Description = @"<#=parameter.Description#>",
. (" -> "")

For example, when the comment contains "

/// <summary>
/// I have " in the summary and the generated code is breaking!
/// </summary>
/// <param name="city"></param>
/// <returns></returns>
[Function]
public async Task<string> GetWeatherAsync(string city)
{
    return await Task.FromResult($"The weather in {city} is sunny.");
}

The generated code is
image

As you can see, " breaks the generated code because FunctionTemplate.tt encodes description using @"...." and didn't process the " in the comment description.

The quickest fix is to encode " in description by doubling it (""). This is how " is encoded as well in verbatim string.

e.g.
image

from autogen.

prithvi2226 avatar prithvi2226 commented on July 18, 2024

Hi @LittleLittleCloud ,

Thank you very much for your guidance. Based on your suggestion, I will implement the fix directly in the FunctionCallTemplate.tt file. Here are the steps I plan to take:

Planned Changes:

  1. Modify the FunctionCallTemplate.tt File:

Locating the line that assigns the description (around line 84):

Description = @"<#=parameter.Description#>",

  1. I will modify this line to properly encode double quotes by doubling them (""), like so:

Description = @"<#= parameter.Description.Replace("\"", "\"\"") #>",

This approach should correctly handle double quotes in comments and prevent the generated code from breaking.

Please let me know if this solution looks good to you, and I will proceed with making these changes.

Thank you once again for your assistance!

Best regards,
Prithvi

from autogen.

prithvi2226 avatar prithvi2226 commented on July 18, 2024

Hi @LittleLittleCloud ! I have created a pull request, let me know what you think about it. Thank you very much for your guidance and support. I would love to connect with you on Github or Slack to continue supporting this project.

from autogen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.