CodeLink is a free extension for VS Code and JetBrains IDE that you can use to create shareable links for a specific part in the code. You basically select a code snippet in any file in the source code and then generate shareable link to that specific part. The generated link can be shared with anybody. All they have to do is select the platform to jump to the code and that is all.
There are various snippet managers available that allow you to share code with others. But if you want to share location of a certain snippet in a repository so it can be addressed or fixed or patched, then there is no such tool for that. Manually telling filename and line numbers can’t really be a feasible option. In that case, CodeLink comes into the picture. Just highlight the code snippet and generate the link to it. Below, I have explained how it works.
How to Create Links to Specific Parts of Code in VS Code & JetBrains?
Using CodeLink extension is very simple. If you use VS Code, then you can install it by directly searching it in the extensions marketplace. Just find it there and then install it. After it has been installed, you are all set to use it.
Now, you need to open a codebase in VS Code. Make sure that it is connected to the GitHub or some other alternative. You will also have to make sure that all the branches are up-to-date.
Scroll down to the piece of the code for which you want to create a link. Select the snippet and then click on the bulb icon that appears. Now, just click on the Create Link option and then in a couple of seconds, the link will be copied to the clipboard.
The copied link can be shared with anyone. When the person or teammate will open that link at their end, they will be redirected to the CodeLink website. And there they will see 3 options to open the link to code on GitHub, in VS Code, and JetBrains. Click on the VS Code icon to open the link to the exact file and exact code snippet.
In this way, CodeLink can make it very easy to share links to code snippets in any giant repository. No searching and filtering is needed. The generated link will lead you to the exact file and scroll position every single time. This way, you can generate more code links and share them among your team.
Final thoughts:
As a programmer if you often struggle in keeping your team on the same page then this extension might come in handy. With this, you can share exactly what you want in no time. I have tested this on VS Code and it works as it should. But if you are a JetBrains user then I am sure it will work just fine there as well.