Giter VIP home page Giter VIP logo

Comments (4)

exaexa avatar exaexa commented on August 25, 2024 2

Yes, just breaking the thing to lines would in my opinion solve the majority of the problematic the use-cases.

Instead of

f(a, b, c, d)

write, in case line width can't fit length of the signature + indent,

f(
  a,
  b,
  c,
  d,
)

There might be cases where this still breaks, such as when people have long typenames or very long default values (e.g. functions with begin/end), but these would really require JuliaFormatter to be taken care of properly. Possible example of what not to care about:

fn(
  test::LongNamedAbstractThingInterface{AbstractLongNamedThingInterfaceProbablyContentIdontKnow},
  test2 = (p1,p2,p3) -> begin do_this(p1); also_now_do_that(p2); and_finally_do_something_more(p3) end,
)

from docstringextensions.jl.

stelmo avatar stelmo commented on August 25, 2024 2

I started working on this here. Basically, I modified printmethod to calculate the length of the method signatures and then break them into multiline format if longer than some threshold (no JuliaFormatter involvement). I will test it out on my packages to see if it looks ugly and then make a PR if not.

from docstringextensions.jl.

exaexa avatar exaexa commented on August 25, 2024

(Autoformatting can be done by JuliaFormatter's functions, e.g. https://domluna.github.io/JuliaFormatter.jl/stable/api/#JuliaFormatter.format_text-Tuple{AbstractString} )

from docstringextensions.jl.

mortenpi avatar mortenpi commented on August 25, 2024

I think this would be great. We could probably check for the length of the single line docstring and then make it multiline if it's longer than some number of characters?

from docstringextensions.jl.

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.