intersystems-community / vscode-objectscript

InterSystems ObjectScript extension for Visual Studio Code
https://docs.intersystems.com/components/csp/docbook/DocBook.UI.Page.cls?KEY=GVSCO
Other
108 stars 49 forks source link

Support for Git Feature Branching #1454

Open TwaHendrik opened 2 days ago

TwaHendrik commented 2 days ago

We have noticed that a switch between two branches leads to a code change in the workspace. However, the change is not automatically forwarded to the IRIS instance. This leads to an inconsistent state. It would be great if the workspace was the only place of truth. This would enable code reviews and later deployment via CI/CD.

isc-bsaviano commented 2 days ago

Thanks for opening this issue @TwaHendrik! I believe this issue a duplicate of #1451 (see https://github.com/intersystems-community/vscode-objectscript/issues/1451#issuecomment-2422451598).

isc-bsaviano commented 1 day ago

@TwaHendrik After thinking about this more, I'm a little concerned that implementing this could have some unintended consequences. The VS Code API for watching the file system does not batch events, so if you have a lot of classes and routines in your git repo the server will be hammered with a lot of requests. VS Code will also only be able to sync changes that happen when it's open, so if you change branches and then open VS Code the changes wouldn't be synced automatically. I still am generally in favor of this idea, but I'd like to think about it more before adding it to that existing PR.

cc @gjsjohnmurray @isc-rsingh

isc-rsingh commented 1 day ago

I don't think there's a good answer here. Sounds like the only way this works elegantly is if you change branches from within VS Code. Is it true that changing branches via a CLI wouldn't work whether or not VS Code is open? And even if you change branches in VS Code you trigger all those requests to the server. I fear this feature could be impossible to get right.

isc-bsaviano commented 1 day ago

@isc-rsingh If VS Code has the folder open I can respond to file system events, even if they originate from the git CLI and not the VS Code UI. I need to do more research on what git does when you switch branches. For example, if there are 1000 files and only 1 changes content when you switch branches, does 1 file system event get fired, or 1000? If the former then this could work fine. If the latter, not so much.

isc-bsaviano commented 1 day ago

This wouldn't be git specific by the way. Changes that happen to the files on disk triggered by any application would be picked up by VS Code.

isc-rsingh commented 21 hours ago

if there are 1000 files and only 1 changes content when you switch branches, does 1 file system event get fired, or 1000?

Exactly what I was wondering

isc-bsaviano commented 7 hours ago

@isc-rsingh I did a quick test and git only changes the files that it has to. In the example above, only one change event would fire, not 1000. I can't guarantee that other SCM tools/tools in general behave this way, but this increases my confidence that this feature is worth implementing.

isc-rsingh commented 7 hours ago

Agreed

regards, Raj

Raj Singh | PM, Developer Experience | InterSystems https://www.intersystems.com/developing-with-intersystems-iris/


From: Brett Saviano @.> Sent: Thursday, October 31, 2024 8:41:38 AM To: intersystems-community/vscode-objectscript @.> Cc: Raj Singh @.>; Mention @.> Subject: Re: [intersystems-community/vscode-objectscript] Support for Git Feature Branching (Issue #1454)

@isc-rsinghhttps://github.com/isc-rsingh I did a quick test and git only changes the files that it has to. In the example above, only one change event would fire, not 1000. I can't guarantee that other SCM tools/tools in general behave this way, but this increases my confidence that this feature is worth implementing.

— Reply to this email directly, view it on GitHubhttps://github.com/intersystems-community/vscode-objectscript/issues/1454#issuecomment-2449753088, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA4YC5YQZJPV7W5MO2OFS4LZ6IQQFAVCNFSM6AAAAABQZRE43WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINBZG42TGMBYHA. You are receiving this because you were mentioned.Message ID: @.***>