gitea icon indicating copy to clipboard operation
gitea copied to clipboard

Add "Clone in VS Codium"-button

Open rdwz opened this issue 2 years ago โ€ข 8 comments

Close #21121

rdwz avatar Sep 09 '22 10:09 rdwz

"The only translation that is maintained in this Git repository is en_US.ini and is synced regularly to Crowdin."

Does this need another PR? I'm not sure what to do at this point, please assist.

rdwz avatar Sep 09 '22 12:09 rdwz

"The only translation that is maintained in this Git repository is en_US.ini and is synced regularly to Crowdin."

Does this need another PR? I'm not sure what to do at this point, please assist.

Hmm, just edit en_US.ini is enough. other translations will be updated by crowdin.

a1012112796 avatar Sep 09 '22 12:09 a1012112796

I don't think this is a meaningful addition. If we add support for more gui tools, a single tool should be selected by each user in their profile settings, and the drop down should just show 'clone with $tool'

/rant (Also why on earth did the codium people use another protocol specifier, if it's basically the same software as vscode, supporting the same protocol? Are we supposed to add buttons for `clone in vim`, `clone in gvim`, `clone in neovim` too?)

noerw avatar Sep 09 '22 15:09 noerw

I don't think this is a meaningful addition. If we add support for more gui tools, a single tool should be selected by each user in their profile settings, and the drop down should just show 'clone with $tool' /rant (Also why on earth did the codium people use another protocol specifier, if it's basically the same software as vscode, supporting the same protocol? Are we supposed to add buttons for clone in vim, clone in gvim, clone in neovim too?)

Related: https://github.com/go-gitea/gitea/issues/21121#issuecomment-1241922657

Perhaps we should have a discussion about how best to do this generically.

jolheiser avatar Sep 09 '22 15:09 jolheiser

Ideally the editors agree on a common URL scheme, or VSCodium is made to support vscode:// URLs imho, the second option should be easy for them I suppose. Do we know their stance?

silverwind avatar Sep 09 '22 16:09 silverwind

Ideally the editors agree on a common URL scheme, or VSCodium is made to support vscode:// URLs imho, the second option should be easy for them I suppose. Do we know their stance?

Also agree to use a generic way, instead of patching for every editor.

For VS Codium:

  • vscodium: Support vscode:// links (or provide an alternate) #933

wxiaoguang avatar Sep 10 '22 05:09 wxiaoguang

Does not look like VSCodium wants to support vscode:// to allow both editors running side-by-side. In this case, I think there is no way around either this PR or some configurability.

silverwind avatar Sep 10 '22 11:09 silverwind

Maybe a button Open in my default editor? Maybe chrome could know the default protocol?

lunny avatar Sep 13 '22 05:09 lunny

Also agree to use a generic way, instead of patching for every editor.

For VS Codium: vscodium: Support vscode:// links (or provide an alternate) : VSCodium/vscodium#933

@ wxiaoguang at comment

i think the more apt and more general one was :

  • this issue: https://github.com/eclipse/openvsx/issues/363 which was opened after closure of following issue ๐Ÿ‘‡
  • comment at: https://github.com/open-vsx/publish-extensions/issues/484#issuecomment-963102764

" Although I am not sure where we should stop then, VSCodium is not a single consumer of Open VSX, neither primary. Why should it be special? Should we allow any fork of VS Code , i.e. Gitpod, openvscode-server, code-sever, any Theia based product? โน‚

goyalyashpal avatar Oct 06 '22 17:10 goyalyashpal

I think showing option for both is best way as at least I use both but on different computers (at work I use vscode because of required dotnet support, on my personal computer I use codium) ๐Ÿ™„ So having to set as user preference would mean either I would have to go to settings to switch all the time that would not be practical or like now deal with the fact that it works only on one computer

lafriks avatar Oct 06 '22 21:10 lafriks

I do not think "adding many options for one purpose" is the right direction.

The purpose for this feature is: open the repo clone link in IDE, while there are a lot of IDEs. Maybe one day, a user may say: "I use Fleet and I want to add a menu item for Fleet", then another user may say "Add a menu item for Zed" and "Add a menu item for Eclipse", then Gitea will have a lot of menu items for various IDEs.

wxiaoguang avatar Oct 07 '22 04:10 wxiaoguang

Ok but these are just theoretical and I don't see having two options now being a problem, just like Gitlab also have two currently

lafriks avatar Oct 07 '22 08:10 lafriks

please revert changes to options/locale/locale_fa-IR.ini and also can svg icon be made square?

lafriks avatar Oct 07 '22 12:10 lafriks

how about using a text input field? the user flow/pseudocode being:

User flow/pseudocode

E.&O.E.

  1. go to any gitea repo (trial repos here)
  2. click the download icon
  3. hover over the vs code for say over 2 seconds
  4. the string "vscode" becomes grayish
  5. click on the string "vscode" when it's gray
  6. this will change it to an input field (with some nice consistent theming)
  7. user enters the code used by the application in that field: for example vscodium and presses enter the code used by various popular applications can be documented at some place for example - the gitea help page
  8. the string is passed through some basic checking
  9. the user entered string replaces the default "VS Code" string in the button and this input is saved in the browser via cookies?
  10. now, on clicking this button in this session, the uri which's triggered is of the format: <inputString>://vscode.git/clone?url=<url>

Benefits:

  • totally flexible no hard coding or catering to any individual application required - as long as the required intent by application fits in the predefined format (like <string>://vscode.git/clone?url=<url> in above example) this method will work
  • minimal the ui is not cluttered with multiple buttons performing same underlying task
  • seemless after entering the code once the user has to enter this only once, it can be saved for later - thereafter for the user - it functions just like a normal one click button

goyalyashpal avatar Oct 08 '22 17:10 goyalyashpal

There would be no benefits to that as what are the chances that there will be third editor with same url structure that vscode and vscodium have? We are discussing right now theoretical future scenarios that might not happen. Let's just add currently both links and think about future scenarios when they actually come

lafriks avatar Oct 09 '22 19:10 lafriks

  • I was thinking that all the vscode based editors will have the same uri structure
  • and there are many already - not just a hypothetical unlikely future possibility.
  • refer my quoting comment above to see the list

Pasting it here too for quick reference:

Should we allow any fork of VS Code , i.e. Gitpod, openvscode-server, code-sever, any Theia based product?

Lauris BH wrote:

what are the chances that there will be third editor with same url structure that vscode and vscodium have?

Message ID: @.***>

goyalyashpal avatar Oct 10 '22 01:10 goyalyashpal

  • I was thinking that all the vscode based editors will have the same uri structure

If it's not hypothetical can you give example of any other code editor url scheme that already exists?

lafriks avatar Oct 10 '22 08:10 lafriks

'm busy currently. 'will research (which mostly consists of waiting for the downloads of different clients to complete) next week and reply accordingly.

Lauris BH wrote:

If it's not hypothetical can you give example of any other code editor url scheme that already exists?

goyalyashpal avatar Oct 11 '22 02:10 goyalyashpal

At least I did not find one

lafriks avatar Oct 11 '22 08:10 lafriks

'm busy currently. 'will research (which mostly consists of waiting for the downloads of different clients to complete) next week and reply accordingly.

i tried but couldn't find. sorry for the delay.

If someone want to try themselves, here's a list i prepared, but didn't got time to try with:

I thought to check from this list

  • but i just couldn't get started ...
  • got stuck up on thinking 'bout how will i get their intent format
  • i.e. i don't know a definitive place to go and get the intent, and got overwhlemed by fear of failure from trials (plus, i don't have enough internet data either)
  • the vscodium one i knew was told by someone else

List took from "Selected Tools based on Eclipse Theia":

  • Mbed Studio https://os.mbed.com/studio/ https://os.mbed.com/docs/mbed-studio/current/source-control/index.html
  • Eclipse Theia Blueprint https://theia-ide.org/docs/blueprint_download
  • VUEngine Studio https://www.vuengine.dev
  • Smartface Mobile App Development https://smartface.io
  • CDT.cloud https://cdt-cloud.io/#features
  • EMF.cloud https://www.eclipse.org/emfcloud/#coffeeeditoroverview

goyalyashpal avatar Oct 25 '22 16:10 goyalyashpal

Take a look at JS code for js-clone-url-vsc. If you have tested and it works, dismiss my review.

  • For VSCodium changed to js-clone-url-vsx
  • Link with correct handler is created.. vscodium://...

rdwz avatar Jan 05 '23 05:01 rdwz

Codecov Report

Merging #21123 (0ff9c48) into main (906d8cc) will decrease coverage by 0.35%. The diff coverage is n/a.

@@            Coverage Diff             @@
##             main   #21123      +/-   ##
==========================================
- Coverage   48.15%   47.80%   -0.36%     
==========================================
  Files        1046     1046              
  Lines      142411   142411              
