-
Notifications
You must be signed in to change notification settings - Fork 62
fix: maintain area for replacing service #988
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
fix: maintain area for replacing service #988
Conversation
a0f868e
to
dd7472f
Compare
b906dc1
to
7f3cce9
Compare
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 commit message doesn't explain the UX of that fix. Maybe, it would be better to use "Maintain string length while replacing"?
Also, please, add a link to the issue.
BTW, does mapping work correctly?
...c/main/java/org/eclipse/lsp/cobol/core/preprocessor/delegates/util/ReplacingServiceImpl.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/eclipse/lsp/cobol/core/preprocessor/delegates/util/ReplacingServiceImpl.java
Outdated
Show resolved
Hide resolved
@nalmabrcom please, run the UI tests on this PR |
dc2a0b2
to
43faf82
Compare
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.
🦕
I didn't find any mapping issue. The way I try to figure this is, place a debug at applyLookAhead and see if we land there in debug mode. Didn't land there :) |
+ "1 PROGRAM-ID. TESTREPL.\n" | ||
+ "2 DATA DIVISION.\n" | ||
+ "3 WORKING-STORAGE SECTION.\n"; | ||
"0 IDENTIFICATION DIVISION.\r\n" |
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.
You don't need to change \n
to \r\n
.
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.
:D yes, I forgot to revert it. I was getting a weird issue later to find that the culprit was WorkspaceFileService.java .
But forgot to revert later on.
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.
Have reverted some and kept some randomly. So that we test that it works for both.
} | ||
} | ||
|
||
private List<String> splitStringByLength(String actualStr, int fixedLength) { |
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.
Here you change a number of strings and I'm afraid that this will change our mapping. I tried to reproduce the case when we need it and found this bug.
COBOL program:
0 IDENTIFICATION DIVISION.
1 PROGRAM-ID. TESTREPL.
2 DATA DIVISION.
3 WORKING-STORAGE SECTION.
01 LOGA.
COPY REPL5 REPLACING ==LDAY== BY ==DMAN12345789sadfasfdsafasdfsa
- asdfsafsfabfgbtdndfrg==.
PROCEDURE DIVISION.
MOVE 0 TO DMAN12345789sadfasfdsafasdfsaasdfsafsfabfgbtdndfrg.
COPYBOOK REPL5.
***************************************************************** 09700000
02 LOGHDR. 18000000
03 LDAY PIC S9(7) COMP-3.
I see that after the preprocessor changed line with 03 LDAY
is very long and not split. This also causes some errors to the user. Did you try to solve issues like this?
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.
Well, I tried something like this. I actually hoped that it won't give any mapping issues as the replacement with continued lines happens before we start the actual pre-processing. And the long replacement text is should be because the pre-processor concatenates. But I guess, I missed some scenarios. I will look into it. Thanks :)
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.
Hmm. That's interesting because you are showing the exact case I did, but you don't have any errors.
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.
It was my mistake. I have added a use-case test for this scenario.
Signed-off-by: ap891843 <[email protected]>
43faf82
to
2edaa91
Compare
Closing as discussed. |
Signed-off-by: ap891843 [email protected]