Git Product home page Git Product logo

gitweblinks's People

Contributors

csm10495 avatar dependabot[bot] avatar ecraig12345 avatar kvart714 avatar reduckted avatar rubengmurray avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gitweblinks's Issues

Built-in WebLink support for VS Code now exists

I'm not sure how long this has been available in VS Code, but I noticed a menu that now that allows you to retrieve the same link made possible by this extension (along with some other nice ones like to master, vscode.dev & markdown):

Screenshot 2022-12-06 at 14 58 18

I think that makes this extension obsolete for users of Github repositories & VS Code using at least 1.73.1?

Link to rendered GitHub files should include `?plain=1`

From Parameter to disable markdown rendering, GitHub introduced a new URL parameter on June 30, 2021:

Appending ?plain=1 to the url for any Markdown file will now display the file without rendering. As with other code files, it will also show line numbers, and can be used to link other users to a specific line or lines. For example, appending ?plain=1#L52 will highlight line 52 of a plain text Markdown file.

It would be great if links to selection in markdown files could use plain=1, since otherwise they will have no effect.

Feature request: inverse operation, start with a GitHub URL which contains hash line number(s), and open the file in VSCode at the designated line / code selection

Hello, great extension, thank you!
Very useful for code peer reviews over Slack / instant messaging, to exchange URLs whilst working locally from VSCode.
However the inverse functionality would be very useful too.

For example I would like to be able to copy such URL: https://github.com/reduckted/vscode-gitweblinks/blob/1244479c00a2192e6100f49296fd97f92bb8e4e5/src/utilities/ServerUrl.ts#L2-L4

https://github.com/reduckted/vscode-gitweblinks/blob/1244479c00a2192e6100f49296fd97f92bb8e4e5/src/utilities/ServerUrl.ts#L2-L4

