It would be convenient to read referenced source code lines from issue without opening new tabs.
Proposal
#19480 discusses how to add menu at line anchor to copy permalink.
The permalink could be expanded into code snippet in a post. The snippet that links back to original code location for more context.
It can also be possible to expand non-permalink reference to source code line in a post to permalink and to a snippet. For example, non-permalink referenc.
First of all, thank you for raising an issue to help improve the GitLab product. We're sorry about this, but this particular issue has gone unnoticed for quite some time. To establish order in the GitLab-CE Issue Tracker, we must ensure that every issue is correctly labelled and triaged, to get the proper attention.
This issue will be closed, as it meets the following criteria:
No activity in the past 3 months
Unlabelled
We'd like to ask you to help us out and determine whether this issue should be reopened.
If this issue is reporting a bug, please can you attempt to reproduce on the latest version of GitLab or GitLab.com, to help us to understand whether the bug still needs our attention.
If this issue is proposing a new feature, please can you verify whether the feature proposal is still relevant.
First of all, thank you for raising an issue to help improve the GitLab product. We're sorry about this, but this particular issue has gone unnoticed for quite some time.
We're posting this message because this issue meets the following criteria:
No activity in the past 6 months (since 2018-08-06T04:25:56.074Z)
No milestone (unscheduled)
We'd like to ask you to help us out and determine how we should act on this issue.
If this issue is reporting a bug, please can you attempt to reproduce on the latest version of GitLab or GitLab.com, to help us to understand whether the bug still needs our attention.
If this issue is proposing a new feature, please can you verify whether the feature proposal is still relevant.
Please mention the Triage team (@gitlab-org/triage) for help with applying labels
@mvanremmerden Sorry to ask a question about an old comment, but how is this possible to use for single lines? AFAIK, we don't support inline rendering of code for either single or multiple lines.
It's already been mentioned elsewhere, but I believe this is what the original author is looking for. GitHub has had it for some time (a couple of years, more?):
@perlun You are absolutely correct, the issue scope has significantly changed, you can see that in this update to the description: #22156 (comment 1087344555)
@phikai, any feedback/insights you can give us or point us to the right PM? Sounds like linking to pieces of code and embedding them could be a very useful addition to the issue experience
@nick_vh I'm not quite sure I understand the feedback in that issue and how it relates to this issue. In that issue, it seems to be implied that a link like https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/app/models/ee/project.rb#L338-340 wouldn't work. However, when I click on that, it takes me directly to that line of code.
I think this issue is asking for a typefeature that if you put a link like that in a comment/description, we would automatically render that as a code block in markdown.
I think that's a great idea for a feature, and something I've wanted to do with Snippets when I worked on that category. For this particular issue, I think we can re-label it for source code as that's the likely group that would need to pursue this.
In GitHub when permalink to code is inserted, it refers specific revision, allows to go to the code+revision at this location and also renders the snippet in the current message.
Isn't that what the Permalink option is for at the top of the page? If you need to reference a file at a specific source, you click the Permalink button and then it gives you a permanent reference.
I see what's happening here. So the feature exists but there is confusion how to use it. I suggest we close this issue and continue our discussions here #19480
All SUS-impacting issues need to have a proper severity label set.
Please add a severity label, remove the automation:ux-missing-labels label, and then reply to this comment briefly explaining your reasoning for providing this severity.
If you are not the DRI for this area and would like help determining the best severity, please @ the appropriate person for assistance.
This would still be a workaround as it is copy-pasting the code instead of offering a "native" preview of the code. That's something a bot cannot solve.