Skip to content

Conversation

@idbrii
Copy link
Contributor

@idbrii idbrii commented Jul 19, 2020

Support indenting chained method calls:

  local colon_out = self.kitchen
    :getContents()
    :getCheese()
    :enjoyCheese(self
      .mouth()
      .open()
      .extendTongue())
    :eatCheese()
    :digestCheese()

Also tested on this real world example (that gist reflects how indent is applied which differs slightly from the original form) and the screenshot code (unsurprisingly unchanged).

Support indenting chained method calls:

  local colon_out = self.kitchen
    :getContents()
    :getCheese()
    :enjoyCheese(self
      :mouth()
      :open()
      :extendTongue())
    :eatCheese()
    :digestCheese()

  local dot_out = self.kitchen
    .getContents()
    .getCheese()
    .enjoyCheese(self
      .mouth()
      .open()
      .extendTongue())
    .eatCheese()
    .digestCheese()
@idbrii
Copy link
Contributor Author

idbrii commented Jul 19, 2020

I couldn't find it elsewhere, so here's the screenshot code:

local app = require 'app'

---- Vector class.
-- @type Vector
local Vector = {}
Vector.__index = Vector

function Vector:new(x, y, z)
    return setmetatable({x = x, y = y, z = z}, Vector)
end

function Vector:magnitude()
    return math.sqrt(self.x^2, self.y^2, self.z^2)
end

-- TODO remove this
local vec = Vector:new(0, 1, 0)
app.log(vec:magnitude())
app.log(vec.x)

@idbrii
Copy link
Contributor Author

idbrii commented Jul 19, 2020

It doesn't properly handle this case:

    S.tween.always:to(boids.tuning.weights, 5, {
            target = 1,
        })
        :ease("elasticout")
        :onupdate(function()
        boids.normalize_weights() -- expected more indent here
    end)

@tbastos tbastos merged commit fa810f8 into tbastos:master Aug 5, 2020
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