Show HN: CodeLink: create links to blocks of code in your IDE

codelink.dev

89 points by rupertdenton 8 days ago

Small team down here in South New Zealand just launched CodeLink. In short its an IDE (VSCode/JetBrains) plugin that lets you share blocks of code that link directly to the code inside your IDE or repo. We use it all the time and think its pretty nifty tech that lets you understand someone’s code in context very quickly. we’re hoping to keep refining it to make it better and more useful.

smcleod 8 days ago

This comes built in to vscode, you right click on any piece of code and select 'copy as github permalink', done.

https://i.imgur.com/hJ1WnZT.png

  • rupertdenton 8 days ago

    Hey, thanks for the comment. Another commenter also shared this plugin, looks interesting! We are trying to really help devs get on the same page fast when sharing code with one another - so the codelinks you can share via CodeLink unfurl in slack (we've got more integrations coming too) and link directly to the code in your repo or IDE. We also integrate with JetBrains which was some feedback we got from our early users.

    Also some other nifty tricks we've built into CodeLink: CodeLink auto loads the lines of code in VS Code, JetBrains, GitHub, GitLab, BitBucket etc. If you don't have the repo locally, it'll check it out for you. If you're not on the right commit/branch it'll swap to it for you. If you share the link on slack, it'll unfurl the snippet there. If you've forgotten where you shared the link, you can click on the "backlinks" and load up the exact thread in Slack where you shared it.

    (Bloody hell should have included this all in OP!!)

    Definitely keen for feedback so appreciate yours, keep it coming!

    • LoganDark 8 days ago

      > If you don't have the repo locally, it'll check it out for you. If you're not on the right commit/branch it'll swap to it for you.

      Does it ask to do this? Checking out a branch is not so simple, maybe I have modified files locally and don't want to stash them right now.

      • rupertdenton 6 days ago

        Yep! It does this. You'll be prompted with a popup to confirm if you want to switch branches. If you don't confirm it won't do anything.

  • maxmcd 8 days ago

    I believe this is added with the "GitHub Pull Requests and Issues" extension.

  • marstall 8 days ago

    jetbrains integration key on our team which is not an editor monoculture ...

    • grahamplace 8 days ago

      This appears to be a Jetbrains equivalent to the aforementioned VSCode plugin (I haven't tried either so can't speak to feature parity):

      https://plugins.jetbrains.com/plugin/17756-copy-git-link

      Edit: I just tried it, works great! Happy to have found this plugin via this post as I often open up Github just to link someone to a particular line of code I'm looking at in my IDE

      • rupertdenton 8 days ago

        That's great! I've shared this feedback with our team and we are really glad you are happy with it. Please do share any more feedback with us if you have any!!

      • marstall 8 days ago

        having one plugin that does both editors is what perked my interest

        • rupertdenton 8 days ago

          Yes! We are really pleased to support JB.

    • rupertdenton 8 days ago

      That's great to hear - we are really pleased to offer integrations with multiple IDEs to support as many devs as possible. If you get a chance to test it out on your JB set up, would love to hear your thoughts.

      • marstall 8 days ago

        was trying to install in webstorm 2021.2.1 on my intel Mac and got this:

        Cannot create class io.codelink.plugins.actions.EstablishConnectionAction

        • rupertdenton 8 days ago

          Hey! Just following up. We tried to recreate your issue but had no luck. We’d love to follow up with you and get this figured out. You can join our community discord and give us a bell: https://discord.gg/EXEuv2Ym

        • rupertdenton 8 days ago

          Hey thanks for letting us know. We are looking into this!

  • waigani 8 days ago

    CodeLink auto loads the lines of code in VS Code, JetBrains, GitHub, GitLab, BitBucket etc

    If you don't have the repo locally, it'll check it out for you. If you're not on the right commit/branch it'll swap to it for you. If you share the link on slack, it'll unfurl the snippet there. If you've forgotten where you shared the link, you can click on the "backlinks" and load up the exact thread in Slack where you shared it. ...

    So, not quite done ;-)

    • leetrout 8 days ago

      Vouched.

      Looks like you might be shadow banned.

LarsDu88 8 days ago

Sorry mate, but this vscode extension does the same thing: https://marketplace.visualstudio.com/items?itemName=hogashi....

but links directly to the code in question, no frills

  • rupertdenton 8 days ago

    Hey! Thanks for sharing this plugin, looks interesting.

    I think a few differences here (I could be wrong as I am not overly familiar with this plugin you have shared). CodeLink lets you manage a list of your links on CodeLink, it has slack integration so the codelinks can be shared directly in slack and unfurl there helping people get on the same page quickly. Also CodeLink integrates with JetBrains.

    Some other cool things CodeLink can do: CodeLink auto loads the lines of code in VS Code, JetBrains, GitHub, GitLab, BitBucket etc. If you don't have the repo locally, it'll check it out for you. If you're not on the right commit/branch it'll swap to it for you. If you share the link on slack, it'll unfurl the snippet there. If you've forgotten where you shared the link, you can click on the "backlinks" and load up the exact thread in Slack where you shared it.

    We're looking to integrate it with Teams and Discord in the near future too! But yeah please do keep the feedback coming.

grantjpowell 8 days ago

If you use the vim fugitive plugin[1], The `:Gbrowse` command [2] will open your browser to github on the correct file/commit. It also works on visually selected ranges, automatically linking to the range in github

[1] https://github.com/tpope/vim-fugitive

