Skip to content

Commit

Permalink
Show the variable path more subtly
Browse files Browse the repository at this point in the history
When showing multiple variables in the tree display, this
makes it easier to scan the display for the value vs the
path.

Bug: #126
  • Loading branch information
cbiesinger committed Jun 22, 2019
1 parent f27fd0c commit b8ca454
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
8 changes: 8 additions & 0 deletions extensions/tree-inspector/field-selector/field-selector.css
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@
display:block;
}

.var-path {
font-style: italic;
}

.var-path-prefix {
color: grey;
}

input.small-input {
font-size:8pt;
margin-right:0.3em;
Expand Down
18 changes: 13 additions & 5 deletions extensions/tree-inspector/field-selector/field-selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ var FieldSelector = (function() {
} else {
this.typeListContainer.appendChild(newTypeContainer);
}

var that = this;
var enabledPaths = this.checkedFields.getEnabledPaths(type);
return Promise.map(enabledPaths, function (path) { return explorer.enableField(path, /*context*/true); })
Expand Down Expand Up @@ -325,17 +325,25 @@ var FieldSelector = (function() {
FieldSelectorController.prototype._createRenderer = function(field) {
function insertFieldList(names, container) {
var fieldList = document.createElement("span");
fieldList.classList.add("var-path");
container.appendChild(fieldList);
fieldList.textContent = names.join(".") + ":";
if (names.length > 1) {
var pathPrefix = names.slice(0, -1);
var pathPrefixList = document.createElement("span");
fieldList.appendChild(pathPrefixList);
pathPrefixList.classList.add("var-path-prefix");
pathPrefixList.textContent = pathPrefix.join(".") + ".";
}
fieldList.appendChild(document.createTextNode(names[names.length - 1] + ":"));
}

return function (dbgObject, element) {
return Promise.resolve(null)
.then(function() {
var valueContainer = document.createElement("span");
return DbgObject.render(
field.getter(dbgObject),
valueContainer,
field.getter(dbgObject),
valueContainer,
function (dbgObject) {
if (dbgObject.type.isArray()) {
return dbgObject.array();
Expand Down Expand Up @@ -524,4 +532,4 @@ var FieldSelector = (function() {

TreeReader: FieldTreeReader
};
})();
})();

0 comments on commit b8ca454

Please sign in to comment.