Skip to content

Commit

Permalink
devtools: include repl specials into code completion
Browse files Browse the repository at this point in the history
  • Loading branch information
darwin committed Jun 5, 2016
1 parent fbcbd2d commit 123940e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
9 changes: 9 additions & 0 deletions resources/unpacked/devtools/front_end/console/DiracPrompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,13 @@ WebInspector.DiracPromptWithHistory.prototype = {
});
};

const annotateReplSpecials = symbols => {
return symbols.filter(symbol => symbol.startsWith(input)).map(symbol => ({
title: symbol || "?",
className: suggestStyle("suggest-cljs-repl suggest-cljs-special")
}));
};

const localsPromise = dirac.extractScopeInfoFromScopeChainAsync(debuggerModel.selectedCallFrame()).then(extractAndAnnotateLocals);
const currentNamespaceSymbolsPromise = dirac.extractNamespaceSymbolsAsync(this._currentClojureScriptNamespace).then(annotateSymbols.bind(this, "suggest-cljs-in-ns"));
const namespaceNamesPromise = dirac.extractNamespacesAsync().then(extractNamespaceNames).then(annotateNamespaceNames.bind(this, "suggest-cljs-ns"));
Expand All @@ -559,9 +566,11 @@ WebInspector.DiracPromptWithHistory.prototype = {
const macroNamespaceAliasesPromise = currentNamespaceDescriptor.then(annotateAliasesOrRefers.bind(this, "macroNamespaceAliases", "as ", "suggest-ns-alias suggest-cljs-macro"));
const namespaceRefersPromise = currentNamespaceDescriptor.then(annotateAliasesOrRefers.bind(this, "namespaceRefers", "in ", "suggest-refer"));
const macroRefersPromise = currentNamespaceDescriptor.then(annotateAliasesOrRefers.bind(this, "macroRefers", "in ", "suggest-refer suggest-cljs-macro"));
const replSpecialsPromise = dirac.getReplSpecialsAsync().then(annotateReplSpecials);

// order matters here, see _markAliasedCompletions below
const jobs = [
replSpecialsPromise,
localsPromise,
currentNamespaceSymbolsPromise,
namespaceRefersPromise,
Expand Down
15 changes: 10 additions & 5 deletions resources/unpacked/devtools/front_end/externs.js
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ var dirac = {
/**
* @param {Element} textAreaElement
* @param {boolean} useParinfer
* @returns {!CodeMirror}
* @return {!CodeMirror}
*/
adoptPrompt: function(textAreaElement, useParinfer) {},
/**
Expand All @@ -462,25 +462,30 @@ var dirac = {
/**
* @param {string} ns
* @param {string} ext
* @returns {string}
* @return {string}
*/
nsToRelpath: function(ns, ext) {},

/**
* @param {string} name
* @returns {string}
* @return {string}
*/
getFunctionName: function(name) {},

/**
* @param {string} name
* @returns {string}
* @return {string}
*/
getFullFunctionName: function(name) {},

/**
* @return {!Promise.<!Array.<string>>}
*/
getReplSpecialsAsync: function() {},

/**
* @param {string} source
* @returns {?dirac.NamespaceDescriptor}
* @return {?dirac.NamespaceDescriptor}
*/
parseNsFromSource: function(source) {},

Expand Down
8 changes: 8 additions & 0 deletions resources/unpacked/devtools/front_end/ui/suggestBox.css
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@
border-left: 3px solid #aed17d;
}

.suggest-box .suggest-box-content-item.suggest-cljs-special .prologue {
border-left: 3px solid #e6bf73;
}

.suggest-box .suggest-box-content-item.suggest-cljs-ns .prologue::after {
content: "ns";
}
Expand Down Expand Up @@ -173,6 +177,10 @@
content: "refer";
}

.suggest-box .suggest-box-content-item.suggest-cljs-repl .prologue::after {
content: "repl";
}

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

0 comments on commit 123940e

Please sign in to comment.