I've never had an issue with GitHub issues regarding linkrot, but it happens quite frequently when linking actual source code, especially code not in your control. Not sure what a better solution is for that, unfortunately.
I generally justify it by the anecdotal observation that the code is generally not being used anymore by the time the link dies out, but that is far from an ideal justification.
- Go to GitHub.com repo and find the file (You can use 't' keyboard shortcut to find it)
- Press 'y' on keyboard to replace 'master' with its SHA1 in the URL
- Click on the interesting line of code
- You have a forever-valid link (assuming no push --force) to the exact line of code
Also, separating these out would let one to design tooling that's more suitable for reading and annotating than editing. When studying code, I'd prefer to do it on a tablet, with an experience closer to a PDF reader than IDE.