Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit 02207d6

Browse files
committed
Adding Type details towards right of the hint token
Styling changes
1 parent 3f58338 commit 02207d6

File tree

2 files changed

+46
-17
lines changed

2 files changed

+46
-17
lines changed

src/extensions/default/JavaScriptCodeHints/main.js

+12-13
Original file line numberDiff line numberDiff line change
@@ -162,46 +162,45 @@ define(function (require, exports, module) {
162162
}
163163

164164
function inferArrayType(typeExpr) {
165-
var type = "[...]";
165+
var type = "[?]";
166166
var types = typeExpr.split('[')[1].split(']')[0].split(',');
167167

168168
_infered = true;
169169

170170
types.every(getInferHelper('string'));
171171
if (_infered) {
172-
type = '[Abc]';
172+
type = '[S]';
173173
} else {
174174
_infered = true;
175175
types.every(getInferHelper('number'));
176176
if (_infered) {
177-
type = '[123]';
177+
type = '[N]';
178178
} else {
179179
_infered = true;
180180
types.every(getInferHelper('Object'));
181181
if (_infered) {
182-
type = '[{ }]';
182+
type = '[{}]';
183183
}
184184
}
185185
}
186-
187186
return type;
188187
}
189188

190189
function getRenderType(type) {
191190
var typeString = " ";
192191
if (type) {
193192
if (type.indexOf('Object') === 0) {
194-
typeString = '{ }';
193+
typeString = '{}';
195194
} else if (type.indexOf('[') === 0) {
196195
typeString = inferArrayType(type);
197196
} else if (type.indexOf('fn') === 0) {
198-
typeString = 'fn( )';
197+
typeString = 'fn';
199198
} else if (type.indexOf('string') === 0) {
200-
typeString = "Abc";
199+
typeString = "S";
201200
} else if (type.indexOf('number') === 0) {
202-
typeString = '123';
201+
typeString = 'N';
203202
} else if (type.indexOf('bool') === 0) {
204-
typeString = 'bool';
203+
typeString = 'B';
205204
}
206205
}
207206
return typeString;
@@ -268,10 +267,10 @@ define(function (require, exports, module) {
268267
});
269268
} else {
270269
$hintObj.text(token.value);
271-
}
272-
273-
$hintObj.data("token", token);
270+
}
274271

272+
$hintObj.data("token", token);
273+
$('<span>' + " " + (token.type || 'keyword').split('->').join(':') + '</span>').appendTo($hintObj).addClass("brackets-js-hints-type-details");
275274
return $hintObj;
276275
});
277276
}

src/extensions/default/JavaScriptCodeHints/styles/brackets-js-hints.css

+34-4
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,45 @@
2222
*/
2323

2424
.brackets-js-hints-type {
25-
width: 30px;
26-
color: cornflowerblue;
25+
font-size: 10px;
26+
width:25px;
27+
color: white;
2728
font-weight: 900;
28-
padding-left: 5px;
2929
text-align: center;
3030
float: left;
31-
box-sizing: border-box;
31+
box-sizing: border-box;
32+
font-style:normal;
33+
padding:0px 0px 0px 6px;
34+
text-shadow:
35+
-1px -1px 0 #8d8d8d,
36+
1px -1px 0 #8d8d8d,
37+
-1px 1px 0 #8d8d8d,
38+
1px 1px 0 #8d8d8d;
39+
}
40+
41+
.highlight .brackets-js-hints-type {
42+
font-size: 13px;
43+
text-shadow:
44+
-1px -1px 0 #6495ed,
45+
1px -1px 0 #6495ed,
46+
-1px 1px 0 #6495ed,
47+
1px 1px 0 #6495ed;
48+
}
49+
50+
.brackets-js-hints-type-details {
51+
color: #d3d3d3;
52+
font-weight: 100;
53+
font-style: italic!important;
54+
padding-left: 10px;
55+
float:right;
56+
margin-left:5px;
57+
}
58+
59+
.highlight .brackets-js-hints-type-details {
60+
color: #0c50af;
3261
}
3362

63+
3464
.brackets-js-hints.priority-high {
3565
color: #486c00; /* green */
3666
}

0 commit comments

Comments
 (0)