Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2695 implement output type tree in getdatalayout lsp request #2697

Open
wants to merge 20 commits into
base: 2699-new-command-insert-variable-display
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion TypeCobol.LanguageServer.Test/LSRTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,8 @@ public void EI_ExtractRemarksData()
[TestCategory("GetDataLayout")]
public void GetDataLayoutRequest()
{
LSRTestHelper.Test("GetDataLayoutRequest", LsrTestingOptions.NoLsrTesting);
LSRTestHelper.Test("GetDataLayoutRequestCSV", LsrTestingOptions.NoLsrTesting);
LSRTestHelper.Test("GetDataLayoutRequestTREE", LsrTestingOptions.NoLsrTesting);
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
{
"category": 1,
"message": "{\"jsonrpc\":\"2.0\",\"id\":\"1\",\"result\":{\"csvResult\":{\"root\":\"TCOZEFR0\",\"header\":\"LineNumber;NodeLevel;LevelNumber;VariableName;PictureTypeOrUsage;Start;End;Length\",\"rows\":[\"12;0;1;FILLER (1);GROUP OCCURS 1;1;81;81\",\"13;1;5;Array1 (1 1);GROUP OCCURS 9;1;81;81\",\"14;2;10;Var1 (1 1);PIC X;1;1;1\",\"15;2;10;Array2 (1 1 1);GROUP OCCURS 8;2;9;8\",\"16;3;15;Var2 (1 1 1);PIC X;2;2;1\",\"17;0;1;FILLER;GROUP;1;4;4\",\"18;1;5;GRP-REDEFINED;GROUP;1;3;3\",\"19;2;10;VAR-1;PIC 9(05) COMP-3;1;3;3\",\"20;1;5;FILLER;REDEFINES GRP-REDEFINED;1;3;3\",\"21;2;10;VAR-RED1;PIC 9(05) COMP-3;1;3;3\",\"22;1;5;GROUP-WITH-88-1;GROUP;4;4;1\",\"23;2;10;GROUP-WITH-88-2;PIC 9(01);4;4;1\",\"28;0;1;Var1-in-ls;PIC XX;1;2;2\",\"29;0;1;num1;PIC 9(03);1;3;3\",\"30;0;1;num2;comp-1;1;4;4\",\"31;0;1;num3;comp-2;1;8;8\",\"32;0;1;num4;PIC 9(03) comp-3;1;2;2\",\"33;0;1;num5;PIC 9(03) comp-4;1;2;2\",\"34;0;1;num6;PIC 9(03) comp-5;1;2;2\",\"35;0;1;num7;PIC 9(03) packed-decimal;1;2;2\",\"36;0;1;num8;PIC 9(03) binary;1;2;2\",\"37;0;1;num9;PIC 9(03) comp;1;2;2\"],\"separator\":\";\"}}}"
"message": "{\"jsonrpc\":\"2.0\",\"id\":\"1\",\"result\":{\"csvResult\":{\"root\":\"TCOZEFR0\",\"header\":\"LineNumber;NodeLevel;LevelNumber;VariableName;PictureTypeOrUsage;Start;End;Length\",\"rows\":[\"12;0;1;FILLER (1);GROUP OCCURS 1;1;81;81\",\"13;1;5;Array1 (1 1);GROUP OCCURS 9;1;81;81\",\"14;2;10;Var1 (1 1);PIC X;1;1;1\",\"15;2;10;Array2 (1 1 1);GROUP OCCURS 8;2;9;8\",\"16;3;15;Var2 (1 1 1);PIC X;2;2;1\",\"17;0;1;FILLER;GROUP;1;4;4\",\"18;1;5;GRP-REDEFINED;GROUP;1;3;3\",\"19;2;10;VAR-1;PIC 9(05) COMP-3;1;3;3\",\"20;1;5;FILLER;GROUP REDEFINES GRP-REDEFINED;1;3;3\",\"21;2;10;VAR-RED1;PIC 9(05) COMP-3;1;3;3\",\"22;1;5;GROUP-WITH-88-1;GROUP;4;4;1\",\"23;2;10;GROUP-WITH-88-2;PIC 9(01);4;4;1\",\"28;0;1;Var1-in-ls;PIC XX;1;2;2\",\"29;0;1;num1;PIC 9(03);1;3;3\",\"30;0;1;num2;comp-1;1;4;4\",\"31;0;1;num3;comp-2;1;8;8\",\"32;0;1;num4;PIC 9(03) comp-3;1;2;2\",\"33;0;1;num5;PIC 9(03) comp-4;1;2;2\",\"34;0;1;num6;PIC 9(03) comp-5;1;2;2\",\"35;0;1;num7;PIC 9(03) packed-decimal;1;2;2\",\"36;0;1;num8;PIC 9(03) binary;1;2;2\",\"37;0;1;num9;PIC 9(03) comp;1;2;2\"],\"separator\":\";\"}}}"
},
{
"category": 0,
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"success": true,
"diff_index": [
-1
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ LineNumber;NodeLevel;LevelNumber;VariableName;PictureTypeOrUsage;Start;End;Lengt
17;0;1;FILLER;GROUP;1;4;4
18;1;5;GRP-REDEFINED;GROUP;1;3;3
19;2;10;VAR-1;PIC 9(05) COMP-3;1;3;3
20;1;5;FILLER;REDEFINES GRP-REDEFINED;1;3;3
20;1;5;FILLER;GROUP REDEFINES GRP-REDEFINED;1;3;3
21;2;10;VAR-RED1;PIC 9(05) COMP-3;1;3;3
22;1;5;GROUP-WITH-88-1;GROUP;4;4;1
23;2;10;GROUP-WITH-88-2;PIC 9(01);4;4;1
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
02 root-included.
05 grp-included.
10 var-included-1 PIC X.
10 FILLER PIC X.
10 var-included-occ PIC X OCCURS 3.
05 grp-included-redef REDEFINES grp-included.
10 var-included-2 PIC X(5).
120 changes: 120 additions & 0 deletions TypeCobol.LanguageServer.Test/ProcessorTests/DataLayout/Tree-Copy.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
{"line":1,"character":12}
---------------------------------------------------------------------------------
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JSON produced are huge. Maybe we should contract node data into a single value or an array ?

      "logicalLevel": 1,
      "line": 0,
      "physicalLevel": 0,
      "name": "working-storage",
      "occursDimension": 0,
      "start": 0,
      "length": 0,
      "index": 0,
      "flags": 0,

would become

      [1, 0, 0, "working-storage", 0, 0, 0, 0, 0]

Much less readable I agree but also much shorter !

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, to be done at the end

"logicalLevel": 0,
"line": 0,
"physicalLevel": 0,
"name": "copy",
"occursDimension": 0,
"start": 0,
"length": 0,
"index": -1,
"flags": 0,
"children": [
{
"logicalLevel": 1,
"line": 0,
"physicalLevel": 0,
"name": "working-storage",
"occursDimension": 0,
"start": 0,
"length": 0,
"index": -1,
"flags": 0,
"children": [
{
"logicalLevel": 2,
"line": 1,
"physicalLevel": 1,
"name": "TCOQLF",
"declaration": "GROUP",
"occursDimension": 0,
"start": 1,
"length": 6,
"index": 0,
"flags": 2,
"children": [
{
"logicalLevel": 3,
"line": 2,
"physicalLevel": 5,
"name": "TCOQLF-Var1",
"declaration": "PIC X",
"occursDimension": 0,
"start": 1,
"length": 1,
"index": 0,
"flags": 2,
"children": []
},
{
"logicalLevel": 3,
"line": 3,
"physicalLevel": 5,
"name": "TCOQLF-Var2",
"declaration": "PIC X",
"occursDimension": 0,
"start": 2,
"length": 1,
"index": 1,
"flags": 2,
"children": []
},
{
"logicalLevel": 3,
"line": 4,
"physicalLevel": 5,
"name": "TCOQLF-Var3",
"declaration": "PIC X",
"occursDimension": 0,
"start": 3,
"length": 1,
"index": 2,
"flags": 2,
"children": []
},
{
"logicalLevel": 3,
"line": 5,
"physicalLevel": 5,
"name": "TCOQLF-Var4",
"declaration": "PIC X",
"occursDimension": 0,
"start": 4,
"length": 1,
"index": 3,
"flags": 2,
"children": []
},
{
"logicalLevel": 3,
"line": 6,
"physicalLevel": 5,
"name": "TCOQLF-Var5",
"declaration": "PIC X",
"occursDimension": 0,
"start": 5,
"length": 1,
"index": 4,
"flags": 2,
"children": []
},
{
"logicalLevel": 3,
"line": 7,
"physicalLevel": 5,
"name": "TCOQLF-Var6",
"declaration": "PIC X",
"occursDimension": 0,
"start": 6,
"length": 1,
"index": 5,
"flags": 2,
"children": []
}
]
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{"line":10,"character":12}
---------------------------------------------------------------------------------
{
"logicalLevel": 0,
"line": 0,
"physicalLevel": 0,
"name": "MAINPGM",
"occursDimension": 0,
"start": 0,
"length": 0,
"index": -1,
"flags": 0,
"children": [
{
"logicalLevel": 1,
"line": 0,
"physicalLevel": 0,
"name": "working-storage",
"occursDimension": 0,
"start": 0,
"length": 0,
"index": -1,
"flags": 0,
"children": [
{
"logicalLevel": 2,
"line": 6,
"physicalLevel": 1,
"name": "main-group",
"declaration": "GROUP",
"occursDimension": 0,
"start": 1,
"length": 1,
"index": 0,
"flags": 2,
"children": [
{
"logicalLevel": 3,
"line": 7,
"physicalLevel": 5,
"name": "main-var",
"declaration": "PIC X",
"occursDimension": 0,
"start": 1,
"length": 1,
"index": 0,
"flags": 2,
"children": []
}
]
}
]
}
]
}
Loading