@@ -78,6 +78,12 @@ define(function (require, exports, module) {
78
78
* @type {string }
79
79
*/
80
80
var DYNAMIC_CODEHINT_WITH_TYPE_STYLE_ID = "codehint-with-type-dynamic-width" ;
81
+
82
+ /**
83
+ * @const
84
+ * @type {string }
85
+ */
86
+ var DYNAMIC_CODEHINT_HEIGHT_STYLE_ID = "codehint-dynamic-height" ;
81
87
82
88
/**
83
89
* @const
@@ -124,6 +130,30 @@ define(function (require, exports, module) {
124
130
* @type {number }
125
131
*/
126
132
var DEFAULT_TYPED_HINT_SPAN_WIDTH = 300 ;
133
+
134
+ /**
135
+ * @const
136
+ * @private
137
+ * The default hint menu max-height
138
+ * @type {number }
139
+ */
140
+ var DEFAULT_HINT_MENU_HEIGHT = 160 ;
141
+
142
+ /**
143
+ * @const
144
+ * @private
145
+ * The default hint menu item line height offset
146
+ * @type {number }
147
+ */
148
+ var DEFAULT_HINT_MENU_LINE_HEIGHT_OFFSET = 7 ;
149
+
150
+ /**
151
+ * @const
152
+ * @private
153
+ * The default number of visible menu items
154
+ * @type {number }
155
+ */
156
+ var DEFAULT_VISIBLE_HINT_MENU_ITEMS_COUNT = 8 ;
127
157
128
158
/**
129
159
* @private
@@ -155,7 +185,7 @@ define(function (require, exports, module) {
155
185
_removeDynamicProperty ( propertyID ) ;
156
186
$ ( "head" ) . append ( $style ) ;
157
187
}
158
-
188
+
159
189
/**
160
190
* @private
161
191
* Removes the styles used to update the font size
@@ -164,16 +194,18 @@ define(function (require, exports, module) {
164
194
_removeDynamicProperty ( DYNAMIC_FONT_STYLE_ID ) ;
165
195
_removeDynamicProperty ( DYNAMIC_CODEHINT_FONT_STYLE_ID ) ;
166
196
_removeDynamicProperty ( DYNAMIC_CODEHINT_WITH_TYPE_STYLE_ID ) ;
197
+ _removeDynamicProperty ( DYNAMIC_CODEHINT_HEIGHT_STYLE_ID ) ;
167
198
}
168
199
169
200
/**
170
201
* @private
171
202
* Adds a new embeded style top sync code-hint font size with codeview font size
203
+ * @param {string } fontSize A string with the font size and the size unit
172
204
*/
173
205
function _addDynamicFontSizeForCodeHints ( fontSize ) {
174
206
var styleStr = "" ;
175
207
styleStr = styleStr + StringUtils . format ( "{0}: {1} {2};" , "font-size" , fontSize , " !important" ) ;
176
- styleStr = styleStr + StringUtils . format ( "{0}: {1} {2};" , "line-height" , ( parseInt ( fontSize , 10 ) + 2 ) + fontSize . replace ( parseInt ( fontSize , 10 ) , "" ) , " !important" ) ;
208
+ styleStr = styleStr + StringUtils . format ( "{0}: {1} {2};" , "line-height" , ( parseInt ( fontSize , 10 ) + 5 ) + fontSize . replace ( parseInt ( fontSize , 10 ) , "" ) , " !important" ) ;
177
209
178
210
_addDynamicProperty ( DYNAMIC_CODEHINT_FONT_STYLE_ID , {
179
211
propName : "font-size" ,
@@ -190,6 +222,14 @@ define(function (require, exports, module) {
190
222
ruleName : "span.brackets-js-hints-with-type-details" ,
191
223
ruleText : ""
192
224
} ) ;
225
+
226
+ _addDynamicProperty ( DYNAMIC_CODEHINT_HEIGHT_STYLE_ID , {
227
+ propName : "max-height" ,
228
+ propValue : DEFAULT_VISIBLE_HINT_MENU_ITEMS_COUNT * ( parseInt ( fontSize , 10 ) + DEFAULT_HINT_MENU_LINE_HEIGHT_OFFSET ) + "px" ,
229
+ priorityFlag : true ,
230
+ ruleName : ".codehint-menu .dropdown-menu" ,
231
+ ruleText : ""
232
+ } ) ;
193
233
}
194
234
195
235
/**
0 commit comments