tonka3000 / vscode-qt-tools

Qt tools extension for Visual Studio Code
MIT License
41 stars 10 forks source link

Automatic natvis injection makes it impossible to clean my git workspace #94

Closed tustin2121 closed 3 months ago

tustin2121 commented 3 months ago

Summary

While this extension was enabled, it would insist that the launch.json file be formatted on save, with no setting to turn it off, making it so I could not make my git workspace clean.

Steps to reproduce

I don't know how to reproduce it from scratch, but I do know it was happening, and that it didn't happen with extensions off, and I disabled extensions one by one until I disabled Qt tools and the errant behavior stopped. If I turned Qt tools back on, it wouldn't always reformat it right away. Usually it would inexplicably wait until I turned another extension back on to format launch.json.

What is the current bug behavior?

Every time I would attempt to revert launch.json, it would instantly be returned to its formatted state, removing all of my comments, reindenting everything, and most pressingly, making it impossible for me to make my git workspace clean so I could rebase.

What is the expected correct behavior?

It shouldn't be formatting anything without my permission or command! And if it must, there should be a way to turn it off. I despise when IDEs insist on formatting my code for me. I have all of that turned off.

Relevant logs and/or screenshots

update state of ExtensionManager
inject natvis file into launch.json
update state of ExtensionManager

Possible fixes

Make the natvis injection (which is apparently what it was doing, given the logs, and not just randomly formatting the file) a command instead of automatic. And especially don't make it automatic on save. Barring that, make it a setting I can turn off.

tonka3000 commented 3 months ago

Hi,

You can turn it off via qttools.injectNatvisFile. I just use the VSCode internal API, seems that they reformat per default.

tustin2121 commented 3 months ago

Fair. I didn't see that setting. I only figured out it was natvis injection once I grabbed the logs. I was fighting with it for 30 minutes before that, so I was a bit frustrated. It would make sense that the internal API is just outputting JSON, so it's not gonna save my comments. Sorry.