GithubHelp home page GithubHelp logo

Fusion internal formatting about fusion HOT 10 OPEN

dphfox avatar dphfox commented on August 28, 2024 4
Fusion internal formatting

from fusion.

Comments (10)

Anaminus avatar Anaminus commented on August 28, 2024 4

For almost all points, there are going to be no strong reasons to pick one way over the other, and trying to enforce a custom format manually is a exercise in futility. I would recommend finding a formatter (StyLua seems good), pick the configuration that you like, and just roll with that. Any variability allowed by the the formatter is fair game.

from fusion.

autonordev avatar autonordev commented on August 28, 2024 3

I would use the Roblox styleguide - it just saves time having this discussion.

Styleguides tend to be more arbitrary than practical. However special consideration should be given for how the diffs and readers are affected.

from fusion.

dphfox avatar dphfox commented on August 28, 2024 1

This is definitely stuff we need to sort out, so thanks for raising the issue!

Quick comment on:

Empty blocks or single statement blocks being multi-line

I try not to place multiple things on the same line for diffing purposes - imagine we have the following code:

if x < 0 then return end

If we had to add some code to run inside that special case, it wouldn't diff as nicely:

- if x < 0 then return end
+ if x < 0 then
+     doSomething(x)
+     return
+ end

Versus the current standard, which diffs better:

if x < 0 then
    return
end
  if x < 0 then
+     doSomething(x)
      return
  end

By the way, anyone else who has issues with formatting, please drop them in here - we need to review this before we write too much code 🙂

from fusion.

Dionysusnu avatar Dionysusnu commented on August 28, 2024 1

I would use the Roblox styleguide - it just saves time having this discussion.

Styleguides tend to be more arbitrary than practical. However special consideration should be given for how the diffs and readers are affected.

The Roblox styleguide is quite outdated, and does not cover a range of topics, most notably Luau types.

Can highly recommend StyLua. It does however automatically create parentheses for constructors like New("Frame" )({}) .

This is an ongoing issue in StyLua. JohnnyMorganz/StyLua#242

from fusion.

dphfox avatar dphfox commented on August 28, 2024

For reference, the current style guide (needs updating): https://github.com/Elttob/Fusion/blob/main/style-guide.md

from fusion.

Dionysusnu avatar Dionysusnu commented on August 28, 2024

I try not to place multiple things on the same line for diffing purposes - imagine we have the following code:

if x < 0 then return end

If we had to add some code to run inside that special case, it wouldn't diff as nicely:

- if x < 0 then return end
+ if x < 0 then
+     doSomething(x)
+     return
+ end

I don't see this bigger diff as a big issue, because the affected lines are still correct. The reason for trailing commas and final newlines are that the diffs would affect unrelated lines. That's not the case here, so I don't think the same reasoning should apply.

from fusion.

dphfox avatar dphfox commented on August 28, 2024

I think it'll be worth waiting to see what other people think then - I remain unconvinced, but I'm open to changing my mind if other people also think differently.

from fusion.

CaptinLetus avatar CaptinLetus commented on August 28, 2024

If we strictly use the Roblox Lua guidelines, multiple statements should be on multiple lines https://roblox.github.io/lua-style-guide/#general-punctuation

from fusion.

noah-peeters avatar noah-peeters commented on August 28, 2024

Can highly recommend StyLua. It does however automatically create parentheses for constructors like New("Frame" )({}) .

from fusion.

dphfox avatar dphfox commented on August 28, 2024

Deferring to v0.3

from fusion.

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.