-
Notifications
You must be signed in to change notification settings - Fork 92
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
Got tabs replaced by literal '\t' when saving #996
Comments
Huh, fun bug. Likely something to do with VS Code and it writing files. I will look into it. Thanks! |
So I was going to make a new issue but I decided to look through the open issues and came across this. I have been experiencing this as well in certain situations. I have a SQL source file that had a tab character in it most likely from when it was made. When I pull it down from production to work on it using VS Code the characters don't show up until I make a change and save it. When I reopen it the \t is put in place of the tab characters. So I started testing to see where and how this is getting put in. Came to the conclusion that when I disable the Source dates option, VS Code will start translating the tab characters correctly and replace it with a space or however you may have your tab indentation setup. When I re-enable Source dates it creates the \t again. Now I have no idea why this is the case because what would source dates have to do with translating tab characters but here we are. If you want me to make a new issue I totally can but I just figured I would throw this comment on this open issue. |
Excellent detective work! I'm glad you found this issue; commenting here was absolutely the best thing to do. I'm sure your new information will help someone track down the bug. |
It's the Source date option in combination with the Source date tracking mode: When set to You can easily replicate this by running the VS Code command This is definitely a bug! |
So, does this mean you can find it in the code? Or are you just noting more specifics about the behavior? |
I was only doing some extra testing - I didn't check the code. I've been involved in the save operation (particularly regarding hex color codes) and was curious as to what was causing this. My initial thought about this problem was that having EBCDIC tab converted into But seeing that tabs inserted by VS Code was also converted into But at least now we know in which specific part of the code where to look for the bug... |
* escapeString function now replaces each instance of '\t' with two spaces instead of '\\t' (This is to address a problem with unexpected tab behavior as described in issue codefori#996)
It looks like the issue is with the escapeString function in extendedContent.ts; is that right? I found that the function is executed for each line of a source member when the member is saved, but only if Enable Source Dates is turned on and the date tracking mode is set to |
Describe the bug
When saving tab characters back to the IBM i, the string
'\t'
(that is, the two-character string composed of a literal backslash and a literal 't') get written into the source member.To Reproduce
Expected behavior
A tab character in the appropriate CCSID gets written to the source member.
Screenshots
SEU before editing:
Open in VS Code:
Setting indent mode:
Code containing tab:
SEU after saving:
Environment (please complete the following information):
Additional context
I realize you would rarely want actual tabs in your code, especially if it will also be worked on with SEU. But if the tabs are already there in the source member on the IBM i, VS Code opens them as tabs, and they need to make the round-trip intact.
The text was updated successfully, but these errors were encountered: