Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completion item color is not extracted from documentation property when it is a MarkdownString #174496

Closed
bradlc opened this issue Feb 15, 2023 · 0 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders polish Cleanup and polish issue suggest IntelliSense, Auto Complete ux User experience issues verified Verification succeeded

Comments

@bradlc
Copy link

bradlc commented Feb 15, 2023

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.76.0-insider
  • OS Version: macOS 12.5.1

Steps to Reproduce:

  1. Clone https://github.com/bradlc/vscode-completion-issue
  2. Open the extension in VS Code and run the "Run Extension" task from the "Run and Debug" panel
  3. Create a new untitled file and change the language to "HTML"
  4. Run the Trigger Suggest command or start typing "example" to reveal the "example" completion items
  5. Notice that one of the completion items has a red block and one does not

Expected Behaviour:

Both completion items should display a red block.

Suggested Fix:

When the color extractor checks the documentation property it should account for MarkdownString values:

if (typeof item.completion.documentation === 'string') {
const match = ColorExtractor._regexRelaxed.exec(item.completion.documentation);
if (match && (match.index === 0 || match.index + match[0].length === item.completion.documentation.length)) {
out[0] = match[0];
return true;
}
}

For example the piece of code above could be changed to the following:

if (item.completion.documentation) {
  const documentation = typeof item.completion.documentation === 'string'
    ? item.completion.documentation
    : item.completion.documentation.value;
  const match = ColorExtractor._regexRelaxed.exec(documentation);
  if (match && (match.index === 0 || match.index + match[0].length === documentation.length)) {
    out[0] = match[0];
    return true;
  }
}
@jrieken jrieken added ux User experience issues suggest IntelliSense, Auto Complete labels Feb 20, 2023
@jrieken jrieken added bug Issue identified by VS Code Team member as probable bug polish Cleanup and polish issue labels Dec 5, 2023
@jrieken jrieken added this to the December 2023 milestone Dec 5, 2023
jrieken added a commit that referenced this issue Dec 5, 2023
@jrieken jrieken closed this as completed in a2faf32 Dec 5, 2023
@vscodenpa vscodenpa added unreleased Patch has not yet been released in VS Code Insiders insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Dec 5, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jan 21, 2024
@dbaeumer dbaeumer added the verified Verification succeeded label Jan 25, 2024
@aiday-mar aiday-mar added this to the December / January 2024 milestone Feb 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders polish Cleanup and polish issue suggest IntelliSense, Auto Complete ux User experience issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

5 participants