...and to show src/utilities/ServerUrl.ts in VSCode with the code selection line 2-4 (extracted from the URL #L2-L4).

Any thoughts?

Not tracked files in v2.1.0.

After last update to v2.1.0.

Message for all files: The file 'file:///home/…file.json' is not tracked by Git. Everything worked well before.

URL settings have been updated from baseUrl/sshUrl to http/ssh:

"gitweblinks.gitLabEnterprise": [
  {
    "http": "https://git.example.ru/reps/rep1",
    "ssh": "[email protected]/rep1.git"
  }
],

Support multi repo workspace

Unless I'm missing something, this plugin doesn't work when the VSCode workspace encompasses multiple repositories. In my case, I have one workspace (~/code), that has many subdirectories each of which contains their own git repository.

[11:52:38.032] Could not find the root directory of the Git repository.
[11:52:38.032] Could not find Git info for path '/Users/npastor/code'.

I assume the extension is just looking in that workspace root for a git repo. Would it be hard to traverse up (or down) the the directory tree to find a git repo?

Quick link opening

I use the extension every day. But almost always, when I copy a link, I want to open my browser and paste this to open it.
I added 'Open in Web' button when copying

Pull request

maybe add an 'open/copy' option to the settings?

Server URI is not a valid URI

GitHub Enterprise Server URI is not a valid URI: [UriError]: Scheme is missing: {scheme: "", authority: "", path: "git.drillinginfo.com", query: "", fragment: ""}
  "gitweblinks.gitHubEnterprise": [
    {
      "http": "https://git.drillinginfo.com",
    }
  ],

Broken extension: Missing link in right-click menu; Cmd+Shift+P produces workspace error.

Copy Web Link To File has completely disappeared from my right-click menu in VS Code (first noticed 2/3 weeks ago).

Reading through https://marketplace.visualstudio.com/items?itemName=reduckted.vscode-gitweblinks I noticed you can also use the extension via the Command Palette, but when I try and execute any of the commands listed I get a workspace error

The workspace at 'file:///Users/my_user/dev/ruben' is not tracked by Git.

I might use workspaces in a different way to others, but I usually have a big folder open as the root of the workspace (e.g. work) which contains a lot of individual repos (e.g. work/user-microservice, work/some-other-microservice ).

This seemed to pose no issues up until a few weeks ago.

The error reads as if the extension is no longer looking through the directories to find the .git folder closest to the file I'm trying to create a link for, instead it just looks into the root of the workspace folder and errors. I'm presuming this is the same reason the option has disappeared from the menu.

Git Web Links For VS Code:
2.0.0 (2020-12-30)
(looks like a version was released that co-incided with my issue, time-wise)

VS Code:

Version: 1.52.1
Commit: ea3859d4ba2f3e577a159bc91e3074c5d85c0523
Date: 2020-12-16T16:30:02.420Z
Electron: 9.3.5
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Darwin x64 18.7.0

Azure DevOps Server

Please, add support of custom url for Azure DevOps|

Url examples:
file:
https://{custom.site.net}/tfs/DefaultCollection/{project}/_git/{repository}?path=%2FConfig%2FWebApplications&version=GBdevelop

selection:
https://{custom.site.net}/tfs/DefaultCollection/{project}/_git/{repository}?path=%2FConfig%2FWebApplications%2Freadme.txt&version=GBdevelop&line=1&lineEnd=1&lineStartColumn=14&lineEndColumn=23&lineStyle=plain

Link gives 404 even when user is signed-in to GitHub

Expected behavior

If a user is …

  • signed-in to GitHub
  • has access to a private repo

… then you can:

  1. right click in VSCode on a line of code in that private repo you have access to
  2. click Copy Web Link to Selection
  3. paste that link in the browser
  4. see the line of code in your GitHub tab

Actual behavior

In the .gif below you'll see I am a user who …

  • signed-in to GitHub
  • have access to my private repo (proven here by showing side-by-side of the GitHub code tab + VSCode code file)

then I …

  1. right click in VSCode on a line of code in my repo
  2. click Copy Web Link to Selection
  3. paste that link in the browser
  4. get a 404 error

bug report showing 404 error

to confirm this isn't an access issue, afterward I:

  1. navigate to the same code file using the GitHub web UI
  2. copy the permalink using a vanilla UI element Copy permalink
  3. paste that link in a new tab, which works (no 404 error)

To reproduce

Steps to reproduce the behavior:

  1. Confirm you are signed-in to GitHub and you have access to some repo A with code file B
  2. right click in VSCode on a line of code in code file B
  3. click Copy Web Link to Selection
  4. paste that link in the browser
  5. get a 404 error
  6. now for comparison navigate to the Code tab in GitHub for repo A
  7. search manually for code file B to confirm it exists and you can access it

Feature request: Short SHA Links

It would be awesome to (optionally?) shorten the links pointing at specific commits by using the --short option on git rev-parse.
See https://git-scm.com/docs/git-rev-parse#Documentation/git-rev-parse.txt---shortlength

Here's a link with a full SHA as currently generated:

return (await git(repository.root, 'rev-parse', 'HEAD')).trim();

The same link again but with a short SHA:
https://github.com/reduckted/GitWebLinks/blob/3cb46c/vscode/src/link-handler.ts#L273

So It looks like GH's preview feature only works with full SHAs, but it's still nice to have the short one to send to humans or to link in code.

Use from command palette / keyboardshortcut

When I select the gitweblinks.copySelection or gitweblinks.copyFile actions in the command palette (shift+cmd+p) nothing happens. I bound gitweblinks.copySelection to a keyboard shortcut and that doesn't work either. I'm on MacOS Catalina.

In the meantime this extension works great via right click, thanks for sharing it.

VSCode version:

Version: 1.42.0
Commit: ae08d5460b5a45169385ff3fd44208f431992451
Date: 2020-02-06T10:51:33.119Z
Electron: 6.1.6
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Darwin x64 19.3.0

Change default remote

I downloaded the plugin yesterday and I'm excited about it, because I like to send code links. This simplifies my process a lot. Thanks for developing!

I see that origin is picked as the default remote [1]. And this seems like a good decision given how git is typically used. But in repositories with more than one remote, it would be nice to have a way of picking a repository.

A minimal (but maybe not very) way of supporting this would be to pick with the highest priority a remote name like GitWebLinks. Then, the user can just add that additional remote to the repository and decide for every repository which remote should be used by default. Of course, other more configurable options would be nice. But maybe this suggestion is suited best for a quick upgrade.

[1]

remote = remotes.filter((x) => x.name === 'origin')[0];

GitLab and GitLab Enterprise

I forked and added a feature for adding GitLab and GLE. I can create a PR, but it would probably be just as easy for you to add. All that I did was copy the GitHubHandler and change the multiline selection code from #L1-L5 to #L1-5.

Let me know if you'd prefer that I submitted a PR.

[Tests] lots of tests fail (104) comparing `master` to `main`

Looks like a change in the default branch is causing many tests to fail.. as an example:

  93) Link handlers
       Visual Studio Team Services
         createUrl
           ssh with protocol:

      Link does not match the expected result
      + expected - actual

      -https://foo.visualstudio.com/_git/bar?path=%2Fsrc%2Ffile.txt&version=GBmain
      +https://foo.visualstudio.com/_git/bar?path=%2Fsrc%2Ffile.txt&version=GBmaster
      
        at /Users/reecedaniels/dev/general/_OPEN-SOURCE-REPOS/GitWebLinks/vscode/out-test/test/handlers.test.js:174:96
        at Generator.next (<anonymous>)
        at fulfilled (out-test/test/handlers.test.js:5:58)

