Open planger opened 5 years ago
Good morning, Philip -- and I thought I was the only one using it!
My apologies for the trouble and many thanks for giving it a try. I use it exclusively and all the time and I haven't seen this bug, so there must be an edge case I didn't contemplate.
I'll be able to look at it later and hopefully have a fix for you. One suspicion is that I try to copy the quote style of the original code. You use double-quote and I use single. I'm wondering if the bug lies somewhere near there.
I'll keep you posted!
On Thu, Mar 7, 2019 at 6:03 AM Philip Langer notifications@github.com wrote:
At least in our configuration (organize imports and split'n'sort on save), this extension keeps adding more and more blank lines after the imports. See below for a short screen cast:
[image: saveissue_peek] https://user-images.githubusercontent.com/2311075/53944574-f8e1f580-40bf-11e9-8437-d711bd2a4b4c.gif
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mflorence99/import-splitnsort/issues/3, or mute the thread https://github.com/notifications/unsubscribe-auth/AAaNcHaEun0P-AJ3d6HA5gt3wYJyzwD2ks5vUPH-gaJpZM4bi66m .
Thank you very much for your fast reply and for planning to look at this issue!
We've used the extension only for a day until now, but find it to be very useful! :+1: How to format imports is surely a matter of taste, but we like it a lot as it avoids unnecessary merge conflicts that we kept getting on the usual "joined" imports.
So anyway, thanks a lot for sharing your extension! Please let us know if we can help with anything!
Philip -- thanks again for your report. I was unable to repro yesterday, although I had less time to spend on debugging than I had hoped. I understand that the file you used in your example is likely confidential, but would you mind attaching its head -- the imports in their original form, also including the first exported class? Your tsconfig.json
if that is possible will help too. Many thanks!
Thanks a lot for looking into this issue! The project is not confidential at all, it is open-source and available here: https://github.com/eclipsesource/graphical-lsp If you open VSCode in the graphical-lsp/client folder you should be able to reproduce this with any ts file that is contained in a package, e.g. https://github.com/eclipsesource/graphical-lsp/blob/master/client/packages/glsp-sprotty/src/base/command-stack.ts
Please let me know if I can help with anything! Thanks again!
Got it! Many thanks -- will debug later today.
Philip -- I'm sorry to report this but I can't repro using your repo (very nice, BTW!) on any of the files I tried, including creation-tool-feedback.ts
. Clearly, the problem is real so here goes another theory:
Are you dev computers by any chance Windows? I'm looking suspiciously at line #143 in my https://github.com/mflorence99/import-splitnsort/blob/master/src/parser.ts file. You can see that I'm counting \n
characters to count lines. I don't quite get it, but if somehow I missed a \r
I might be confusing the VSCode editor in the return from my makeRange()
method.
Before I go down a big rat hole if you're not using Windows that's unlikely to be the issue!
Hi Mark,
Thank you so much for pursuing the investigation! We are using Ubuntu, so it looks like that shouldn't be an issue.
What is the easiest way that I can debug your extension on my end? I should be able to have a look at it and see if I can find a clue by stepping through the code.
Thanks again!
Mark Florence notifications@github.com schrieb am Fr., 8. März 2019, 20:27:
Philip -- I'm sorry to report this but I can't repro using your repo (very nice, BTW!) on any of the files I tried, including creation-tool-feedback.ts. Clearly, the problem is real so here goes another theory:
Are you dev computers by any chance Windows? I'm looking suspiciously at line #143 in my https://github.com/mflorence99/import-splitnsort/blob/master/src/parser.ts file. You can see that I'm counting \n characters to count lines. I don't quite get it, but if somehow I missed a \r I might be confusing the VSCode editor in the return from my makeRange() method.
Before I go down a big rat hole if you're not using Windows that's unlikely to be the issue!
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mflorence99/import-splitnsort/issues/3#issuecomment-471047086, or mute the thread https://github.com/notifications/unsubscribe-auth/AAj5OtO3kt97QAzwEBSE3GJNINHWG-lMks5vUrmfgaJpZM4bi66m .
Philip -- we're Ubuntu also so I'm baffled and your offer of help is very welcome.
Microsoft have some decent docs on debugging extensions, starting here: https://vscode-docs.readthedocs.io/en/stable/extensions/debugging-extensions/. TBH I found it confusing at first and I just went through a debug session to refresh my memory so I could describe it accurately.
First of course, git clone
my repo somewhere. You will need to run npm ci
to install all the dependencies, just the same versions I used when the published the extension. You might add the import-splitnsort
folder to an existing VSCode workspace for convenience.
Then open the debug sidebar and select Extension (import-splitnsort)
from the dropdown as shown below. This is the only place I deviate from the VSCode docs. They ask you to hit F5
which won't work if there are other debug tasks in your workspace.
You can see that I have my parser.ts
file open and a breakpoint set at a suspicious line. Hit the green arrow at the top left, next to DEBUG
and the debug session starts. VSCode will open a separate instance to the side (not shown in my screenshots), in which the extension is overridden by the local code. I have a number of monitors which makes this very easy. You can open any file and on save the extension will be run and the breakpoint hit.
In the screenshot below, I'm looking at the contents of epos
. The standard debug controls (step over etc) are at the top of the pane.
Good luck, may thanks, and please let me know anytime what I can do to help.
At least in our configuration (organize imports and split'n'sort on save), this extension keeps adding more and more blank lines after the imports. See below for a short screen cast: