Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to clone repository in VSCodium #21123

Closed
wants to merge 21 commits into from
Closed

Add option to clone repository in VSCodium #21123

wants to merge 21 commits into from

Conversation

rdwz
Copy link

@rdwz rdwz commented Sep 9, 2022

🤐

Copy link
Member

@a1012112796 a1012112796 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hello, please commit translations on crowdin, thanks!
ref: https://github.com/go-gitea/gitea/blob/main/CONTRIBUTING.md#translation

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Sep 9, 2022
@a1012112796
Copy link
Member

"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 a1012112796 added the topic/ui Change the appearance of the Gitea UI label Sep 9, 2022
@noerw
Copy link
Member

noerw commented Sep 9, 2022

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?)

@jolheiser
Copy link
Member

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: #21121 (comment)

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

@6543 6543 changed the title Add "Clone in VS Codium"-button #21121 Add "Clone in VS Codium"-button Sep 9, 2022
Copy link
Member

@6543 6543 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also use codium ...

... but we need a generic way

@silverwind
Copy link
Member

silverwind commented Sep 9, 2022

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?

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Sep 10, 2022

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

@silverwind
Copy link
Member

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.

@lunny
Copy link
Member

lunny commented Sep 13, 2022

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

@goyalyashpal
Copy link

goyalyashpal commented Oct 6, 2022

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 :

"
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?

@lafriks
Copy link
Member

lafriks commented Oct 6, 2022

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

@wxiaoguang
Copy link
Contributor

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.

@lafriks
Copy link
Member

lafriks commented Oct 7, 2022

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

Remove all translations except en-US
@lafriks
Copy link
Member

lafriks commented Oct 7, 2022

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

@KN4CK3R KN4CK3R mentioned this pull request Oct 7, 2022
@goyalyashpal
Copy link

goyalyashpal commented Oct 8, 2022

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

@lafriks
Copy link
Member

lafriks commented Oct 9, 2022

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

@goyalyashpal
Copy link

goyalyashpal commented Oct 10, 2022 via email

@lafriks
Copy link
Member

lafriks commented Oct 10, 2022

  • 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?

@goyalyashpal
Copy link

goyalyashpal commented Oct 11, 2022 via email

@lafriks
Copy link
Member

lafriks commented Oct 11, 2022

At least I did not find one

@goyalyashpal
Copy link

goyalyashpal commented Oct 25, 2022

'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":

@rdwz
Copy link
Author

rdwz commented Jan 5, 2023

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 rdwz requested review from wxiaoguang and removed request for zeripath January 5, 2023 05:02
@codecov-commenter

This comment was marked as outdated.

@lafriks
Copy link
Member

lafriks commented Jan 5, 2023

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?

@rdwz
Copy link
Author

rdwz commented Jan 8, 2023

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.

@wxiaoguang wxiaoguang dismissed their stale review January 8, 2023 02:27

dismiss old review

@rdwz
Copy link
Author

rdwz commented Jan 8, 2023

@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?!

@wxiaoguang
Copy link
Contributor

No, it can not be removed at the moment. #22364 (comment)

@lunny
Copy link
Member

lunny commented Jan 9, 2023

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}.

@lafriks
Copy link
Member

lafriks commented Jan 10, 2023

Closing in favor of #22378

@lafriks lafriks closed this Jan 10, 2023
@lunny lunny removed this from the 1.19.0 milestone Jan 10, 2023
@rdwz
Copy link
Author

rdwz commented Jan 10, 2023

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/ 🚩

@lunny
Copy link
Member

lunny commented Jan 10, 2023

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.

@jolheiser
Copy link
Member

These things were actually brought up on the same day as the PR was opened.
#21123 (comment)

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.

@goyalyashpal
Copy link

These things were actually brought up on the same day as the PR was opened.

  • yeah, 6 people (including me) noerw, jolheiser, 6543, wxiaoguang, lunny mentioned requirement of generic way, ...
  • before lafriks single handedly pushed for this one.
  • Were the decision made right then, the author's additonal efforts would have been saved. As only one additional commit was made till then.

@lafriks
Copy link
Member

lafriks commented Jan 11, 2023

Personally I would not minded also for this to be non-generic way as in this PR as I don't see much problem on having menu having even 7 menu items always as it's still just dropdown. But I don't mind also generic way as long as I have option to get my workflow done :)

@goyalyashpal
Copy link

goyalyashpal commented Jan 19, 2023

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?
- #21123 (comment)

I would like to clarify on this, as this may pop up in minds of other people too. Sorry for the "necro bump" i guess?

  • It's actually necessary that they use a different protocol than the one used by a competing product of some giant heavy handed conglomerate ...
  • ... which is known to push its own product in the "default apps" settings list and keeps making it difficult for people to choose the alternatives (yes, many people do have both vscodium and vscode installed on their system)
  • resetting PDF application to their BROWSER on windows update. Ref: Microsoft Edge keeps "hijacking" PDFs? sumatrapdfreader/sumatrapdf#2707 (comment)
  • So, yeah, having a different one is a good thing when the alternate is a big company, which's not the case in mentioned situation with neo/vi/m

@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/need 1 This PR needs approval from one additional maintainer to be merged. topic/ui Change the appearance of the Gitea UI type/feature Completely new functionality. Can only be merged if feature freeze is not active.
Projects
None yet
Development

Successfully merging this pull request may close these issues.