-
Notifications
You must be signed in to change notification settings - Fork 26
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
base: 2699-new-command-insert-variable-display
Are you sure you want to change the base?
2695 implement output type tree in getdatalayout lsp request #2697
Conversation
TypeCobol.LanguageServer.Test/ProcessorTests/DataLayoutProcessorTreeTest.cs
Outdated
Show resolved
Hide resolved
TypeCobol.LanguageServer.Test/ProcessorTests/DataLayoutProcessorTreeTest.cs
Outdated
Show resolved
Hide resolved
TypeCobol.LanguageServer.Test/ProcessorTests/DataLayoutProcessorTreeTest.cs
Show resolved
Hide resolved
TypeCobol.LanguageServer/TypeCobolCustomLanguageServer/TypeCobolCustomLanguageServer.cs
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,120 @@ | |||
{"line":1,"character":12} | |||
--------------------------------------------------------------------------------- | |||
{ |
There was a problem hiding this comment.
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 !
There was a problem hiding this comment.
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
TypeCobol.LanguageServer.Test/ProcessorTests/DataLayoutProcessorTest.cs
Outdated
Show resolved
Hide resolved
TypeCobol.LanguageServer.Test/ProcessorTests/DataLayoutProcessorTest.cs
Outdated
Show resolved
Hide resolved
TypeCobol.LanguageServer.Test/ProcessorTests/DataLayoutProcessorTest.cs
Outdated
Show resolved
Hide resolved
TypeCobol.LanguageServer.Test/ProcessorTests/DataLayoutProcessorTreeTest.cs
Outdated
Show resolved
Hide resolved
…lement-output-type-tree-in-getdatalayout-lsp-request
…lement-output-type-tree-in-getdatalayout-lsp-request
"start": 1, | ||
"length": 4, | ||
"index": 3, | ||
"flags": 2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Displayable ? Nothing looks displayable to me in the whole group except var-displayable
@@ -20,6 +19,7 @@ public class DataLayoutProcessor | |||
private const string DIMENSION_ITEM = "1"; | |||
private const string GROUP = "GROUP"; | |||
private const string FILLER = "FILLER"; | |||
private const int MAX_INDEX_CAPACITY = 65535; // Max capacity of an index declared as PIC 9(4) COMP-5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please move this into IndexGenerator
as this is where we decide to use PIC 9(4) COMP-5 ? Use internal const
modifier.
@@ -238,14 +239,42 @@ internal static DataLayoutNode From(DataDefinition dataDefinition, DataLayoutNod | |||
|
|||
bool IsDisplayable() | |||
{ | |||
// FILLER with a National or NationalEdited picture are not displayable | |||
if (name == FILLER && (dataDefinition.SemanticData?.Type).IsNationalOrNationalEdited()) | |||
// OCCURS that can not be looped by an index defined as PIC 9(4) COMP-5 (see InsertVariableDisplay command) are not displayable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update comment to point to IndexGenerator
return false; | ||
} | ||
|
||
if (!dataDefinition.IsFiller()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cannot use IsFiller
here. The definition of a FILLER in the context of InsertVariableDisplay is unfortunately different than the one in our private copy comparison tool.
For InsertVariableDisplay a 'FILLER' is simply an anonymous variable, so we just have to test string.IsNullOrEmpty(dataDefinition.Name)
here.
// FILLER with no named ascendant are not displayable | ||
var ascendantNode = dataDefinition.Parent; | ||
while (ascendantNode is DataDefinition ascendantDataDefinition) | ||
{ | ||
if (!ascendantDataDefinition.CodeElement.IsFiller()) | ||
{ | ||
return true; | ||
} | ||
ascendantNode = ascendantNode.Parent; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the ExceedsMaxIndexCapacity
, you can apply the same mechanism to compute whether the data is adressable or not without having to crawl up the parents. Something like isNotAdressable = parent.IsNotAdressable && string.IsNullOrEmpty(dataDefinition.Name)
Fixes #2695
There is a functional changes in GetDataLayoutRequest with CSV output type.
The declaration may now contain additional information for a REDEFINES: PICTURE, USAGE or GROUP.