Skip to content

Allow code intelligence for all tokens in a line

What does this MR do and why?

Related to #438870 (closed)

Currently, if a line has multiple code intelligence tokens, only the very last token will have correct interaction due to a bug in the addInteractionClass method which incorrectly overrides token information when it blindly re-wraps all text in a line every time it is called (every time there's a CI token).

This MR fixes that bug by only re-wrapping a line's text if it hasn't been wrapped yet.

Update 2 files

  • /app/assets/javascripts/code_navigation/utils/index.js
  • /spec/frontend/code_navigation/utils/index_spec.js

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After
image image

How to set up and validate locally

  1. Navigate to https://gitlab.com/scottpledger2005/2024.01-ci-popup-issue/-/blob/main/src/index.ts?ref_type=heads. You can see the bug in action here.
  2. From a GDK-controlled instance, clone and upload the above repo (https://gitlab.com/scottpledger2005/2024.01-ci-popup-issue/). Then check out this branch. Clicking on any token before the last token on any line results in the popup being shown.
Edited by Peter Hegman

Merge request reports