rubicon-oss / LicenseHeaderManager

Manage license headers for your source code files in Visual Studio
179 stars 41 forks source link

File is scrolled up after file save #172

Open rafalcwiek opened 2 years ago

rafalcwiek commented 2 years ago

I have LHM installed in vs 2022 I set checkbox: "Automatically insert license headers in new files" I assigned LHM with action: After Project.AddNewItem When I save a file, file view is scrolled up the content. It means that when working with large file, press Ctrl+S my view is jumping up the page. image

MichaelKetting commented 2 years ago

@rafalcwiek I'm sorry to hear that. Unfornately, I can't reproduce this issue on my system. Do you observe this problem when LHM is the only extension in Visual Studio? From the settings you show, it would seem that LHM is only active directly during file creation, not during regular file-save.

rafalcwiek commented 2 years ago

@MichaelKetting Hi. in attached screen there are two actions defined: 1. Before File.SaveSelectedItems and 2. After Project.AddNewItem. I have some other extensions: here is the list image

We could compare VS version image

I thought that it might be related with the fact, that I use ReSharper. But this issue happens when RS is disabled as well.

rafalcwiek commented 2 years ago

I have also noticed that when I press Ctrl+S and then Ctrl+Z, file becomes empty. Like if extension took whole content cleaned it and pasted modified content with header. As a result, when Ctrl+Z pressed. File is empty - it gets back to state before pasting new content with header - which is empty file.

MichaelKetting commented 2 years ago

@rafalcwiek Thanks for pointing out "Before File.SaveSelectedItem". I didn't notice that one in the first screenshot since you didn't add it to the description. Yes, I can confirm that this particular optons is incompatible with LHM, I recommend not using it.

rafalcwiek commented 2 years ago

@MichaelKetting , thanks for quick response. Is there any other option that I can use? I need to update license header when saving file. There might be old version of header and it would be nice to have new one updated on save.

MichaelKetting commented 2 years ago

@rafalcwiek I'm using "After Resharper.ReSharper_SilentCleanupCode" but that's not a save-option. Other than that, I'm sorry, you'll need to look through the list and thry them out. You could also check if there's an obvious problem in the LHM source code causing this problem and create a PR for it.

rafalcwiek commented 2 years ago

@MichaelKetting Thanks for your help :)

rosshjb commented 2 years ago

+1