_id
stringlengths 2
6
| title
stringlengths 0
58
| partition
stringclasses 3
values | text
stringlengths 52
373k
| language
stringclasses 1
value | meta_information
dict |
|---|---|---|---|---|---|
q17100
|
_findMatchingRulesInCSSFiles
|
train
|
function _findMatchingRulesInCSSFiles(selector, resultSelectors) {
var result = new $.Deferred();
// Load one CSS file and search its contents
function _loadFileAndScan(fullPath, selector) {
var oneFileResult = new $.Deferred();
DocumentManager.getDocumentForPath(fullPath)
.done(function (doc) {
// Find all matching rules for the given CSS file's content, and add them to the
// overall search result
var oneCSSFileMatches = _findAllMatchingSelectorsInText(doc.getText(), selector, doc.getLanguage().getMode());
_addSelectorsToResults(resultSelectors, oneCSSFileMatches, doc, 0);
oneFileResult.resolve();
})
.fail(function (error) {
console.warn("Unable to read " + fullPath + " during CSS rule search:", error);
oneFileResult.resolve(); // still resolve, so the overall result doesn't reject
});
return oneFileResult.promise();
}
ProjectManager.getAllFiles(ProjectManager.getLanguageFilter(["css", "less", "scss"]))
.done(function (cssFiles) {
// Load index of all CSS files; then process each CSS file in turn (see above)
Async.doInParallel(cssFiles, function (fileInfo, number) {
return _loadFileAndScan(fileInfo.fullPath, selector);
})
.then(result.resolve, result.reject);
});
return result.promise();
}
|
javascript
|
{
"resource": ""
}
|
q17101
|
_loadFileAndScan
|
train
|
function _loadFileAndScan(fullPath, selector) {
var oneFileResult = new $.Deferred();
DocumentManager.getDocumentForPath(fullPath)
.done(function (doc) {
// Find all matching rules for the given CSS file's content, and add them to the
// overall search result
var oneCSSFileMatches = _findAllMatchingSelectorsInText(doc.getText(), selector, doc.getLanguage().getMode());
_addSelectorsToResults(resultSelectors, oneCSSFileMatches, doc, 0);
oneFileResult.resolve();
})
.fail(function (error) {
console.warn("Unable to read " + fullPath + " during CSS rule search:", error);
oneFileResult.resolve(); // still resolve, so the overall result doesn't reject
});
return oneFileResult.promise();
}
|
javascript
|
{
"resource": ""
}
|
q17102
|
_parseSelector
|
train
|
function _parseSelector(ctx) {
var selector = "";
// Skip over {
TokenUtils.movePrevToken(ctx);
while (true) {
if (ctx.token.type !== "comment") {
// Stop once we've reached a {, }, or ;
if (/[\{\}\;]/.test(ctx.token.string)) {
break;
}
// Stop once we've reached a <style ...> tag
if (ctx.token.string === "style" && ctx.token.type === "tag") {
// Remove everything up to end-of-tag from selector
var eotIndex = selector.indexOf(">");
if (eotIndex !== -1) {
selector = selector.substring(eotIndex + 1);
}
break;
}
selector = ctx.token.string + selector;
}
if (!TokenUtils.movePrevToken(ctx)) {
break;
}
}
return selector;
}
|
javascript
|
{
"resource": ""
}
|
q17103
|
extractAllNamedFlows
|
train
|
function extractAllNamedFlows(text) {
var namedFlowRegEx = /(?:flow\-(into|from)\:\s*)([\w\-]+)(?:\s*;)/gi,
result = [],
names = {},
thisMatch;
// Reduce the content so that matches
// inside strings and comments are ignored
text = reduceStyleSheetForRegExParsing(text);
// Find the first match
thisMatch = namedFlowRegEx.exec(text);
// Iterate over the matches and add them to result
while (thisMatch) {
var thisName = thisMatch[2];
if (IGNORED_FLOW_NAMES.indexOf(thisName) === -1 && !names.hasOwnProperty(thisName)) {
names[thisName] = result.push(thisName);
}
thisMatch = namedFlowRegEx.exec(text);
}
return result;
}
|
javascript
|
{
"resource": ""
}
|
q17104
|
ChangedDocumentTracker
|
train
|
function ChangedDocumentTracker() {
var self = this;
this._changedPaths = {};
this._windowFocus = true;
this._addListener = this._addListener.bind(this);
this._removeListener = this._removeListener.bind(this);
this._onChange = this._onChange.bind(this);
this._onWindowFocus = this._onWindowFocus.bind(this);
DocumentManager.on("afterDocumentCreate", function (event, doc) {
// Only track documents in the current project
if (ProjectManager.isWithinProject(doc.file.fullPath)) {
self._addListener(doc);
}
});
DocumentManager.on("beforeDocumentDelete", function (event, doc) {
// In case a document somehow remains loaded after its project
// has been closed, unconditionally attempt to remove the listener.
self._removeListener(doc);
});
$(window).focus(this._onWindowFocus);
}
|
javascript
|
{
"resource": ""
}
|
q17105
|
_findAllAndSelect
|
train
|
function _findAllAndSelect(editor) {
editor = editor || EditorManager.getActiveEditor();
if (!editor) {
return;
}
var sel = editor.getSelection(),
newSelections = [];
if (CodeMirror.cmpPos(sel.start, sel.end) === 0) {
sel = _getWordAt(editor, sel.start);
}
if (CodeMirror.cmpPos(sel.start, sel.end) !== 0) {
var searchStart = {line: 0, ch: 0},
state = getSearchState(editor._codeMirror),
nextMatch;
setQueryInfo(state, { query: editor.document.getRange(sel.start, sel.end), isCaseSensitive: false, isRegexp: false });
while ((nextMatch = _getNextMatch(editor, false, searchStart, false)) !== null) {
if (_selEq(sel, nextMatch)) {
nextMatch.primary = true;
}
newSelections.push(nextMatch);
searchStart = nextMatch.end;
}
// This should find at least the original selection, but just in case...
if (newSelections.length) {
// Don't change the scroll position.
editor.setSelections(newSelections, false);
}
}
}
|
javascript
|
{
"resource": ""
}
|
q17106
|
clearCurrentMatchHighlight
|
train
|
function clearCurrentMatchHighlight(cm, state) {
if (state.markedCurrent) {
state.markedCurrent.clear();
ScrollTrackMarkers.markCurrent(-1);
}
}
|
javascript
|
{
"resource": ""
}
|
q17107
|
clearHighlights
|
train
|
function clearHighlights(cm, state) {
cm.operation(function () {
state.marked.forEach(function (markedRange) {
markedRange.clear();
});
clearCurrentMatchHighlight(cm, state);
});
state.marked.length = 0;
state.markedCurrent = null;
ScrollTrackMarkers.clear();
state.resultSet = [];
state.matchIndex = -1;
}
|
javascript
|
{
"resource": ""
}
|
q17108
|
openSearchBar
|
train
|
function openSearchBar(editor, replace) {
var cm = editor._codeMirror,
state = getSearchState(cm);
// Use the selection start as the searchStartPos. This way if you
// start with a pre-populated search and enter an additional character,
// it will extend the initial selection instead of jumping to the next
// occurrence.
state.searchStartPos = editor.getCursorPos(false, "start");
// Prepopulate the search field
var initialQuery = FindBar.getInitialQuery(findBar, editor);
if (initialQuery.query === "" && editor.lastParsedQuery !== "") {
initialQuery.query = editor.lastParsedQuery;
}
// Close our previous find bar, if any. (The open() of the new findBar will
// take care of closing any other find bar instances.)
if (findBar) {
findBar.close();
}
// Create the search bar UI (closing any previous find bar in the process)
findBar = new FindBar({
multifile: false,
replace: replace,
initialQuery: initialQuery.query,
initialReplaceText: initialQuery.replaceText,
queryPlaceholder: Strings.FIND_QUERY_PLACEHOLDER
});
findBar.open();
findBar
.on("queryChange.FindReplace", function (e) {
handleQueryChange(editor, state);
})
.on("doFind.FindReplace", function (e, searchBackwards) {
findNext(editor, searchBackwards);
})
.on("close.FindReplace", function (e) {
editor.lastParsedQuery = state.parsedQuery;
// Clear highlights but leave search state in place so Find Next/Previous work after closing
clearHighlights(cm, state);
// Dispose highlighting UI (important to restore normal selection color as soon as focus goes back to the editor)
toggleHighlighting(editor, false);
findBar.off(".FindReplace");
findBar = null;
});
handleQueryChange(editor, state, true);
}
|
javascript
|
{
"resource": ""
}
|
q17109
|
_getIndentSize
|
train
|
function _getIndentSize(fullPath) {
return Editor.getUseTabChar(fullPath) ? Editor.getTabSize(fullPath) : Editor.getSpaceUnits(fullPath);
}
|
javascript
|
{
"resource": ""
}
|
q17110
|
lintOneFile
|
train
|
function lintOneFile(text, fullPath) {
// If a line contains only whitespace (here spaces or tabs), remove the whitespace
text = text.replace(/^[ \t]+$/gm, "");
var options = prefs.get("options");
_lastRunOptions = _.clone(options);
if (!options) {
options = {};
} else {
options = _.clone(options);
}
if (!options.indent) {
// default to using the same indentation value that the editor is using
options.indent = _getIndentSize(fullPath);
}
// If the user has not defined the environment, we use browser by default.
var hasEnvironment = _.some(ENVIRONMENTS, function (env) {
return options[env] !== undefined;
});
if (!hasEnvironment) {
options.browser = true;
}
var jslintResult = JSLINT(text, options);
if (!jslintResult) {
// Remove any trailing null placeholder (early-abort indicator)
var errors = JSLINT.errors.filter(function (err) { return err !== null; });
errors = errors.map(function (jslintError) {
return {
// JSLint returns 1-based line/col numbers
pos: { line: jslintError.line - 1, ch: jslintError.character - 1 },
message: jslintError.reason,
type: CodeInspection.Type.WARNING
};
});
var result = { errors: errors };
// If array terminated in a null it means there was a stop notice
if (errors.length !== JSLINT.errors.length) {
result.aborted = true;
errors[errors.length - 1].type = CodeInspection.Type.META;
}
return result;
}
return null;
}
|
javascript
|
{
"resource": ""
}
|
q17111
|
prepareEditorForProvider
|
train
|
function prepareEditorForProvider(hostEditor, pos) {
var colorRegEx, cursorLine, match, sel, start, end, endPos, marker;
sel = hostEditor.getSelection();
if (sel.start.line !== sel.end.line) {
return null;
}
colorRegEx = new RegExp(ColorUtils.COLOR_REGEX);
cursorLine = hostEditor.document.getLine(pos.line);
// Loop through each match of colorRegEx and stop when the one that contains pos is found.
do {
match = colorRegEx.exec(cursorLine);
if (match) {
start = match.index;
end = start + match[0].length;
}
} while (match && (pos.ch < start || pos.ch > end));
if (!match) {
return null;
}
// Adjust pos to the beginning of the match so that the inline editor won't get
// dismissed while we're updating the color with the new values from user's inline editing.
pos.ch = start;
endPos = {line: pos.line, ch: end};
marker = hostEditor._codeMirror.markText(pos, endPos);
hostEditor.setSelection(pos, endPos);
return {
color: match[0],
marker: marker
};
}
|
javascript
|
{
"resource": ""
}
|
q17112
|
train
|
function (msg) {
var msgHandlers;
if (!msg.method) {
// no message type, ignoring it
// TODO: should we trigger a generic event?
console.log("[Brackets LiveDev] Received message without method.");
return;
}
// get handlers for msg.method
msgHandlers = this.handlers[msg.method];
if (msgHandlers && msgHandlers.length > 0) {
// invoke handlers with the received message
msgHandlers.forEach(function (handler) {
try {
// TODO: check which context should be used to call handlers here.
handler(msg);
return;
} catch (e) {
console.log("[Brackets LiveDev] Error executing a handler for " + msg.method);
console.log(e.stack);
return;
}
});
} else {
// no subscribers, ignore it.
// TODO: any other default handling? (eg. specific respond, trigger as a generic event, etc.);
console.log("[Brackets LiveDev] No subscribers for message " + msg.method);
return;
}
}
|
javascript
|
{
"resource": ""
}
|
|
q17113
|
train
|
function (orig, response) {
if (!orig.id) {
console.log("[Brackets LiveDev] Trying to send a response for a message with no ID");
return;
}
response.id = orig.id;
this.send(response);
}
|
javascript
|
{
"resource": ""
}
|
|
q17114
|
train
|
function (method, handler) {
if (!method || !handler) {
return;
}
if (!this.handlers[method]) {
//initialize array
this.handlers[method] = [];
}
// add handler to the stack
this.handlers[method].push(handler);
}
|
javascript
|
{
"resource": ""
}
|
|
q17115
|
train
|
function (msg) {
console.log("Runtime.evaluate");
var result = eval(msg.params.expression);
MessageBroker.respond(msg, {
result: JSON.stringify(result) // TODO: in original protocol this is an object handle
});
}
|
javascript
|
{
"resource": ""
}
|
|
q17116
|
train
|
function (msg) {
if (msg.params.url) {
// navigate to a new page.
window.location.replace(msg.params.url);
}
}
|
javascript
|
{
"resource": ""
}
|
|
q17117
|
train
|
function (msgStr) {
var msg;
try {
msg = JSON.parse(msgStr);
} catch (e) {
console.log("[Brackets LiveDev] Malformed message received: ", msgStr);
return;
}
// delegates handling/routing to MessageBroker.
MessageBroker.trigger(msg);
}
|
javascript
|
{
"resource": ""
}
|
|
q17118
|
onDocumentClick
|
train
|
function onDocumentClick(event) {
var element = event.target;
if (element && element.hasAttribute('data-brackets-id')) {
MessageBroker.send({"tagId": element.getAttribute('data-brackets-id')});
}
}
|
javascript
|
{
"resource": ""
}
|
q17119
|
previewHealthData
|
train
|
function previewHealthData() {
var result = new $.Deferred();
HealthDataManager.getHealthData().done(function (healthDataObject) {
var combinedHealthAnalyticsData = HealthDataManager.getAnalyticsData(),
content;
combinedHealthAnalyticsData = [healthDataObject, combinedHealthAnalyticsData ];
content = JSON.stringify(combinedHealthAnalyticsData, null, 4);
content = _.escape(content);
content = content.replace(/ /g, " ");
content = content.replace(/(?:\r\n|\r|\n)/g, "<br />");
var hdPref = prefs.get("healthDataTracking"),
template = Mustache.render(HealthDataPreviewDialog, {Strings: Strings, content: content, hdPref: hdPref}),
$template = $(template);
Dialogs.addLinkTooltips($template);
Dialogs.showModalDialogUsingTemplate($template).done(function (id) {
if (id === "save") {
var newHDPref = $template.find("[data-target]:checkbox").is(":checked");
if (hdPref !== newHDPref) {
prefs.set("healthDataTracking", newHDPref);
}
}
});
return result.resolve();
});
return result.promise();
}
|
javascript
|
{
"resource": ""
}
|
q17120
|
_openEditorForContext
|
train
|
function _openEditorForContext(contextData) {
// Open the file in the current active pane to prevent unwanted scenarios if we are not in split view, fallback
// to the persisted paneId when specified and we are in split view or unable to determine the paneid
var activePaneId = MainViewManager.getActivePaneId(),
targetPaneId = contextData.paneId; // Assume we are going to use the last associated paneID
// Detect if we are not in split mode
if (MainViewManager.getPaneCount() === 1) {
// Override the targetPaneId with activePaneId as we are not yet in split mode
targetPaneId = activePaneId;
}
// If hide of MROF list is a context parameter, hide the MROF list on successful file open
if (contextData.hideOnOpenFile) {
_hideMROFList();
}
return CommandManager
.execute(Commands.FILE_OPEN,
{ fullPath: contextData.path,
paneId: targetPaneId
}
)
.done(function () {
if (contextData.cursor) {
activeEditor = EditorManager.getActiveEditor();
activeEditor.setCursorPos(contextData.cursor);
activeEditor.centerOnCursor();
}
});
}
|
javascript
|
{
"resource": ""
}
|
q17121
|
_makeMROFListEntry
|
train
|
function _makeMROFListEntry(path, pane, cursorPos) {
return {
file: path,
paneId: pane,
cursor: cursorPos
};
}
|
javascript
|
{
"resource": ""
}
|
q17122
|
_syncWithFileSystem
|
train
|
function _syncWithFileSystem() {
_mrofList = _mrofList.filter(function (e) {return e; });
return Async.doSequentially(_mrofList, _checkExt, false);
}
|
javascript
|
{
"resource": ""
}
|
q17123
|
_createMROFList
|
train
|
function _createMROFList() {
var paneList = MainViewManager.getPaneIdList(),
mrofList = [],
fileList,
index;
var pane, file, mrofEntry, paneCount, fileCount;
// Iterate over the pane ID list
for (paneCount = 0; paneCount < paneList.length; paneCount++) {
pane = paneList[paneCount];
fileList = MainViewManager.getWorkingSet(pane);
// Iterate over the file list for this pane
for (fileCount = 0; fileCount < fileList.length; fileCount++) {
file = fileList[fileCount];
mrofEntry = _makeMROFListEntry(file.fullPath, pane, null);
// Add it in the MRU list order
index = MainViewManager.findInGlobalMRUList(pane, file);
mrofList[index] = mrofEntry;
}
}
return mrofList;
}
|
javascript
|
{
"resource": ""
}
|
q17124
|
_createMROFDisplayList
|
train
|
function _createMROFDisplayList(refresh) {
var $def = $.Deferred();
var $mrofList, $link, $newItem;
/**
* Clears the MROF list in memory and pop over but retains the working set entries
* @private
*/
function _purgeAllExceptWorkingSet() {
_mrofList = _createMROFList();
$mrofList.empty();
_createMROFDisplayList(true);
$currentContext = null;
PreferencesManager.setViewState(OPEN_FILES_VIEW_STATE, _mrofList, _getPrefsContext(), true);
}
if (!refresh) {
// Call hide first to make sure we are not creating duplicate lists
_hideMROFList();
$mrofContainer = $(Mustache.render(htmlTemplate, {Strings: Strings})).appendTo('body');
$("#mrof-list-close").one("click", _hideMROFList);
// Attach clear list handler to the 'Clear All' button
$("#mrof-container .footer > div#clear-mrof-list").on("click", _purgeAllExceptWorkingSet);
$(window).on("keydown", _handleArrowKeys);
$(window).on("keyup", _hideMROFListOnEscape);
}
$mrofList = $mrofContainer.find("#mrof-list");
/**
* Focus handler for the link in list item
* @private
*/
function _onFocus(event) {
var $scope = $(event.target).parent();
$("#mrof-container #mrof-list > li.highlight").removeClass("highlight");
$(event.target).parent().addClass("highlight");
$mrofContainer.find("#recent-file-path").text($scope.data("path"));
$mrofContainer.find("#recent-file-path").attr('title', ($scope.data("path")));
$currentContext = $scope;
}
/**
* Click handler for the link in list item
* @private
*/
function _onClick(event) {
var $scope = $(event.delegateTarget).parent();
_openEditorForContext({
path: $scope.data("path"),
paneId: $scope.data("paneId"),
cursor: $scope.data("cursor"),
hideOnOpenFile: true
});
}
var data, fileEntry;
_syncWithFileSystem().always(function () {
_mrofList = _mrofList.filter(function (e) {return e; });
_createFileEntries($mrofList);
var $fileLinks = $("#mrof-container #mrof-list > li > a.mroitem");
// Handlers for mouse events on the list items
$fileLinks.on("focus", _onFocus);
$fileLinks.on("click", _onClick);
$fileLinks.on("select", _onClick);
// Put focus on the Most recent file link in the list
$fileLinks.first().trigger("focus");
$def.resolve();
});
return $def.promise();
}
|
javascript
|
{
"resource": ""
}
|
q17125
|
_purgeAllExceptWorkingSet
|
train
|
function _purgeAllExceptWorkingSet() {
_mrofList = _createMROFList();
$mrofList.empty();
_createMROFDisplayList(true);
$currentContext = null;
PreferencesManager.setViewState(OPEN_FILES_VIEW_STATE, _mrofList, _getPrefsContext(), true);
}
|
javascript
|
{
"resource": ""
}
|
q17126
|
_onFocus
|
train
|
function _onFocus(event) {
var $scope = $(event.target).parent();
$("#mrof-container #mrof-list > li.highlight").removeClass("highlight");
$(event.target).parent().addClass("highlight");
$mrofContainer.find("#recent-file-path").text($scope.data("path"));
$mrofContainer.find("#recent-file-path").attr('title', ($scope.data("path")));
$currentContext = $scope;
}
|
javascript
|
{
"resource": ""
}
|
q17127
|
_onClick
|
train
|
function _onClick(event) {
var $scope = $(event.delegateTarget).parent();
_openEditorForContext({
path: $scope.data("path"),
paneId: $scope.data("paneId"),
cursor: $scope.data("cursor"),
hideOnOpenFile: true
});
}
|
javascript
|
{
"resource": ""
}
|
q17128
|
_moveNext
|
train
|
function _moveNext() {
var $context, $next;
$context = $currentContext || $("#mrof-container #mrof-list > li.highlight");
if ($context.length > 0) {
$next = $context.next();
if ($next.length === 0) {
$next = $("#mrof-container #mrof-list > li").first();
}
if ($next.length > 0) {
$currentContext = $next;
$next.find("a.mroitem").trigger("focus");
}
} else {
//WTF! (Worse than failure). We should not get here.
$("#mrof-container #mrof-list > li > a.mroitem:visited").last().trigger("focus");
}
}
|
javascript
|
{
"resource": ""
}
|
q17129
|
_movePrev
|
train
|
function _movePrev() {
var $context, $prev;
$context = $currentContext || $("#mrof-container #mrof-list > li.highlight");
if ($context.length > 0) {
$prev = $context.prev();
if ($prev.length === 0) {
$prev = $("#mrof-container #mrof-list > li").last();
}
if ($prev.length > 0) {
$currentContext = $prev;
$prev.find("a.mroitem").trigger("focus");
}
} else {
//WTF! (Worse than failure). We should not get here.
$("#mrof-container #mrof-list > li > a.mroitem:visited").last().trigger("focus");
}
}
|
javascript
|
{
"resource": ""
}
|
q17130
|
_addToMROFList
|
train
|
function _addToMROFList(file, paneId, cursorPos) {
var filePath = file.fullPath;
if (!paneId) { // Don't handle this if not a full view/editor
return;
}
// Check existing list for this doc path and pane entry
var index = _.findIndex(_mrofList, function (record) {
return (record && record.file === filePath && record.paneId === paneId);
});
var entry;
if (index !== -1) {
entry = _mrofList[index];
if (entry.cursor && !cursorPos) {
cursorPos = entry.cursor;
}
}
entry = _makeMROFListEntry(filePath, paneId, cursorPos);
// Check if the file is an InMemoryFile
if (file.constructor.name === "InMemoryFile") {
// Mark the entry as inMem, so that we can knock it off from the list when removed from working set
entry.inMem = true;
}
if (index !== -1) {
_mrofList.splice(index, 1);
}
// add it to the front of the list
_mrofList.unshift(entry);
PreferencesManager.setViewState(OPEN_FILES_VIEW_STATE, _mrofList, _getPrefsContext(), true);
}
|
javascript
|
{
"resource": ""
}
|
q17131
|
_handleWorkingSetMove
|
train
|
function _handleWorkingSetMove(event, file, sourcePaneId, destinationPaneId) {
// Check existing list for this doc path and source pane entry
var index = _.findIndex(_mrofList, function (record) {
return (record && record.file === file.fullPath && record.paneId === sourcePaneId);
}), tIndex;
// If an entry is found update the pane info
if (index >= 0) {
// But an entry with the target pane Id should not exist
tIndex = _.findIndex(_mrofList, function (record) {
return (record && record.file === file.fullPath && record.paneId === destinationPaneId);
});
if (tIndex === -1) {
_mrofList[index].paneId = destinationPaneId;
} else {
// Remove this entry as it has been moved.
_mrofList.splice(index, 1);
}
}
}
|
javascript
|
{
"resource": ""
}
|
q17132
|
_handlePaneMerge
|
train
|
function _handlePaneMerge(e, paneId) {
var index;
var targetPaneId = MainViewManager.FIRST_PANE;
$.each(_mrofList, function (itrIndex, value) {
if (value && value.paneId === paneId) { // We have got an entry which needs merge
// Before modifying the actual pane info check if an entry exists with same target pane
index = _.findIndex(_mrofList, function (record) {
return (record && record.file === value.file && record.paneId === targetPaneId);
});
if (index !== -1) { // A duplicate entry found, remove the current one instead of updating
_mrofList[index] = null;
} else { // Update with merged pane info
_mrofList[itrIndex].paneId = targetPaneId;
}
}
});
// Clean the null/undefined entries
_mrofList = _mrofList.filter(function (e) {return e; });
PreferencesManager.setViewState(OPEN_FILES_VIEW_STATE, _mrofList, _getPrefsContext(), true);
}
|
javascript
|
{
"resource": ""
}
|
q17133
|
handleCurrentFileChange
|
train
|
function handleCurrentFileChange(e, newFile, newPaneId, oldFile) {
if (newFile) {
if (_mrofList.length === 0) {
_initRecentFilesList();
}
_addToMROFList(newFile, newPaneId);
}
}
|
javascript
|
{
"resource": ""
}
|
q17134
|
_handleActiveEditorChange
|
train
|
function _handleActiveEditorChange(event, current, previous) {
if (current) { // Handle only full editors
if (_mrofList.length === 0) {
_initRecentFilesList();
}
var file = current.document.file;
var paneId = current._paneId;
_addToMROFList(file, paneId, current.getCursorPos(true, "first"));
}
if (previous) { // Capture the last know cursor position
_updateCursorPosition(previous.document.file.fullPath, previous._paneId, previous.getCursorPos(true, "first"));
}
}
|
javascript
|
{
"resource": ""
}
|
q17135
|
handleExtractToFunction
|
train
|
function handleExtractToFunction() {
var editor = EditorManager.getActiveEditor();
var result = new $.Deferred(); // used only for testing purpose
if (editor.getSelections().length > 1) {
editor.displayErrorMessageAtCursor(Strings.ERROR_EXTRACTTO_FUNCTION_MULTICURSORS);
result.resolve(Strings.ERROR_EXTRACTTO_FUNCTION_MULTICURSORS);
return;
}
initializeSession(editor);
var selection = editor.getSelection(),
doc = editor.document,
retObj = RefactoringUtils.normalizeText(editor.getSelectedText(), editor.indexFromPos(selection.start), editor.indexFromPos(selection.end)),
text = retObj.text,
start = retObj.start,
end = retObj.end,
ast,
scopes,
expns,
inlineMenu;
RefactoringUtils.getScopeData(session, editor.posFromIndex(start)).done(function(scope) {
ast = RefactoringUtils.getAST(doc.getText());
var isExpression = false;
if (!RefactoringUtils.checkStatement(ast, start, end, doc.getText())) {
isExpression = RefactoringUtils.getExpression(ast, start, end, doc.getText());
if (!isExpression) {
editor.displayErrorMessageAtCursor(Strings.ERROR_EXTRACTTO_FUNCTION_NOT_VALID);
result.resolve(Strings.ERROR_EXTRACTTO_FUNCTION_NOT_VALID);
return;
}
}
scopes = RefactoringUtils.getAllScopes(ast, scope, doc.getText());
// if only one scope, extract without menu
if (scopes.length === 1) {
extract(ast, text, scopes, scopes[0], scopes[0], start, end, isExpression);
result.resolve();
return;
}
inlineMenu = new InlineMenu(editor, Strings.EXTRACTTO_FUNCTION_SELECT_SCOPE);
inlineMenu.open(scopes.filter(RefactoringUtils.isFnScope));
result.resolve(inlineMenu);
inlineMenu.onSelect(function (scopeId) {
extract(ast, text, scopes, scopes[0], scopes[scopeId], start, end, isExpression);
inlineMenu.close();
});
inlineMenu.onClose(function(){
inlineMenu.close();
});
}).fail(function() {
editor.displayErrorMessageAtCursor(Strings.ERROR_TERN_FAILED);
result.resolve(Strings.ERROR_TERN_FAILED);
});
return result.promise();
}
|
javascript
|
{
"resource": ""
}
|
q17136
|
initTernEnv
|
train
|
function initTernEnv() {
var path = [_absoluteModulePath, "node/node_modules/tern/defs/"].join("/"),
files = builtinFiles,
library;
files.forEach(function (i) {
FileSystem.resolve(path + i, function (err, file) {
if (!err) {
FileUtils.readAsText(file).done(function (text) {
library = JSON.parse(text);
builtinLibraryNames.push(library["!name"]);
ternEnvironment.push(library);
}).fail(function (error) {
console.log("failed to read tern config file " + i);
});
} else {
console.log("failed to read tern config file " + i);
}
});
});
}
|
javascript
|
{
"resource": ""
}
|
q17137
|
initPreferences
|
train
|
function initPreferences(projectRootPath) {
// Reject the old preferences if they have not completed.
if (deferredPreferences && deferredPreferences.state() === "pending") {
deferredPreferences.reject();
}
deferredPreferences = $.Deferred();
var pr = ProjectManager.getProjectRoot();
// Open preferences relative to the project root
// Normally there is a project root, but for unit tests we need to
// pass in a project root.
if (pr) {
projectRootPath = pr.fullPath;
} else if (!projectRootPath) {
console.log("initPreferences: projectRootPath has no value");
}
var path = projectRootPath + Preferences.FILE_NAME;
FileSystem.resolve(path, function (err, file) {
if (!err) {
FileUtils.readAsText(file).done(function (text) {
var configObj = null;
try {
configObj = JSON.parse(text);
} catch (e) {
// continue with null configObj which will result in
// default settings.
console.log("Error parsing preference file: " + path);
if (e instanceof SyntaxError) {
console.log(e.message);
}
}
preferences = new Preferences(configObj);
deferredPreferences.resolve();
}).fail(function (error) {
preferences = new Preferences();
deferredPreferences.resolve();
});
} else {
preferences = new Preferences();
deferredPreferences.resolve();
}
});
}
|
javascript
|
{
"resource": ""
}
|
q17138
|
isDirectoryExcluded
|
train
|
function isDirectoryExcluded(path) {
var excludes = preferences.getExcludedDirectories();
if (!excludes) {
return false;
}
var testPath = ProjectManager.makeProjectRelativeIfPossible(path);
testPath = FileUtils.stripTrailingSlash(testPath);
return excludes.test(testPath);
}
|
javascript
|
{
"resource": ""
}
|
q17139
|
isFileBeingEdited
|
train
|
function isFileBeingEdited(filePath) {
var currentEditor = EditorManager.getActiveEditor(),
currentDoc = currentEditor && currentEditor.document;
return (currentDoc && currentDoc.file.fullPath === filePath);
}
|
javascript
|
{
"resource": ""
}
|
q17140
|
isFileExcludedInternal
|
train
|
function isFileExcludedInternal(path) {
// The detectedExclusions are files detected to be troublesome with current versions of Tern.
// detectedExclusions is an array of full paths.
var detectedExclusions = PreferencesManager.get("jscodehints.detectedExclusions") || [];
if (detectedExclusions && detectedExclusions.indexOf(path) !== -1) {
return true;
}
return false;
}
|
javascript
|
{
"resource": ""
}
|
q17141
|
isFileExcluded
|
train
|
function isFileExcluded(file) {
if (file.name[0] === ".") {
return true;
}
var languageID = LanguageManager.getLanguageForPath(file.fullPath).getId();
if (languageID !== HintUtils.LANGUAGE_ID) {
return true;
}
var excludes = preferences.getExcludedFiles();
if (excludes && excludes.test(file.name)) {
return true;
}
if (isFileExcludedInternal(file.fullPath)) {
return true;
}
return false;
}
|
javascript
|
{
"resource": ""
}
|
q17142
|
addPendingRequest
|
train
|
function addPendingRequest(file, offset, type) {
var requests,
key = file + "@" + offset.line + "@" + offset.ch,
$deferredRequest;
// Reject detected exclusions
if (isFileExcludedInternal(file)) {
return (new $.Deferred()).reject().promise();
}
if (_.has(pendingTernRequests, key)) {
requests = pendingTernRequests[key];
} else {
requests = {};
pendingTernRequests[key] = requests;
}
if (_.has(requests, type)) {
$deferredRequest = requests[type];
} else {
requests[type] = $deferredRequest = new $.Deferred();
}
return $deferredRequest.promise();
}
|
javascript
|
{
"resource": ""
}
|
q17143
|
getJumptoDef
|
train
|
function getJumptoDef(fileInfo, offset) {
postMessage({
type: MessageIds.TERN_JUMPTODEF_MSG,
fileInfo: fileInfo,
offset: offset
});
return addPendingRequest(fileInfo.name, offset, MessageIds.TERN_JUMPTODEF_MSG);
}
|
javascript
|
{
"resource": ""
}
|
q17144
|
filterText
|
train
|
function filterText(text) {
var newText = text;
if (text.length > preferences.getMaxFileSize()) {
newText = "";
}
return newText;
}
|
javascript
|
{
"resource": ""
}
|
q17145
|
handleRename
|
train
|
function handleRename(response) {
if (response.error) {
EditorManager.getActiveEditor().displayErrorMessageAtCursor(response.error);
return;
}
var file = response.file,
offset = response.offset;
var $deferredFindRefs = getPendingRequest(file, offset, MessageIds.TERN_REFS);
if ($deferredFindRefs) {
$deferredFindRefs.resolveWith(null, [response]);
}
}
|
javascript
|
{
"resource": ""
}
|
q17146
|
requestJumptoDef
|
train
|
function requestJumptoDef(session, document, offset) {
var path = document.file.fullPath,
fileInfo = {
type: MessageIds.TERN_FILE_INFO_TYPE_FULL,
name: path,
offsetLines: 0,
text: filterText(session.getJavascriptText())
};
var ternPromise = getJumptoDef(fileInfo, offset);
return {promise: ternPromise};
}
|
javascript
|
{
"resource": ""
}
|
q17147
|
handleJumptoDef
|
train
|
function handleJumptoDef(response) {
var file = response.file,
offset = response.offset;
var $deferredJump = getPendingRequest(file, offset, MessageIds.TERN_JUMPTODEF_MSG);
if ($deferredJump) {
response.fullPath = getResolvedPath(response.resultFile);
$deferredJump.resolveWith(null, [response]);
}
}
|
javascript
|
{
"resource": ""
}
|
q17148
|
handleScopeData
|
train
|
function handleScopeData(response) {
var file = response.file,
offset = response.offset;
var $deferredJump = getPendingRequest(file, offset, MessageIds.TERN_SCOPEDATA_MSG);
if ($deferredJump) {
$deferredJump.resolveWith(null, [response]);
}
}
|
javascript
|
{
"resource": ""
}
|
q17149
|
getTernHints
|
train
|
function getTernHints(fileInfo, offset, isProperty) {
/**
* If the document is large and we have modified a small portions of it that
* we are asking hints for, then send a partial document.
*/
postMessage({
type: MessageIds.TERN_COMPLETIONS_MSG,
fileInfo: fileInfo,
offset: offset,
isProperty: isProperty
});
return addPendingRequest(fileInfo.name, offset, MessageIds.TERN_COMPLETIONS_MSG);
}
|
javascript
|
{
"resource": ""
}
|
q17150
|
getTernFunctionType
|
train
|
function getTernFunctionType(fileInfo, offset) {
postMessage({
type: MessageIds.TERN_CALLED_FUNC_TYPE_MSG,
fileInfo: fileInfo,
offset: offset
});
return addPendingRequest(fileInfo.name, offset, MessageIds.TERN_CALLED_FUNC_TYPE_MSG);
}
|
javascript
|
{
"resource": ""
}
|
q17151
|
getFragmentAround
|
train
|
function getFragmentAround(session, start) {
var minIndent = null,
minLine = null,
endLine,
cm = session.editor._codeMirror,
tabSize = cm.getOption("tabSize"),
document = session.editor.document,
p,
min,
indent,
line;
// expand range backwards
for (p = start.line - 1, min = Math.max(0, p - 100); p >= min; --p) {
line = session.getLine(p);
var fn = line.search(/\bfunction\b/);
if (fn >= 0) {
indent = CodeMirror.countColumn(line, null, tabSize);
if (minIndent === null || minIndent > indent) {
if (session.getToken({line: p, ch: fn + 1}).type === "keyword") {
minIndent = indent;
minLine = p;
}
}
}
}
if (minIndent === null) {
minIndent = 0;
}
if (minLine === null) {
minLine = min;
}
var max = Math.min(cm.lastLine(), start.line + 100),
endCh = 0;
for (endLine = start.line + 1; endLine < max; ++endLine) {
line = cm.getLine(endLine);
if (line.length > 0) {
indent = CodeMirror.countColumn(line, null, tabSize);
if (indent <= minIndent) {
endCh = line.length;
break;
}
}
}
var from = {line: minLine, ch: 0},
to = {line: endLine, ch: endCh};
return {type: MessageIds.TERN_FILE_INFO_TYPE_PART,
name: document.file.fullPath,
offsetLines: from.line,
text: document.getRange(from, to)};
}
|
javascript
|
{
"resource": ""
}
|
q17152
|
getFileInfo
|
train
|
function getFileInfo(session, preventPartialUpdates) {
var start = session.getCursor(),
end = start,
document = session.editor.document,
path = document.file.fullPath,
isHtmlFile = LanguageManager.getLanguageForPath(path).getId() === "html",
result;
if (isHtmlFile) {
result = {type: MessageIds.TERN_FILE_INFO_TYPE_FULL,
name: path,
text: session.getJavascriptText()};
} else if (!documentChanges) {
result = {type: MessageIds.TERN_FILE_INFO_TYPE_EMPTY,
name: path,
text: ""};
} else if (!preventPartialUpdates && session.editor.lineCount() > LARGE_LINE_COUNT &&
(documentChanges.to - documentChanges.from < LARGE_LINE_CHANGE) &&
documentChanges.from <= start.line &&
documentChanges.to > end.line) {
result = getFragmentAround(session, start);
} else {
result = {type: MessageIds.TERN_FILE_INFO_TYPE_FULL,
name: path,
text: getTextFromDocument(document)};
}
documentChanges = null;
return result;
}
|
javascript
|
{
"resource": ""
}
|
q17153
|
getOffset
|
train
|
function getOffset(session, fileInfo, offset) {
var newOffset;
if (offset) {
newOffset = {line: offset.line, ch: offset.ch};
} else {
newOffset = session.getCursor();
}
if (fileInfo.type === MessageIds.TERN_FILE_INFO_TYPE_PART) {
newOffset.line = Math.max(0, newOffset.line - fileInfo.offsetLines);
}
return newOffset;
}
|
javascript
|
{
"resource": ""
}
|
q17154
|
requestGuesses
|
train
|
function requestGuesses(session, document) {
var $deferred = $.Deferred(),
fileInfo = getFileInfo(session),
offset = getOffset(session, fileInfo);
postMessage({
type: MessageIds.TERN_GET_GUESSES_MSG,
fileInfo: fileInfo,
offset: offset
});
var promise = addPendingRequest(fileInfo.name, offset, MessageIds.TERN_GET_GUESSES_MSG);
promise.done(function (guesses) {
session.setGuesses(guesses);
$deferred.resolve();
}).fail(function () {
$deferred.reject();
});
return $deferred.promise();
}
|
javascript
|
{
"resource": ""
}
|
q17155
|
handleTernCompletions
|
train
|
function handleTernCompletions(response) {
var file = response.file,
offset = response.offset,
completions = response.completions,
properties = response.properties,
fnType = response.fnType,
type = response.type,
error = response.error,
$deferredHints = getPendingRequest(file, offset, type);
if ($deferredHints) {
if (error) {
$deferredHints.reject();
} else if (completions) {
$deferredHints.resolveWith(null, [{completions: completions}]);
} else if (properties) {
$deferredHints.resolveWith(null, [{properties: properties}]);
} else if (fnType) {
$deferredHints.resolveWith(null, [fnType]);
}
}
}
|
javascript
|
{
"resource": ""
}
|
q17156
|
handleGetGuesses
|
train
|
function handleGetGuesses(response) {
var path = response.file,
type = response.type,
offset = response.offset,
$deferredHints = getPendingRequest(path, offset, type);
if ($deferredHints) {
$deferredHints.resolveWith(null, [response.properties]);
}
}
|
javascript
|
{
"resource": ""
}
|
q17157
|
handleUpdateFile
|
train
|
function handleUpdateFile(response) {
var path = response.path,
type = response.type,
$deferredHints = getPendingRequest(path, OFFSET_ZERO, type);
if ($deferredHints) {
$deferredHints.resolve();
}
}
|
javascript
|
{
"resource": ""
}
|
q17158
|
handleTimedOut
|
train
|
function handleTimedOut(response) {
var detectedExclusions = PreferencesManager.get("jscodehints.detectedExclusions") || [],
filePath = response.file;
// Don't exclude the file currently being edited
if (isFileBeingEdited(filePath)) {
return;
}
// Handle file that is already excluded
if (detectedExclusions.indexOf(filePath) !== -1) {
console.log("JavaScriptCodeHints.handleTimedOut: file already in detectedExclusions array timed out: " + filePath);
return;
}
// Save detected exclusion in project prefs so no further time is wasted on it
detectedExclusions.push(filePath);
PreferencesManager.set("jscodehints.detectedExclusions", detectedExclusions, { location: { scope: "project" } });
// Show informational dialog
Dialogs.showModalDialog(
DefaultDialogs.DIALOG_ID_INFO,
Strings.DETECTED_EXCLUSION_TITLE,
StringUtils.format(
Strings.DETECTED_EXCLUSION_INFO,
StringUtils.breakableUrl(filePath)
),
[
{
className : Dialogs.DIALOG_BTN_CLASS_PRIMARY,
id : Dialogs.DIALOG_BTN_OK,
text : Strings.OK
}
]
);
}
|
javascript
|
{
"resource": ""
}
|
q17159
|
postMessage
|
train
|
function postMessage(msg) {
addFilesPromise.done(function (ternModule) {
// If an error came up during file handling, bail out now
if (!_ternNodeDomain) {
return;
}
if (config.debug) {
console.debug("Sending message", msg);
}
_ternNodeDomain.exec("invokeTernCommand", msg);
});
}
|
javascript
|
{
"resource": ""
}
|
q17160
|
_postMessageByPass
|
train
|
function _postMessageByPass(msg) {
ternPromise.done(function (ternModule) {
if (config.debug) {
console.debug("Sending message", msg);
}
_ternNodeDomain.exec("invokeTernCommand", msg);
});
}
|
javascript
|
{
"resource": ""
}
|
q17161
|
updateTernFile
|
train
|
function updateTernFile(document) {
var path = document.file.fullPath;
_postMessageByPass({
type : MessageIds.TERN_UPDATE_FILE_MSG,
path : path,
text : getTextFromDocument(document)
});
return addPendingRequest(path, OFFSET_ZERO, MessageIds.TERN_UPDATE_FILE_MSG);
}
|
javascript
|
{
"resource": ""
}
|
q17162
|
handleTernGetFile
|
train
|
function handleTernGetFile(request) {
function replyWith(name, txt) {
_postMessageByPass({
type: MessageIds.TERN_GET_FILE_MSG,
file: name,
text: txt
});
}
var name = request.file;
/**
* Helper function to get the text of a given document and send it to tern.
* If DocumentManager successfully gets the file's text then we'll send it to the tern node domain.
* The Promise for getDocumentText() is returned so that custom fail functions can be used.
*
* @param {string} filePath - the path of the file to get the text of
* @return {jQuery.Promise} - the Promise returned from DocumentMangaer.getDocumentText()
*/
function getDocText(filePath) {
if (!FileSystem.isAbsolutePath(filePath) || // don't handle URLs
filePath.slice(0, 2) === "//") { // don't handle protocol-relative URLs like //example.com/main.js (see #10566)
return (new $.Deferred()).reject().promise();
}
var file = FileSystem.getFileForPath(filePath),
promise = DocumentManager.getDocumentText(file);
promise.done(function (docText) {
resolvedFiles[name] = filePath;
numResolvedFiles++;
replyWith(name, filterText(docText));
});
return promise;
}
/**
* Helper function to find any files in the project that end with the
* name we are looking for. This is so we can find requirejs modules
* when the baseUrl is unknown, or when the project root is not the same
* as the script root (e.g. if you open the 'brackets' dir instead of 'brackets/src' dir).
*/
function findNameInProject() {
// check for any files in project that end with the right path.
var fileName = name.substring(name.lastIndexOf("/") + 1);
function _fileFilter(entry) {
return entry.name === fileName;
}
ProjectManager.getAllFiles(_fileFilter).done(function (files) {
var file;
files = files.filter(function (file) {
var pos = file.fullPath.length - name.length;
return pos === file.fullPath.lastIndexOf(name);
});
if (files.length === 1) {
file = files[0];
}
if (file) {
getDocText(file.fullPath).fail(function () {
replyWith(name, "");
});
} else {
replyWith(name, "");
}
});
}
if (!isFileExcludedInternal(name)) {
getDocText(name).fail(function () {
getDocText(rootTernDir + name).fail(function () {
// check relative to project root
getDocText(projectRoot + name)
// last look for any files that end with the right path
// in the project
.fail(findNameInProject);
});
});
}
}
|
javascript
|
{
"resource": ""
}
|
q17163
|
primePump
|
train
|
function primePump(path, isUntitledDoc) {
_postMessageByPass({
type : MessageIds.TERN_PRIME_PUMP_MSG,
path : path,
isUntitledDoc : isUntitledDoc
});
return addPendingRequest(path, OFFSET_ZERO, MessageIds.TERN_PRIME_PUMP_MSG);
}
|
javascript
|
{
"resource": ""
}
|
q17164
|
handlePrimePumpCompletion
|
train
|
function handlePrimePumpCompletion(response) {
var path = response.path,
type = response.type,
$deferredHints = getPendingRequest(path, OFFSET_ZERO, type);
if ($deferredHints) {
$deferredHints.resolve();
}
}
|
javascript
|
{
"resource": ""
}
|
q17165
|
addFilesToTern
|
train
|
function addFilesToTern(files) {
// limit the number of files added to tern.
var maxFileCount = preferences.getMaxFileCount();
if (numResolvedFiles + numAddedFiles < maxFileCount) {
var available = maxFileCount - numResolvedFiles - numAddedFiles;
if (available < files.length) {
files = files.slice(0, available);
}
numAddedFiles += files.length;
ternPromise.done(function (ternModule) {
var msg = {
type : MessageIds.TERN_ADD_FILES_MSG,
files : files
};
if (config.debug) {
console.debug("Sending message", msg);
}
_ternNodeDomain.exec("invokeTernCommand", msg);
});
} else {
stopAddingFiles = true;
}
return stopAddingFiles;
}
|
javascript
|
{
"resource": ""
}
|
q17166
|
addAllFilesAndSubdirectories
|
train
|
function addAllFilesAndSubdirectories(dir, doneCallback) {
FileSystem.resolve(dir, function (err, directory) {
function visitor(entry) {
if (entry.isFile) {
if (!isFileExcluded(entry)) { // ignore .dotfiles and non-.js files
addFilesToTern([entry.fullPath]);
}
} else {
return !isDirectoryExcluded(entry.fullPath) &&
entry.name.indexOf(".") !== 0 &&
!stopAddingFiles;
}
}
if (err) {
return;
}
if (dir === FileSystem.getDirectoryForPath(rootTernDir)) {
doneCallback();
return;
}
directory.visit(visitor, doneCallback);
});
}
|
javascript
|
{
"resource": ""
}
|
q17167
|
initTernModule
|
train
|
function initTernModule() {
var moduleDeferred = $.Deferred();
ternPromise = moduleDeferred.promise();
function prepareTern() {
_ternNodeDomain.exec("setInterface", {
messageIds : MessageIds
});
_ternNodeDomain.exec("invokeTernCommand", {
type: MessageIds.SET_CONFIG,
config: config
});
moduleDeferred.resolveWith(null, [_ternNodeDomain]);
}
if (_ternNodeDomain) {
_ternNodeDomain.exec("resetTernServer");
moduleDeferred.resolveWith(null, [_ternNodeDomain]);
} else {
_ternNodeDomain = new NodeDomain("TernNodeDomain", _domainPath);
_ternNodeDomain.on("data", function (evt, data) {
if (config.debug) {
console.log("Message received", data.type);
}
var response = data,
type = response.type;
if (type === MessageIds.TERN_COMPLETIONS_MSG ||
type === MessageIds.TERN_CALLED_FUNC_TYPE_MSG) {
// handle any completions the tern server calculated
handleTernCompletions(response);
} else if (type === MessageIds.TERN_GET_FILE_MSG) {
// handle a request for the contents of a file
handleTernGetFile(response);
} else if (type === MessageIds.TERN_JUMPTODEF_MSG) {
handleJumptoDef(response);
} else if (type === MessageIds.TERN_SCOPEDATA_MSG) {
handleScopeData(response);
} else if (type === MessageIds.TERN_REFS) {
handleRename(response);
} else if (type === MessageIds.TERN_PRIME_PUMP_MSG) {
handlePrimePumpCompletion(response);
} else if (type === MessageIds.TERN_GET_GUESSES_MSG) {
handleGetGuesses(response);
} else if (type === MessageIds.TERN_UPDATE_FILE_MSG) {
handleUpdateFile(response);
} else if (type === MessageIds.TERN_INFERENCE_TIMEDOUT) {
handleTimedOut(response);
} else if (type === MessageIds.TERN_WORKER_READY) {
moduleDeferred.resolveWith(null, [_ternNodeDomain]);
} else if (type === "RE_INIT_TERN") {
// Ensure the request is because of a node restart
if (currentModule) {
prepareTern();
// Mark the module with resetForced, then creation of TernModule will
// happen again as part of '_maybeReset' call
currentModule.resetForced = true;
}
} else {
console.log("Tern Module: " + (response.log || response));
}
});
_ternNodeDomain.promise().done(prepareTern);
}
}
|
javascript
|
{
"resource": ""
}
|
q17168
|
doEditorChange
|
train
|
function doEditorChange(session, document, previousDocument) {
var file = document.file,
path = file.fullPath,
dir = file.parentPath,
pr;
var addFilesDeferred = $.Deferred();
documentChanges = null;
addFilesPromise = addFilesDeferred.promise();
pr = ProjectManager.getProjectRoot() ? ProjectManager.getProjectRoot().fullPath : null;
// avoid re-initializing tern if possible.
if (canSkipTernInitialization(path)) {
// update the previous document in tern to prevent stale files.
if (isDocumentDirty && previousDocument) {
var updateFilePromise = updateTernFile(previousDocument);
updateFilePromise.done(function () {
primePump(path, document.isUntitled());
addFilesDeferred.resolveWith(null, [_ternNodeDomain]);
});
} else {
addFilesDeferred.resolveWith(null, [_ternNodeDomain]);
}
isDocumentDirty = false;
return;
}
if (previousDocument && previousDocument.isDirty) {
updateTernFile(previousDocument);
}
isDocumentDirty = false;
resolvedFiles = {};
projectRoot = pr;
ensurePreferences();
deferredPreferences.done(function () {
if (file instanceof InMemoryFile) {
initTernServer(pr, []);
var hintsPromise = primePump(path, true);
hintsPromise.done(function () {
addFilesDeferred.resolveWith(null, [_ternNodeDomain]);
});
return;
}
FileSystem.resolve(dir, function (err, directory) {
if (err) {
console.error("Error resolving", dir);
addFilesDeferred.resolveWith(null);
return;
}
directory.getContents(function (err, contents) {
if (err) {
console.error("Error getting contents for", directory);
addFilesDeferred.resolveWith(null);
return;
}
var files = contents
.filter(function (entry) {
return entry.isFile && !isFileExcluded(entry);
})
.map(function (entry) {
return entry.fullPath;
});
initTernServer(dir, files);
var hintsPromise = primePump(path, false);
hintsPromise.done(function () {
if (!usingModules()) {
// Read the subdirectories of the new file's directory.
// Read them first in case there are too many files to
// read in the project.
addAllFilesAndSubdirectories(dir, function () {
// If the file is in the project root, then read
// all the files under the project root.
var currentDir = (dir + "/");
if (projectRoot && currentDir !== projectRoot &&
currentDir.indexOf(projectRoot) === 0) {
addAllFilesAndSubdirectories(projectRoot, function () {
// prime the pump again but this time don't wait
// for completion.
primePump(path, false);
addFilesDeferred.resolveWith(null, [_ternNodeDomain]);
});
} else {
addFilesDeferred.resolveWith(null, [_ternNodeDomain]);
}
});
} else {
addFilesDeferred.resolveWith(null, [_ternNodeDomain]);
}
});
});
});
});
}
|
javascript
|
{
"resource": ""
}
|
q17169
|
resetModule
|
train
|
function resetModule() {
function resetTernServer() {
if (_ternNodeDomain.ready()) {
_ternNodeDomain.exec('resetTernServer');
}
}
if (_ternNodeDomain) {
if (addFilesPromise) {
// If we're in the middle of added files, don't reset
// until we're done
addFilesPromise.done(resetTernServer).fail(resetTernServer);
} else {
resetTernServer();
}
}
}
|
javascript
|
{
"resource": ""
}
|
q17170
|
_maybeReset
|
train
|
function _maybeReset(session, document, force) {
var newTernModule;
// if we're in the middle of a reset, don't have to check
// the new module will be online soon
if (!resettingDeferred) {
// We don't reset if the debugging flag is set
// because it's easier to debug if the module isn't
// getting reset all the time.
if (currentModule.resetForced || force || (!config.noReset && ++_hintCount > MAX_HINTS)) {
if (config.debug) {
console.debug("Resetting tern module");
}
resettingDeferred = new $.Deferred();
newTernModule = new TernModule();
newTernModule.handleEditorChange(session, document, null);
newTernModule.whenReady(function () {
// reset the old module
currentModule.resetModule();
currentModule = newTernModule;
resettingDeferred.resolve(currentModule);
// all done reseting
resettingDeferred = null;
});
_hintCount = 0;
} else {
var d = new $.Deferred();
d.resolve(currentModule);
return d.promise();
}
}
return resettingDeferred.promise();
}
|
javascript
|
{
"resource": ""
}
|
q17171
|
requestParameterHint
|
train
|
function requestParameterHint(session, functionOffset) {
var $deferredHints = $.Deferred(),
fileInfo = getFileInfo(session, true),
offset = getOffset(session, fileInfo, functionOffset),
fnTypePromise = getTernFunctionType(fileInfo, offset);
$.when(fnTypePromise).done(
function (fnType) {
session.setFnType(fnType);
session.setFunctionCallPos(functionOffset);
$deferredHints.resolveWith(null, [fnType]);
}
).fail(function () {
$deferredHints.reject();
});
return $deferredHints.promise();
}
|
javascript
|
{
"resource": ""
}
|
q17172
|
requestHints
|
train
|
function requestHints(session, document) {
var $deferredHints = $.Deferred(),
hintPromise,
sessionType = session.getType(),
fileInfo = getFileInfo(session),
offset = getOffset(session, fileInfo, null);
_maybeReset(session, document);
hintPromise = getTernHints(fileInfo, offset, sessionType.property);
$.when(hintPromise).done(
function (completions, fnType) {
if (completions.completions) {
session.setTernHints(completions.completions);
session.setGuesses(null);
} else {
session.setTernHints([]);
session.setGuesses(completions.properties);
}
$deferredHints.resolveWith(null);
}
).fail(function () {
$deferredHints.reject();
});
return $deferredHints.promise();
}
|
javascript
|
{
"resource": ""
}
|
q17173
|
trackChange
|
train
|
function trackChange(changeList) {
var changed = documentChanges, i;
if (changed === null) {
documentChanges = changed = {from: changeList[0].from.line, to: changeList[0].from.line};
if (config.debug) {
console.debug("ScopeManager: document has changed");
}
}
for (i = 0; i < changeList.length; i++) {
var thisChange = changeList[i],
end = thisChange.from.line + (thisChange.text.length - 1);
if (thisChange.from.line < changed.to) {
changed.to = changed.to - (thisChange.to.line - end);
}
if (end >= changed.to) {
changed.to = end + 1;
}
if (changed.from > thisChange.from.line) {
changed.from = thisChange.from.line;
}
}
}
|
javascript
|
{
"resource": ""
}
|
q17174
|
_removeFailedInstallation
|
train
|
function _removeFailedInstallation(installDirectory) {
fs.remove(installDirectory, function (err) {
if (err) {
console.error("Error while removing directory after failed installation", installDirectory, err);
}
});
}
|
javascript
|
{
"resource": ""
}
|
q17175
|
_performInstall
|
train
|
function _performInstall(packagePath, installDirectory, validationResult, callback) {
validationResult.installedTo = installDirectory;
function fail(err) {
_removeFailedInstallation(installDirectory);
callback(err, null);
}
function finish() {
// The status may have already been set previously (as in the
// DISABLED case.
if (!validationResult.installationStatus) {
validationResult.installationStatus = Statuses.INSTALLED;
}
callback(null, validationResult);
}
fs.mkdirs(installDirectory, function (err) {
if (err) {
callback(err);
return;
}
var sourceDir = path.join(validationResult.extractDir, validationResult.commonPrefix);
fs.copy(sourceDir, installDirectory, function (err) {
if (err) {
return fail(err);
}
finish();
});
});
}
|
javascript
|
{
"resource": ""
}
|
q17176
|
_removeAndInstall
|
train
|
function _removeAndInstall(packagePath, installDirectory, validationResult, callback) {
// If this extension was previously installed but disabled, we will overwrite the
// previous installation in that directory.
fs.remove(installDirectory, function (err) {
if (err) {
callback(err);
return;
}
_performInstall(packagePath, installDirectory, validationResult, callback);
});
}
|
javascript
|
{
"resource": ""
}
|
q17177
|
legacyPackageCheck
|
train
|
function legacyPackageCheck(legacyDirectory) {
return fs.existsSync(legacyDirectory) && !fs.existsSync(path.join(legacyDirectory, "package.json"));
}
|
javascript
|
{
"resource": ""
}
|
q17178
|
_cmdInstall
|
train
|
function _cmdInstall(packagePath, destinationDirectory, options, callback, pCallback, _doUpdate) {
if (!options || !options.disabledDirectory || !options.apiVersion || !options.systemExtensionDirectory) {
callback(new Error(Errors.MISSING_REQUIRED_OPTIONS), null);
return;
}
function validateCallback(err, validationResult) {
validationResult.localPath = packagePath;
// This is a wrapper for the callback that will delete the temporary
// directory to which the package was unzipped.
function deleteTempAndCallback(err) {
if (validationResult.extractDir) {
fs.remove(validationResult.extractDir);
delete validationResult.extractDir;
}
callback(err, validationResult);
}
// If there was trouble at the validation stage, we stop right away.
if (err || validationResult.errors.length > 0) {
validationResult.installationStatus = Statuses.FAILED;
deleteTempAndCallback(err);
return;
}
// Prefers the package.json name field, but will take the zip
// file's name if that's all that's available.
var extensionName, guessedName;
if (options.nameHint) {
guessedName = path.basename(options.nameHint, ".zip");
} else {
guessedName = path.basename(packagePath, ".zip");
}
if (validationResult.metadata) {
extensionName = validationResult.metadata.name;
} else {
extensionName = guessedName;
}
validationResult.name = extensionName;
var installDirectory = path.join(destinationDirectory, extensionName),
legacyDirectory = path.join(destinationDirectory, guessedName),
systemInstallDirectory = path.join(options.systemExtensionDirectory, extensionName);
if (validationResult.metadata && validationResult.metadata.engines &&
validationResult.metadata.engines.brackets) {
var compatible = semver.satisfies(options.apiVersion,
validationResult.metadata.engines.brackets);
if (!compatible) {
installDirectory = path.join(options.disabledDirectory, extensionName);
validationResult.installationStatus = Statuses.DISABLED;
validationResult.disabledReason = Errors.API_NOT_COMPATIBLE;
_removeAndInstall(packagePath, installDirectory, validationResult, deleteTempAndCallback);
return;
}
}
// The "legacy" stuff should go away after all of the commonly used extensions
// have been upgraded with package.json files.
var hasLegacyPackage = validationResult.metadata && legacyPackageCheck(legacyDirectory);
// If the extension is already there, we signal to the front end that it's already installed
// unless the front end has signaled an intent to update.
if (hasLegacyPackage || fs.existsSync(installDirectory) || fs.existsSync(systemInstallDirectory)) {
if (_doUpdate === true) {
if (hasLegacyPackage) {
// When there's a legacy installed extension, remove it first,
// then also remove any new-style directory the user may have.
// This helps clean up if the user is in a state where they have
// both legacy and new extensions installed.
fs.remove(legacyDirectory, function (err) {
if (err) {
deleteTempAndCallback(err);
return;
}
_removeAndInstall(packagePath, installDirectory, validationResult, deleteTempAndCallback);
});
} else {
_removeAndInstall(packagePath, installDirectory, validationResult, deleteTempAndCallback);
}
} else if (hasLegacyPackage) {
validationResult.installationStatus = Statuses.NEEDS_UPDATE;
validationResult.name = guessedName;
deleteTempAndCallback(null);
} else {
_checkExistingInstallation(validationResult, installDirectory, systemInstallDirectory, deleteTempAndCallback);
}
} else {
// Regular installation with no conflicts.
validationResult.disabledReason = null;
_performInstall(packagePath, installDirectory, validationResult, deleteTempAndCallback);
}
}
validate(packagePath, options, validateCallback);
}
|
javascript
|
{
"resource": ""
}
|
q17179
|
deleteTempAndCallback
|
train
|
function deleteTempAndCallback(err) {
if (validationResult.extractDir) {
fs.remove(validationResult.extractDir);
delete validationResult.extractDir;
}
callback(err, validationResult);
}
|
javascript
|
{
"resource": ""
}
|
q17180
|
_cmdUpdate
|
train
|
function _cmdUpdate(packagePath, destinationDirectory, options, callback, pCallback) {
_cmdInstall(packagePath, destinationDirectory, options, callback, pCallback, true);
}
|
javascript
|
{
"resource": ""
}
|
q17181
|
_cmdDownloadFile
|
train
|
function _cmdDownloadFile(downloadId, url, proxy, callback, pCallback) {
// Backwards compatibility check, added in 0.37
if (typeof proxy === "function") {
callback = proxy;
proxy = undefined;
}
if (pendingDownloads[downloadId]) {
callback(Errors.DOWNLOAD_ID_IN_USE, null);
return;
}
var req = request.get({
url: url,
encoding: null,
proxy: proxy
},
// Note: we could use the traditional "response"/"data"/"end" events too if we wanted to stream data
// incrementally, limit download size, etc. - but the simple callback is good enough for our needs.
function (error, response, body) {
if (error) {
// Usually means we never got a response - server is down, no DNS entry, etc.
_endDownload(downloadId, Errors.NO_SERVER_RESPONSE);
return;
}
if (response.statusCode !== 200) {
_endDownload(downloadId, [Errors.BAD_HTTP_STATUS, response.statusCode]);
return;
}
var stream = temp.createWriteStream("brackets");
if (!stream) {
_endDownload(downloadId, Errors.CANNOT_WRITE_TEMP);
return;
}
pendingDownloads[downloadId].localPath = stream.path;
pendingDownloads[downloadId].outStream = stream;
stream.write(body);
_endDownload(downloadId);
});
pendingDownloads[downloadId] = { request: req, callback: callback };
}
|
javascript
|
{
"resource": ""
}
|
q17182
|
_cmdAbortDownload
|
train
|
function _cmdAbortDownload(downloadId) {
if (!pendingDownloads[downloadId]) {
// This may mean the download already completed
return false;
} else {
_endDownload(downloadId, Errors.CANCELED);
return true;
}
}
|
javascript
|
{
"resource": ""
}
|
q17183
|
_cmdRemove
|
train
|
function _cmdRemove(extensionDir, callback, pCallback) {
fs.remove(extensionDir, function (err) {
if (err) {
callback(err);
} else {
callback(null);
}
});
}
|
javascript
|
{
"resource": ""
}
|
q17184
|
registerProtocolAdapter
|
train
|
function registerProtocolAdapter(protocol, adapter) {
var adapters;
if (protocol) {
adapters = _fileProtocolPlugins[protocol] || [];
adapters.push(adapter);
// We will keep a sorted adapter list on 'priority'
// If priority is not provided a default of '0' is assumed
adapters.sort(function (a, b) {
return (b.priority || 0) - (a.priority || 0);
});
_fileProtocolPlugins[protocol] = adapters;
}
}
|
javascript
|
{
"resource": ""
}
|
q17185
|
downloadRegistry
|
train
|
function downloadRegistry() {
if (pendingDownloadRegistry) {
return pendingDownloadRegistry.promise();
}
pendingDownloadRegistry = new $.Deferred();
$.ajax({
url: brackets.config.extension_registry,
dataType: "json",
cache: false
})
.done(function (data) {
exports.hasDownloadedRegistry = true;
Object.keys(data).forEach(function (id) {
if (!extensions[id]) {
extensions[id] = {};
}
extensions[id].registryInfo = data[id];
synchronizeEntry(id);
});
exports.trigger("registryDownload");
pendingDownloadRegistry.resolve();
})
.fail(function () {
pendingDownloadRegistry.reject();
})
.always(function () {
// Make sure to clean up the pending registry so that new requests can be made.
pendingDownloadRegistry = null;
});
return pendingDownloadRegistry.promise();
}
|
javascript
|
{
"resource": ""
}
|
q17186
|
getCompatibilityInfo
|
train
|
function getCompatibilityInfo(entry, apiVersion) {
if (!entry.versions) {
var fallback = getCompatibilityInfoForVersion(entry.metadata, apiVersion);
if (fallback.isCompatible) {
fallback.isLatestVersion = true;
}
return fallback;
}
var i = entry.versions.length - 1,
latestInfo = getCompatibilityInfoForVersion(entry.versions[i], apiVersion);
if (latestInfo.isCompatible) {
latestInfo.isLatestVersion = true;
return latestInfo;
} else {
// Look at earlier versions (skipping very latest version since we already checked it)
for (i--; i >= 0; i--) {
var compatInfo = getCompatibilityInfoForVersion(entry.versions[i], apiVersion);
if (compatInfo.isCompatible) {
compatInfo.isLatestVersion = false;
compatInfo.requiresNewer = latestInfo.requiresNewer;
return compatInfo;
}
}
// No version is compatible, so just return info for the latest version
return latestInfo;
}
}
|
javascript
|
{
"resource": ""
}
|
q17187
|
getExtensionURL
|
train
|
function getExtensionURL(id, version) {
return StringUtils.format(brackets.config.extension_url, id, version);
}
|
javascript
|
{
"resource": ""
}
|
q17188
|
remove
|
train
|
function remove(id) {
var result = new $.Deferred();
if (extensions[id] && extensions[id].installInfo) {
Package.remove(extensions[id].installInfo.path)
.done(function () {
extensions[id].installInfo = null;
result.resolve();
exports.trigger("statusChange", id);
})
.fail(function (err) {
result.reject(err);
});
} else {
result.reject(StringUtils.format(Strings.EXTENSION_NOT_INSTALLED, id));
}
return result.promise();
}
|
javascript
|
{
"resource": ""
}
|
q17189
|
update
|
train
|
function update(id, packagePath, keepFile) {
return Package.installUpdate(packagePath, id).done(function () {
if (!keepFile) {
FileSystem.getFileForPath(packagePath).unlink();
}
});
}
|
javascript
|
{
"resource": ""
}
|
q17190
|
cleanupUpdates
|
train
|
function cleanupUpdates() {
Object.keys(_idsToUpdate).forEach(function (id) {
var installResult = _idsToUpdate[id],
keepFile = installResult.keepFile,
filename = installResult.localPath;
if (filename && !keepFile) {
FileSystem.getFileForPath(filename).unlink();
}
});
_idsToUpdate = {};
}
|
javascript
|
{
"resource": ""
}
|
q17191
|
markForRemoval
|
train
|
function markForRemoval(id, mark) {
if (mark) {
_idsToRemove[id] = true;
} else {
delete _idsToRemove[id];
}
exports.trigger("statusChange", id);
}
|
javascript
|
{
"resource": ""
}
|
q17192
|
markForDisabling
|
train
|
function markForDisabling(id, mark) {
if (mark) {
_idsToDisable[id] = true;
} else {
delete _idsToDisable[id];
}
exports.trigger("statusChange", id);
}
|
javascript
|
{
"resource": ""
}
|
q17193
|
updateFromDownload
|
train
|
function updateFromDownload(installationResult) {
if (installationResult.keepFile === undefined) {
installationResult.keepFile = false;
}
var installationStatus = installationResult.installationStatus;
if (installationStatus === Package.InstallationStatuses.ALREADY_INSTALLED ||
installationStatus === Package.InstallationStatuses.NEEDS_UPDATE ||
installationStatus === Package.InstallationStatuses.SAME_VERSION ||
installationStatus === Package.InstallationStatuses.OLDER_VERSION) {
var id = installationResult.name;
delete _idsToRemove[id];
_idsToUpdate[id] = installationResult;
exports.trigger("statusChange", id);
}
}
|
javascript
|
{
"resource": ""
}
|
q17194
|
removeUpdate
|
train
|
function removeUpdate(id) {
var installationResult = _idsToUpdate[id];
if (!installationResult) {
return;
}
if (installationResult.localPath && !installationResult.keepFile) {
FileSystem.getFileForPath(installationResult.localPath).unlink();
}
delete _idsToUpdate[id];
exports.trigger("statusChange", id);
}
|
javascript
|
{
"resource": ""
}
|
q17195
|
updateExtensions
|
train
|
function updateExtensions() {
return Async.doInParallel_aggregateErrors(
Object.keys(_idsToUpdate),
function (id) {
var installationResult = _idsToUpdate[id];
return update(installationResult.name, installationResult.localPath, installationResult.keepFile);
}
);
}
|
javascript
|
{
"resource": ""
}
|
q17196
|
getAvailableUpdates
|
train
|
function getAvailableUpdates() {
var result = [];
Object.keys(extensions).forEach(function (extensionId) {
var extensionInfo = extensions[extensionId];
// skip extensions that are not installed or are not in the registry
if (!extensionInfo.installInfo || !extensionInfo.registryInfo) {
return;
}
if (extensionInfo.registryInfo.updateCompatible) {
result.push({
id: extensionId,
installVersion: extensionInfo.installInfo.metadata.version,
registryVersion: extensionInfo.registryInfo.lastCompatibleVersion
});
}
});
return result;
}
|
javascript
|
{
"resource": ""
}
|
q17197
|
extract
|
train
|
function extract(scopes, parentStatement, expns, text, insertPosition) {
var varType = "var",
varName = RefactoringUtils.getUniqueIdentifierName(scopes, "extracted"),
varDeclaration = varType + " " + varName + " = " + text + ";\n",
parentStatementStartPos = session.editor.posFromIndex(parentStatement.start),
insertStartPos = insertPosition || parentStatementStartPos,
selections = [],
doc = session.editor.document,
replaceExpnIndex = 0,
posToIndent,
edits = [];
// If parent statement is expression statement, then just append var declaration
// Ex: "add(1, 2)" will become "var extracted = add(1, 2)"
if (parentStatement.type === "ExpressionStatement" &&
RefactoringUtils.isEqual(parentStatement.expression, expns[0]) &&
insertStartPos.line === parentStatementStartPos.line &&
insertStartPos.ch === parentStatementStartPos.ch) {
varDeclaration = varType + " " + varName + " = ";
replaceExpnIndex = 1;
}
posToIndent = doc.adjustPosForChange(insertStartPos, varDeclaration.split("\n"), insertStartPos, insertStartPos);
// adjust pos for change
for (var i = replaceExpnIndex; i < expns.length; ++i) {
expns[i].start = session.editor.posFromIndex(expns[i].start);
expns[i].end = session.editor.posFromIndex(expns[i].end);
expns[i].start = doc.adjustPosForChange(expns[i].start, varDeclaration.split("\n"), insertStartPos, insertStartPos);
expns[i].end = doc.adjustPosForChange(expns[i].end, varDeclaration.split("\n"), insertStartPos, insertStartPos);
edits.push({
edit: {
text: varName,
start: expns[i].start,
end: expns[i].end
},
selection: {
start: expns[i].start,
end: {line: expns[i].start.line, ch: expns[i].start.ch + varName.length}
}
});
}
// Replace and multi-select
doc.batchOperation(function() {
doc.replaceRange(varDeclaration, insertStartPos);
selections = doc.doMultipleEdits(edits);
selections.push({
start: {line: insertStartPos.line, ch: insertStartPos.ch + varType.length + 1},
end: {line: insertStartPos.line, ch: insertStartPos.ch + varType.length + varName.length + 1},
primary: true
});
session.editor.setSelections(selections);
session.editor._codeMirror.indentLine(posToIndent.line, "smart");
});
}
|
javascript
|
{
"resource": ""
}
|
q17198
|
findAllExpressions
|
train
|
function findAllExpressions(parentBlockStatement, expn, text) {
var doc = session.editor.document,
obj = {},
expns = [];
// find all references of the expression
obj[expn.type] = function(node) {
if (text === doc.getText().substr(node.start, node.end - node.start)) {
expns.push(node);
}
};
ASTWalker.simple(parentBlockStatement, obj);
return expns;
}
|
javascript
|
{
"resource": ""
}
|
q17199
|
getExpressions
|
train
|
function getExpressions(ast, start, end) {
var expns = [],
s = start,
e = end,
expn;
while (true) {
expn = RefactoringUtils.findSurroundExpression(ast, {start: s, end: e});
if (!expn) {
break;
}
expns.push(expn);
s = expn.start - 1;
}
s = start;
e = end;
function checkExpnEquality(e) {
return e.start === expn.start && e.end === expn.end;
}
while (true) {
expn = RefactoringUtils.findSurroundExpression(ast, {start: s, end: e});
if (!expn) {
break;
}
e = expn.end + 1;
// if expn already added, continue
if (expns.find(checkExpnEquality)) {
continue;
}
expns.push(expn);
}
return expns;
}
|
javascript
|
{
"resource": ""
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.