Skip to content

Commit

Permalink
devtools: gray out aliased names in completion suggestions box
Browse files Browse the repository at this point in the history
  • Loading branch information
darwin committed May 17, 2016
1 parent d1fc0c7 commit 58f0cd9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
21 changes: 20 additions & 1 deletion resources/unpacked/devtools/front_end/console/DiracPrompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ WebInspector.DiracPromptWithHistory.prototype = {
var locals = this._extractLocalsFromScopeInfo(scopeInfo);
var filteredLocals = locals.filter(item => item.name.startsWith(input));
var annotatedCompletions = filteredLocals.map(item => ({title: item.name || "?",
info: item.identifier,
info: item.identifier?"js/"+item.identifier:undefined,
className: "suggest-cljs-scope"}));
annotatedCompletions.reverse(); // we want to display inner scopes first
return annotatedCompletions;
Expand All @@ -480,6 +480,23 @@ WebInspector.DiracPromptWithHistory.prototype = {
}
},

_markAliasedCompletions: function(annotatedCompletions) {
var previous = null;
for (var i=0; i<annotatedCompletions.length; i++) {
var current = annotatedCompletions[i];

if (previous) {
if (current.title === previous.title) {
if (!current.className) {
current.className = "";
}
current.className += " suggest-aliased";
}
}
previous = current;
}
},

/**
* @param {string} prefix
* @param {boolean} reverse
Expand All @@ -497,6 +514,8 @@ WebInspector.DiracPromptWithHistory.prototype = {
var annotatedCompletions = completions;
annotatedCompletions.sort(function(a, b) { return a.title.localeCompare(b.title); });

this._markAliasedCompletions(annotatedCompletions);

if (!this._waitingForCompletions || !annotatedCompletions.length) {
this.hideSuggestBox();
return;
Expand Down
10 changes: 9 additions & 1 deletion resources/unpacked/devtools/front_end/ui/suggestBox.css
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,18 @@
text-align: right;
}

.suggest-box .suggest-box-content-item.suggest-aliased .prefix {
color: #ccc;
}

.suggest-box .suggest-box-content-item.suggest-aliased .suffix{
color: #ccc;
}

.suggest-box .suggest-box-content-item .info {
font-size: 8px;
float: right;
color: #ccc;
color: #aaf;
padding: 0px 6px;
position: relative;
top: 2px;
Expand Down

0 comments on commit 58f0cd9

Please sign in to comment.