Skip to content

Commit c45adde

Browse files
committed
fix: description showing at the side of the snippet instead of bottom
1 parent ad28164 commit c45adde

File tree

2 files changed

+32
-5
lines changed

2 files changed

+32
-5
lines changed

src/extensionsIntegrated/CustomSnippets/src/helper.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ define(function (require, exports, module) {
123123
*/
124124
function createHintItem(abbr, query, description) {
125125
var $hint = $("<span>")
126-
.addClass("brackets-css-hints brackets-hints")
126+
.addClass("brackets-css-hints brackets-hints custom-snippets-hint")
127127
.attr("data-val", abbr)
128128
.attr("data-isCustomSnippet", true);
129129

@@ -148,14 +148,12 @@ define(function (require, exports, module) {
148148
$hint.text(abbr);
149149
}
150150

151-
// style in brackets_patterns_override.less file
152-
// using the same style as the emmet one
151+
// the codehints related style is written in brackets_patterns_override.less file
153152
let $icon = $(`<a href="#" class="custom-snippet-code-hint" style="text-decoration: none">Snippet</a>`);
154153
$hint.append($icon);
155154

156155
if (description && description.trim() !== "") {
157-
// gave this the same class as the jshint-jsdoc to make sure that the styling is consistent
158-
const $desc = $(`<span class="jshint-jsdoc">${description.trim()}</span>`);
156+
const $desc = $(`<span class="snippet-description">${description.trim()}</span>`);
159157
$hint.append($desc);
160158
}
161159

src/styles/brackets_patterns_override.less

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,35 @@ a:focus {
761761
}
762762
}
763763

764+
.custom-snippets-hint {
765+
min-width: 200px !important;
766+
max-width: 350px !important;
767+
display: inline-block !important;
768+
}
769+
770+
.snippet-description {
771+
display: none;
772+
color: grey;
773+
word-wrap: break-word;
774+
white-space: normal;
775+
max-height: 2.2em;
776+
overflow: hidden;
777+
box-sizing: border-box;
778+
text-overflow: ellipsis;
779+
line-height: 1em;
780+
padding-top: 2px !important;
781+
-webkit-line-clamp: 2;
782+
-webkit-box-orient: vertical;
783+
784+
.dark & {
785+
color: #ccc;
786+
}
787+
}
788+
789+
.highlight .snippet-description {
790+
display: block;
791+
}
792+
764793
#codehint-desc {
765794
background: @bc-codehint-desc;
766795
position: absolute;

0 commit comments

Comments
 (0)