Closed zvondic closed 1 month ago
@zvondic Does this happen only with classes? Do you get another new line every time you compile, or just once?
Only classes and it is random. My thought is that compiling and saving via the VSC plugin removes the last empty line, but editing the class and compiling from the server-side projection and subsequent saving to the git workspace is saved with an empty line.
@zvondic What is your workflow? Based on your screenshot, it looks like you're using client-side editing (editing the files on your local file system that are controlled by git). However, your last comment makes it sounds like you're using server-side editing (editing virtual files like Studio). Which one are you using?
Yes, i am using client side editing. BU some classes have projection/ I don't use Studio!
But this coomad export from projection modifided classes (added property or method) to git and there are empty lines om end.
D ##class(Utils.SourceControl.SyncApi).InternalExportToFS(Class_".cls")
The classmethod you're calling there is not InterSystems code, but I've seen similar behavior in https://github.com/intersystems/git-source-control that I'd love to sort out, so following here...
Probably Utils.SourceControl.SyncApi is calling $System.OBJ.ExportUDL
(as in https://github.com/intersystems/git-source-control/blob/main/cls/SourceControl/Git/Utils.cls#L1354C28-L1354C49) which adds the extra newline.
@zvondic Thanks for the details. Here's my understanding of your workflow:
If I got that right, then I think your projection that does the export is causing the extra line to appear since I couldn't reproduce this issue without it. I don't think you need that projection though. If you're editing the file in VS Code that is tracked by git, the vscode-objectscript extension will update the local copy of the file after it is compiled.
There are things that are incomprehensible to me in the export, I have to discuss with the author and then I will contact you.
@isc-bsaviano I found what was causing it. I have a class that has a projection. This projection modifies the class definition and recompiles it and saves it to a git folder using the $system.OBJ.ExportUDL method. And here's the problem, what causes it. It is shown in the picture. Projection is shown in red, and what VSC saved after completion of compilation in green. ExportUDL inserts empty line to end of file. VSC saves file the same as i can see in Cache Studio. But I don't know what to do with, how to force ExportUDL and VSC bring the same results.
@zvondic I think this is just a difference between how the Atelier API and ExportUDL() return the document content. The Atelier API retuns a JSON array of lines that VS Code joins with the newline character, which doesn't add a newline after the last line. ExportUDL() writes out each line of the document followed by a newline, which adds a newline even after the last line.
@zvondic I see you opened a WRC case for this issue so I'm closing this one. Follow the WRC case for updates.
I use ISC VSC plugins for development. Cache version is 2018.1.4. When I compile from VSC, I sometimes get blank lines at the end of the file when git changes. Maybe some editing and compiling in class projection and server save to git workspace? It's very annoying. Can you help me? Thanks. Josef