[2] https://github.com/tpope/vim-fugitive/blob/master/doc/fugiti...

  • rupertdenton 8 days ago

    Hey! Thanks for the comment. CodeLink also auto loads lines of code seamlessly in VS Code, JetBrains, GitHub, GitLab, BitBucket etc. It also makes it easy if you don't have the repo locally - it'll check it out for you. If you're not on the right commit/branch it'll swap to it for you. It'll also unfurl the code on Slack (more integrations inbound!) and allow people you share it with to open it up in their IDE or VCS! Hopefully makes life easier for our fellow devs :)

speuleralert 8 days ago

I’ve been thinking about something like this for years - super psyched to see a team working on it!

A feature I’d really love is a linked list of these code pointers, so send someone a link to a “flow” where they can step through each code snippet with the spacebar or left/right arrows, with optional accompanying text for each step. I’m imagining onboarding myself or someone else to a massive monorepo, or tracing through a flow scattered across several microservices contained in separate repositories.

  • rupertdenton 8 days ago

    Hey! Thanks again for this - I wanted to pass on some additional comments from our Founder too. He was really interested in your response but was having trouble posting.

    Nice! So you've seen what a CodeLink is. Imagine if that link was a snippet of code embedded in a web doc, like Google Docs or Confluence.

    You could then write a tutorial with snippet blocks that - when clicked - load up the repo and highlight that code in your editor.

    Plot twist, we've built it: CodeNote (www.codenote.dev) - think Notion but for Developers. It works hand in hand with CodeLink.

    We use it to onboard all new devs and for technical design specs etc. We've got a closed Beta group actively using it. If you like, jump on the wait list on the website and we'll get you in the next group.

    Looking forward to seeing you in there and getting your feedback!

  • rupertdenton 8 days ago

    That is awesome feedback. We actually have some features on our roadmap that really align with this. Its great to have it validated here, so thank you for taking the time to respond. We are a small team, but really passionate about making something really helpful!

somada141 6 days ago

Really like it and kudos on launching. Copying GH permalinks to sections of code is something I do about 30 times a day to augment my Slack posts, GH issues, personal notes, Confluence documentation, etc.

I gotta say though, I don't know that I'd trust CodeLink to be around 1-2 years down the track and if it's not then all that work will be far less valuable without the code being accessible through links that will no longer function. I truly hope this project gets traction and becomes a mainstay but until it does I couldn't see myself adopting it.

  • rupertdenton 6 days ago

    Hey, thanks so much for the kudos. This is a solid point. I'm going to talk with the team about prioritising an export function.

    Each CodeNote is essentially a node of links to that code (and conversations about that code) in other places: VCS Hosts, editors, Slack etc. The generated VCS Host and Slack permalinks are not dependant on us. So we can, at least, create a dump of those in short order.

    We use websockets to locate the code in editors, but could easily downgrade these to protocol links (e.g. `vscode:`) that are independent of us also.

    What format would be most useful for the dump to be in? JSON, CSV, markdown ...? I'm thinking JSON just from a data organisation perspective?

    • somada141 5 days ago

      Thanks for the reply! I think any canonical export format would be valuable and would give users some peace of mind :)

MilStdJunkie 8 days ago

I do something like this with Asciidoc's include directive, but including to a tagged region in the source, with the tags in a block comment. The include lives in a code block, so it gets formatted right.

  • rupertdenton 8 days ago

    That's really interesting. How do you find using that process? I haven't seen it in action.

    • MilStdJunkie a day ago

      Sorry for the delay! I made up an example in Python. See also https://docs.asciidoctor.org/asciidoc/latest/directives/incl...

      Asciidoc document:

        // Asciidoc begins
      
        = Test include to code
      
        Here's a paragraph. Let's take a look at a code block plus an include
      
        [source, python]
        ----
        include::loops.py[tag=count]
        ----
      
      Python code filename loops.py

        # Python begins
         
        # // tag::count[]
        count = 0
        # // end::count[]
        while count < 5:
            print(count)
            count += 1  # This is the same as count = count + 1
      
      Output (text) - this is formatted in HTML or PDF as title, para, then a code block

        Test include to code
      
        Here’s a paragraph. Let’s take a look at a code block plus an include
      
        count = 0
jsejcksn 8 days ago

Is Slack the only integration? How about support for other platforms? (e.g. Discord is more popular than Slack) Will you support standardized formats like oembed (https://oembed.com/) so that any platform/service which supports such a format can render the code?

  • rupertdenton 8 days ago

    Thanks so much for the comment. Yes further integrations are definitely on our very near future roadmap, oembed too!

jackconsidine 8 days ago

Whoa this is awesome. To accomplish this currently I do:

- Open up VSCode terminal and git log to get commit hash

- Ctrl + P > Gitlens: Open on remote with (paste hash so the link probably won't die or change as opposed to 'main')

Definitely going to install and check out, it sounds way simpler

  • rupertdenton 8 days ago

    That is awesome to hear, thanks so much. We've also got slack integration so your codelinks unfurl really nicely in Slack (if you use it with your teams/friends/community). We're really keen for feedback so please do share the good and the "needs work" (especially the "needs work" haha)

harryvederci 8 days ago

Looks great, congrats!

Oh and "Codemunication" was a proper dad-level joke, made me chuckle :)

  • rupertdenton 8 days ago

    Thanks haha - yes plenty of dad energy here.

red0point 8 days ago

What do you do about security here?

Isn‘t automatically checking out and opening a repository after clicking a link quite a risky affair? Does it bypass the „do you trust this repo“ screen put up by VSCode?

  • rupertdenton 8 days ago

    Hey there, really important question.

    There's no security risk here. If you don't have the creds to access the repo, there is no way you can check out the code.

    You can try this CodeLink to see how it works: codelink.dev/CKy5YDEZg. The link is to our open demo repo on GitHub. Click open in VS Code or JetBrains and you'll see the prompt in your editor to select a folder to check the code into, it'll then open the file and highlight the lines.