Skip to content

Commit bda4e0b

Browse files
committed
fix: tooltip not appearing when snippet hints are hovered
1 parent 9cfe206 commit bda4e0b

File tree

1 file changed

+11
-1
lines changed
  • src/extensionsIntegrated/CustomSnippets/src

1 file changed

+11
-1
lines changed

src/extensionsIntegrated/CustomSnippets/src/helper.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@ define(function (require, exports, module) {
129129
.attr("data-val", abbr)
130130
.attr("data-isCustomSnippet", true);
131131

132+
// add the tooltip for the description shown when the hint is hovered
133+
if (description && description.trim() !== "") {
134+
$hint.attr("title", description.trim());
135+
}
136+
132137
// create highlighting for matching characters like other hint providers
133138
if (query && query.length > 0) {
134139
// use the StringMatch to get proper highlighting ranges
@@ -155,7 +160,12 @@ define(function (require, exports, module) {
155160
$hint.append($icon);
156161

157162
if (description && description.trim() !== "") {
158-
const $desc = $(`<span class="snippet-description">${description.trim()}</span>`);
163+
const fullDescription = description.trim();
164+
// truncate description if longer than 70 characters
165+
const displayDescription =
166+
fullDescription.length > 70 ? fullDescription.substring(0, 70) + "..." : fullDescription;
167+
168+
const $desc = $(`<span class="snippet-description">${displayDescription}</span>`);
159169
$hint.append($desc);
160170
}
161171

0 commit comments

Comments
 (0)