Add in-code documentation anchors
<!-- The first section "Release notes" is required if you want to have your release post blog MR auto generated. Currently in BETA, details on the **release post item generator** can be found in the handbook: https://about.gitlab.com/handbook/marketing/blog/release-posts/#release-post-item-generator and this video: https://www.youtube.com/watch?v=rfn9ebgTwKg. The next four sections: "Problem to solve", "Intended users", "User experience goal", and "Proposal", are strongly recommended in your first draft, while the rest of the sections can be filled out during the problem validation or breakdown phase. However, keep in mind that providing complete and relevant information early helps our product team validate the problem and start working on a solution. --> ### Release notes Add in-code documentation anchors that are linkable <!-- What is the problem and solution you're proposing? This content sets the overall vision for the feature and serves as the release notes that will populate in various places, including the [release post blog](https://about.gitlab.com/releases/categories/releases/) and [Gitlab project releases](https://gitlab.com/gitlab-org/gitlab/-/releases). " --> ### Problem to solve Currently it's impossible to add a link inside of code that has any stickiness. Over time code will move around making any external documentation references impossible to maintain. What we'd like to see is some form of anchors that can be linked from code that is part of a comment within any language (java being the immediate target). The code would look like this: ### Intended users Delaney,Sam - used to align service patterns for all similar code through the company. We need a way to make this viable where it connects an Architectural Pattern from a doc source (i.e. a wiki) directly to the pattern in code. In this case Delaney & Sam are constantly working to flush out patterns that should be used for common pieces of code. These patterns will evolve over time. They want to ensure that the patterns are written in a very tight, closed loop way, where the design/architecture/best practices are fully flushed out and connect to rich code examples. Ultimately they want to ensure that the implementors / maintainers of the code are using the best-practices. AND Sasha,Simone,Devon - used by individual contributors to ensure that new pieces code use the approved patterns for the organization. This ensures that the code fits with the architecture and that the implementors use a proven model rather than re-inventing the wheel. By connecting the patterns directly to the code-base where it is implemented this ensures that it is easy to decipher the implementation of the pattern and not leave things up to interpretation. ### User experience goal ``` public class Foo { /** * #external-anchor:FooRunIt */ public void runIt() { ... ... // #external-anchor:FooRunItRunSomethingOfSubstance runSomethingOfSubstance(); ... ... } } ``` After this code is merged to gitlab it would then be linkable via something like https://gitlab/group/project/com/example/Foo#FooRunIt and https://gitlab/group/project/com/example/Foo#FooRunItRunSomethingOfSubstance ### Proposal Analyze all files checked into gitlab to allow for anchors to be easily linkable. These can be stored or they can be on the fly. ### Further details Benefits discussed with personas ### Permissions and Security Anyone who can commit code should be able to add anchors. Permissions do not change otherwise. ### Documentation <!-- See the Feature Change Documentation Workflow https://docs.gitlab.com/ee/development/documentation/workflow.html#for-a-product-change * Add all known Documentation Requirements in this section. See https://docs.gitlab.com/ee/development/documentation/workflow.html * If this feature requires changing permissions, update the permissions document. See https://docs.gitlab.com/ee/user/permissions.html --> ### Availability & Testing <!-- This section needs to be retained and filled in during the workflow planning breakdown phase of this feature proposal, if not earlier. What risks does this change pose to our availability? How might it affect the quality of the product? What additional test coverage or changes to tests will be needed? Will it require cross-browser testing? Please list the test areas (unit, integration and end-to-end) that needs to be added or updated to ensure that this feature will work as intended. Please use the list below as guidance. * Unit test changes * Integration test changes * End-to-end test change See the test engineering planning process and reach out to your counterpart Software Engineer in Test for assistance: https://about.gitlab.com/handbook/engineering/quality/test-engineering/#test-planning --> ### Available Tier Free ### What does success look like, and how can we measure that? Anchors within the code base to be linkable in a browser. ### What is the type of buyer? This is a feature within the existing offering ### Is this a cross-stage feature? <!-- Communicate if this change will affect multiple Stage Groups or product areas. We recommend always start with the assumption that a feature request will have an impact into another Group. Loop in the most relevant PM and Product Designer from that Group to provide strategic support to help align the Group's broader plan and vision, as well as to avoid UX and technical debt. https://about.gitlab.com/handbook/product/#cross-stage-features --> ### Links / references <!-- Label reminders - you should have one of each of the following labels. Use the following resources to find the appropriate labels: - https://gitlab.com/gitlab-org/gitlab/-/labels - https://about.gitlab.com/handbook/product/categories/features/ -->
issue