I have 104 failures locally

request supports for workspace settings

is is possible to add supporting for vscode workspace setting support, by this feature, we are able to sync repository config between team members, to avoid telling everyone how to config the plugin.

Incorrect link format for remote URLs containing username

First of all, thank you very much for creating this super-useful extension!

I think the situations are not uncommon when a person can have more than one GitHub account - there can be several accounts for work and at least one personal.

To allow SSH find the right key for the account used for the repo, the remote URL must contain the username. In other words, in the local git config the URL is written like so:

[remote "origin"]
  url = [email protected]:account_name/repo.git

But when Git Web Links creates a link, I believe it mistakenly includes the username:

https://github.com/-username:account_name/repo/blob/123abc/path/to/file.rb#L123

A correct link will not contain the username:

https://github.com/account_name/repo/blob/123abc/path/to/file.rb#L123

Do you think it's possible to fix this?

Extra character "-" in generated link to private repo makes URL 404

When I generate link to my private GitLab repo with "Copy Web Link to File", there is extra "-" character between repo name and "blob", which makes URL 404. Of course, I can manually delete "-".

Example:

https://gitlab2.ams.creativecdn.net/ai-lab/incrementality-suite/-/blob/master/package.json

should be:

https://gitlab2.ams.creativecdn.net/ai-lab/incrementality-suite/blob/master/package.json

--

I use below settings.json:

"gitweblinks.gitLabEnterprise": [
    {
        "baseUrl": "https://gitlab2.ams.creativecdn.net",
        "sshUrl": "[email protected]"
    }
]

Fails to copy link from non-root directory

It successfully copies a link to /.../project/file.md but fails to work with /.../project/subdir/file.md with error The repository /.../project/subdir does not have any remotes

What could be the reason?

This workspace is not tracked by Git

I'm getting a This workspace is not tracked by Git. (it is). What can I do to fix/debug this? VS Code's native Git integration and Git Lens work without any issue.

Here is some portions of the (git repo root)/.editor/.code-workspace file that might be relevant:

{
    "folders": [
        {
            "path": ".."
        }
    ],
        (...)
        "search.exclude": {
            "**/.git/**": true,
            (...)
        },
        "search.followSymlinks": false,
        "files.watcherExclude": {
            "**/.git/**": true,
            (...)
        }
    },
    (...)
}

Doesn't work with Git worktrees

If I open the root folder of a Git worktree in VS Code, open a file, and try to use any of the commands to copy a link, I get an error The workspace at 'file:///Users/me/git/my-repo-worktree' is not tracked by Git. The commands work fine in the main local copy of the same repo.

Worktrees are implemented with a .git file which points to the the actual directory:

/my-repo-worktree
  .git            file with contents: 
                  gitdir: /(actual path here)/my-repo/.git/worktrees/my-repo-worktree

/my-repo
  .git/
    worktrees/
      my-repo-worktree/
        (normal .git folder stuff)

So this line ought to allow .git to be either a file or directory.
https://github.com/reduckted/vscode-gitweblinks/blob/d7bc2db7102f07032f5af2262bfd83942fdb86c4/src/repository-finder.ts#L64

Then if all you're doing is running git commands, that can be done from the root of the worktree. (Only need to bother with looking in my-repo/.git/worktrees/my-repo-worktree/ if you need to dig into the .git folder contents, which I'd guess isn't needed?)

Special characters in file name should be encoded

Environment

  • macOS 11.4
  • VSCode 1.58.0
  • Git Web Links for VSCode 2.5.1

Expected behavior

There is a file with a name like the sample.json#etc.
The generated url for the file should be https://github.com/user/repo/blob/commit/sample.json%23etc.
This # is part of the filename, not a URL fragment, so it should be encoded.

Actual behavior

The generated url for the file is https://github.com/user/repo/blob/commit/sample.json#etc.
Therefore, it will not work as a correct link.

Note

Other characters that can be used in file names and are special in URLs (such as ? etc.) are not encoded as well.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.