LiXizhi / NPL

Lua, NPL, ParaEngine, Language Service
24 stars 10 forks source link

Formatter ignore code in [[]] --[[]] and "" #5

Closed LiXizhi closed 7 years ago

LiXizhi commented 7 years ago

Case1:

--[[ 
2017-1-1 
]] 
local str = [[
2017-1-1
]]

will be wrongly formatted to

--[[ 
2017 - 1 - 1 
]] 
local str = [[
2017 - 1 - 1
]]

Case2:

def("activate", p1){
    NPL.this(function()
        local +{params(p1)} = msg;
        +{emit()}
    end);
}

will be wrongly formatted to

def("activate", p1){
    NPL.this(function()
    local +{params(p1)} = msg;
    +{emit()}
end);
}
DarrenGZY commented 7 years ago

every line in def will have the same indentation

Case1:
def("activate", p1){ NPL.this(function() local +{params(p1)} = msg; +{emit()} end); }

will be formatted into

def("activate", p1){ NPL.this(function() local +{params(p1)} = msg; +{emit()} end); }

Case2: def("activate", p){ if true then print() else print() end }

will be formatted into

def("activate", p){ if true then print() else print() end }