==========================================
- Hits        68584    68078     -506     
- Misses      65649    66176     +527     
+ Partials     8178     8157      -21     
Impacted Files Coverage ฮ”
models/db/consistency.go 0.00% <0.00%> (-100.00%) :arrow_down:
services/migrations/github.go 0.58% <0.00%> (-63.64%) :arrow_down:
models/db/engine.go 31.16% <0.00%> (-13.64%) :arrow_down:
services/pull/update.go 46.15% <0.00%> (-4.28%) :arrow_down:
modules/notification/mail/mail.go 29.41% <0.00%> (-2.95%) :arrow_down:
models/db/context.go 60.86% <0.00%> (-2.61%) :arrow_down:
services/pull/temp_repo.go 43.22% <0.00%> (-2.59%) :arrow_down:
modules/log/event.go 58.18% <0.00%> (-2.10%) :arrow_down:
services/pull/comment.go 54.62% <0.00%> (-1.86%) :arrow_down:
services/convert/repository.go 92.81% <0.00%> (-1.80%) :arrow_down:
... and 8 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov-commenter avatar Jan 05 '23 05:01 codecov-commenter

Take a look at JS code for js-clone-url-vsc. If you have tested and it works, dismiss my review.

  • For VSCodium changed to js-clone-url-vsx
  • Link with correct handler is created.. vscodium://...

Doesn't this also require JavaScript code changes now?

lafriks avatar Jan 05 '23 09:01 lafriks

Take a look at JS code for js-clone-url-vsc. If you have tested and it works, dismiss my review.

  • For VSCodium changed to js-clone-url-vsx
  • Link with correct handler is created.. vscodium://...

Doesn't this also require JavaScript code changes now?

I just tested with a local build and the links are both (VSC + VSCodium) correct, and I could open a repository on buttom click.

rdwz avatar Jan 08 '23 01:01 rdwz

@wxiaoguang @lafriks

I think something is wrong. Take a look at JS code for js-clone-url-vsc. If you have tested and it works, dismiss my review.

Update: changed.

  • there is clone_script.tmpl, but as I already mentioned all works fine without editing this and I also tested the case of an empty clone_script and it doesn't break the functionality or the generated links.
  • and the file has this comments:

// synchronously set clone button states and urls here to avoid flickering // on page load. initRepoCloneLink calls this when proto changes. // this applies the protocol-dependant clone url to all elements with the // js-clone-url and js-clone-url-vsc classes. // TODO: This localStorage setting should be moved to backend user config // so it's available during rendering, then this inline script can be removed.

to me it seems that it can be removed, but I guess this is another issue and should be discussed seperately?!

rdwz avatar Jan 08 '23 04:01 rdwz

No, it can not be removed at the moment. https://github.com/go-gitea/gitea/issues/22364#issuecomment-1374802413

wxiaoguang avatar Jan 08 '23 11:01 wxiaoguang

I would like to refuse this PR and introduce a personal configuration to set your favourite local IDE/Editor. Then the menu will become your favourite IDE/Editor. Everyone could clone and open the repository with his IDE/Editor. For IDE/Editor configuration, we could hold some default values like Vscodium: vscodium://vscode.git/clone?url=${repo_url}, and VSCode: vscode://vscode.git/clone?url=${repo_url} and users even could create their own editor configuration. i.e. MyEditor: my_editor://my_editor.git/clone?url=${repo_url}.

lunny avatar Jan 09 '23 03:01 lunny

Closing in favor of #22378

lafriks avatar Jan 10 '23 10:01 lafriks

Oh wow this is kinda rude, isn't it? ๐Ÿšฉ

I put so much effort in getting this done, this could have been my very first contribution. This is very demotivating and shure a configurable solution is the logical next step..

But as you are long time contributer and also a owner ๐Ÿซฃ you shure have your reasons or might even don't care at all... https://gitea-open-letter.coding.social/ ๐Ÿšฉ

rdwz avatar Jan 10 '23 14:01 rdwz

Oh wow this is kinda rude, isn't it? ๐Ÿšฉ

I put so much effort in getting this done, this could have been my very first contribution. This is very demotivating and shure a configurable solution is the logical next step..

But as you are long time contributer and also a owner ๐Ÿซฃ you shure have your reasons or might even don't care at all... https://gitea-open-letter.coding.social/ ๐Ÿšฉ

Thanks for your contributions, and we appreciated for your efforts. Could you test #22378 ? I believe it could respect more users' freedom on choosing favorite editors. That's why this PR could be replaced.

lunny avatar Jan 10 '23 14:01 lunny

These things were actually brought up on the same day as the PR was opened. https://github.com/go-gitea/gitea/pull/21123#issuecomment-1242089216

I understand it's frustrating to have your work superseded, and I apologize for not intervening sooner/more persistently.
However, as discussed early on in the PR, a configurable option is the way to avoid a never-ending list like webhooks.

We really do appreciate the work put in to this, though.

jolheiser avatar Jan 10 '23 14:01 jolheiser