xaizek / zograscope (License: AGPLv3 only) (since 2018-12-07)
Mainly a syntax-aware diff that also provides a number of additional tools.
Commit 4c0448ebdfc4d0aa1f7e0fbee3418ccd84a91355

Break layers on Lua tables
Author: xaizek
Author date (UTC): 2022-11-27 22:47
Committer name: xaizek
Committer date (UTC): 2022-12-03 11:37
Parent(s): 1eee89af48c0ffecc5dc288471d2df0eae35379a
Signing key: 99DC5E4DB05F6BE2
Tree: 22fbad549a2f0a9cfd29aa8494a1ddc168be141a
File Lines added Lines deleted
src/ts/lua/TSLuaLanguage.cpp 2 0
tests/ts/lua/ts-lua-diffing.cpp 15 0
File src/ts/lua/TSLuaLanguage.cpp changed (mode: 100644) (index 1834018..5d430da)
... ... TsLuaLanguage::canBeFlattened(const Node */*parent*/, const Node *child,
197 197 { {
198 198 switch (level) { switch (level) {
199 199 case 0: case 0:
200 return -child->stype == TSLuaSType::Table;
200 201 case 1: case 1:
201 202 case 2: case 2:
202 203 return false; return false;
 
... ... TsLuaLanguage::isLayerBreak(SType /*parent*/, SType stype) const
286 287 || -stype == TSLuaSType::LocalVariableDeclaration || -stype == TSLuaSType::LocalVariableDeclaration
287 288 || -stype == TSLuaSType::FunctionDefinition || -stype == TSLuaSType::FunctionDefinition
288 289 || -stype == TSLuaSType::FunctionDefinitionStatement || -stype == TSLuaSType::FunctionDefinitionStatement
290 || -stype == TSLuaSType::Table
289 291 || -stype == TSLuaSType::Field || -stype == TSLuaSType::Field
290 292 || -stype == TSLuaSType::Parameter || -stype == TSLuaSType::Parameter
291 293 || -stype == TSLuaSType::ReturnStatement || -stype == TSLuaSType::ReturnStatement
File tests/ts/lua/ts-lua-diffing.cpp changed (mode: 100644) (index cea8988..abd275e)
... ... TEST_CASE("Complex update picks correct statement", "[ts-lua][comparison]")
76 76 end end
77 77 )"); )");
78 78 } }
79
80 TEST_CASE("Lua tables are nested", "[ts-lua][comparison]")
81 {
82 diffTsLua(R"(
83 function f()
84 something()
85 return {} --- Deletions
86 end
87 )", R"(
88 function f()
89 something()
90 return { lines = {} } --- Additions
91 end
92 )");
93 }
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/zograscope

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/zograscope

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master