_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
52
373k
language
stringclasses
1 value
meta_information
dict
q17200
removeMenuItemEventListeners
train
function removeMenuItemEventListeners(menuItem) { menuItem._command .off("enabledStateChange", menuItem._enabledChanged) .off("checkedStateChange", menuItem._checkedChanged) .off("nameChange", menuItem._nameChanged) .off("keyBindingAdded", menuItem._keyBindingAdde...
javascript
{ "resource": "" }
q17201
_insertInList
train
function _insertInList($list, $element, position, $relativeElement) { // Determine where to insert. Default is LAST. var inserted = false; if (position) { // Adjust relative position for menu section positions since $relativeElement // has already been resolved by _getRe...
javascript
{ "resource": "" }
q17202
MenuItem
train
function MenuItem(id, command) { this.id = id; this.isDivider = (command === DIVIDER); this.isNative = false; if (!this.isDivider && command !== SUBMENU) { // Bind event handlers this._enabledChanged = this._enabledChanged.bind(this); this._checkedCha...
javascript
{ "resource": "" }
q17203
addMenu
train
function addMenu(name, id, position, relativeID) { name = _.escape(name); var $menubar = $("#titlebar .nav"), menu; if (!name || !id) { console.error("call to addMenu() is missing required parameters"); return null; } // Guard against duplica...
javascript
{ "resource": "" }
q17204
removeMenu
train
function removeMenu(id) { var menu, commandID = ""; if (!id) { console.error("removeMenu(): missing required parameter: id"); return; } if (!menuMap[id]) { console.error("removeMenu(): menu id not found: %s", id); return; ...
javascript
{ "resource": "" }
q17205
ContextMenu
train
function ContextMenu(id) { Menu.apply(this, arguments); var $newMenu = $("<li class='dropdown context-menu' id='" + StringUtils.jQueryIdEscape(id) + "'></li>"), $popUp = $("<ul class='dropdown-menu'></ul>"), $toggle = $("<a href='#' class='dropdown-toggle' data-toggle='dropdown'...
javascript
{ "resource": "" }
q17206
registerContextMenu
train
function registerContextMenu(id) { if (!id) { console.error("call to registerContextMenu() is missing required parameters"); return null; } // Guard against duplicate menu ids if (contextMenuMap[id]) { console.log("Context Menu added with same name an...
javascript
{ "resource": "" }
q17207
getServer
train
function getServer(localPath) { var provider, server, i; for (i = 0; i < _serverProviders.length; i++) { provider = _serverProviders[i]; server = provider.create(); if (server.canServe(localPath)) { return server; } } ret...
javascript
{ "resource": "" }
q17208
registerServer
train
function registerServer(provider, priority) { if (!provider.create) { console.error("Incompatible live development server provider"); return; } var providerObj = {}; providerObj.create = provider.create; providerObj.priority = priority || 0; _se...
javascript
{ "resource": "" }
q17209
removeServer
train
function removeServer(provider) { var i; for (i = 0; i < _serverProviders.length; i++) { if (provider === _serverProviders[i]) { _serverProviders.splice(i, 1); } } }
javascript
{ "resource": "" }
q17210
settingsToRegExp
train
function settingsToRegExp(settings, baseRegExp, defaultRegExp) { var regExpString = ""; if (settings instanceof Array && settings.length > 0) { // Append base settings to user settings. The base // settings are builtin and cannot be overridden. if (baseRegExp) { ...
javascript
{ "resource": "" }
q17211
Preferences
train
function Preferences(prefs) { var BASE_EXCLUDED_DIRECTORIES = null, /* if the user has settings, we don't exclude anything by default */ // exclude node_modules for performance reasons and because we don't do full hinting for those anyhow. DEFAULT_EXCLUDED_DIRECTORIES = /node_modules/, ...
javascript
{ "resource": "" }
q17212
InlineMenu
train
function InlineMenu(editor, menuText) { /** * The list of items to display * * @type {Array.<{id: number, name: string>} */ this.items = []; /** * The selected position in the list; otherwise -1. * * @type {number} */ ...
javascript
{ "resource": "" }
q17213
_findFileInMRUList
train
function _findFileInMRUList(paneId, file) { return _.findIndex(_mruList, function (record) { return (record.file.fullPath === file.fullPath && record.paneId === paneId); }); }
javascript
{ "resource": "" }
q17214
isExclusiveToPane
train
function isExclusiveToPane(file, paneId) { paneId = paneId === ACTIVE_PANE && _activePaneId ? _activePaneId : paneId; var index = _.findIndex(_mruList, function (record) { return (record.file.fullPath === file.fullPath && record.paneId !== paneId); }); return index === -1; ...
javascript
{ "resource": "" }
q17215
_getPane
train
function _getPane(paneId) { paneId = _resolvePaneId(paneId); if (_panes[paneId]) { return _panes[paneId]; } return null; }
javascript
{ "resource": "" }
q17216
_makeFileMostRecent
train
function _makeFileMostRecent(paneId, file) { var index, entry, pane = _getPane(paneId); if (!_traversingFileList) { pane.makeViewMostRecent(file); index = _findFileInMRUList(pane.id, file); entry = _makeMRUListEntry(file, pane.id); ...
javascript
{ "resource": "" }
q17217
_makePaneMostRecent
train
function _makePaneMostRecent(paneId) { var pane = _getPane(paneId); if (pane.getCurrentlyViewedFile()) { _makeFileMostRecent(paneId, pane.getCurrentlyViewedFile()); } }
javascript
{ "resource": "" }
q17218
_activeEditorChange
train
function _activeEditorChange(e, current) { if (current) { var $container = current.$el.parent().parent(), pane = _getPaneFromElement($container); if (pane) { // Editor is a full editor if (pane.id !== _activePaneId) { /...
javascript
{ "resource": "" }
q17219
_forEachPaneOrPanes
train
function _forEachPaneOrPanes(paneId, callback) { if (paneId === ALL_PANES) { _.forEach(_panes, callback); } else { callback(_getPane(paneId)); } }
javascript
{ "resource": "" }
q17220
cacheScrollState
train
function cacheScrollState(paneId) { _forEachPaneOrPanes(paneId, function (pane) { _paneScrollStates[pane.id] = pane.getScrollState(); }); }
javascript
{ "resource": "" }
q17221
restoreAdjustedScrollState
train
function restoreAdjustedScrollState(paneId, heightDelta) { _forEachPaneOrPanes(paneId, function (pane) { pane.restoreAndAdjustScrollState(_paneScrollStates[pane.id], heightDelta); delete _paneScrollStates[pane.id]; }); }
javascript
{ "resource": "" }
q17222
getWorkingSet
train
function getWorkingSet(paneId) { var result = []; _forEachPaneOrPanes(paneId, function (pane) { var viewList = pane.getViewList(); result = _.union(result, viewList); }); return result; }
javascript
{ "resource": "" }
q17223
getAllOpenFiles
train
function getAllOpenFiles() { var result = getWorkingSet(ALL_PANES); _.forEach(_panes, function (pane) { var file = pane.getCurrentlyViewedFile(); if (file) { result = _.union(result, [file]); } }); return result; }
javascript
{ "resource": "" }
q17224
getWorkingSetSize
train
function getWorkingSetSize(paneId) { var result = 0; _forEachPaneOrPanes(paneId, function (pane) { result += pane.getViewListSize(); }); return result; }
javascript
{ "resource": "" }
q17225
findInAllWorkingSets
train
function findInAllWorkingSets(fullPath) { var index, result = []; _.forEach(_panes, function (pane) { index = pane.findInViewList(fullPath); if (index >= 0) { result.push({paneId: pane.id, index: index}); } }); return resu...
javascript
{ "resource": "" }
q17226
addToWorkingSet
train
function addToWorkingSet(paneId, file, index, force) { // look for the file to have already been added to another pane var pane = _getPane(paneId); if (!pane) { throw new Error("invalid pane id: " + paneId); } var result = pane.reorderItem(file, index, force), ...
javascript
{ "resource": "" }
q17227
addListToWorkingSet
train
function addListToWorkingSet(paneId, fileList) { var uniqueFileList, pane = _getPane(paneId); uniqueFileList = pane.addListToViewList(fileList); uniqueFileList.forEach(function (file) { if (_findFileInMRUList(pane.id, file) !== -1) { console.log(file.ful...
javascript
{ "resource": "" }
q17228
_removeFileFromMRU
train
function _removeFileFromMRU(paneId, file) { var index, compare = function (record) { return (record.file === file && record.paneId === paneId); }; // find and remove all instances do { index = _.findIndex(_mruList, compare); if (in...
javascript
{ "resource": "" }
q17229
_removeView
train
function _removeView(paneId, file, suppressRedraw) { var pane = _getPane(paneId); if (pane.removeView(file)) { _removeFileFromMRU(pane.id, file); exports.trigger("workingSetRemove", file, suppressRedraw, pane.id); } }
javascript
{ "resource": "" }
q17230
_moveView
train
function _moveView(sourcePaneId, destinationPaneId, file, destinationIndex) { var result = new $.Deferred(), sourcePane = _getPane(sourcePaneId), destinationPane = _getPane(destinationPaneId); sourcePane.moveView(file, destinationPane, destinationIndex) .done(functio...
javascript
{ "resource": "" }
q17231
_removeDeletedFileFromMRU
train
function _removeDeletedFileFromMRU(e, fullPath) { var index, compare = function (record) { return (record.file.fullPath === fullPath); }; // find and remove all instances do { index = _.findIndex(_mruList, compare); if (index !== -...
javascript
{ "resource": "" }
q17232
_sortWorkingSet
train
function _sortWorkingSet(paneId, compareFn) { _forEachPaneOrPanes(paneId, function (pane) { pane.sortViewList(compareFn); exports.trigger("workingSetSort", pane.id); }); }
javascript
{ "resource": "" }
q17233
_moveWorkingSetItem
train
function _moveWorkingSetItem(paneId, fromIndex, toIndex) { var pane = _getPane(paneId); pane.moveWorkingSetItem(fromIndex, toIndex); exports.trigger("workingSetSort", pane.id); exports.trigger("_workingSetDisableAutoSort", pane.id); }
javascript
{ "resource": "" }
q17234
_swapWorkingSetListIndexes
train
function _swapWorkingSetListIndexes(paneId, index1, index2) { var pane = _getPane(paneId); pane.swapViewListIndexes(index1, index2); exports.trigger("workingSetSort", pane.id); exports.trigger("_workingSetDisableAutoSort", pane.id); }
javascript
{ "resource": "" }
q17235
traverseToNextViewByMRU
train
function traverseToNextViewByMRU(direction) { var file = getCurrentlyViewedFile(), paneId = getActivePaneId(), index = _.findIndex(_mruList, function (record) { return (record.file === file && record.paneId === paneId); }); return ViewUtils.traverseVi...
javascript
{ "resource": "" }
q17236
traverseToNextViewInListOrder
train
function traverseToNextViewInListOrder(direction) { var file = getCurrentlyViewedFile(), curPaneId = getActivePaneId(), allFiles = [], index; getPaneIdList().forEach(function (paneId) { var paneFiles = getWorkingSet(paneId).map(function (file) { ...
javascript
{ "resource": "" }
q17237
_synchronizePaneSize
train
function _synchronizePaneSize(pane, forceRefresh) { var available; if (_orientation === VERTICAL) { available = _$el.innerWidth(); } else { available = _$el.innerHeight(); } // Update the pane's sizer element if it has one and update the max size ...
javascript
{ "resource": "" }
q17238
_updateLayout
train
function _updateLayout(event, viewAreaHeight, forceRefresh) { var available; if (_orientation === VERTICAL) { available = _$el.innerWidth(); } else { available = _$el.innerHeight(); } _.forEach(_panes, function (pane) { // For VERTICAL orient...
javascript
{ "resource": "" }
q17239
_initialLayout
train
function _initialLayout(forceRefresh) { var panes = Object.keys(_panes), size = 100 / panes.length; _.forEach(_panes, function (pane) { if (pane.id === FIRST_PANE) { if (_orientation === VERTICAL) { pane.$el.css({height: "100%", ...
javascript
{ "resource": "" }
q17240
_createPaneIfNecessary
train
function _createPaneIfNecessary(paneId) { var newPane; if (!_panes.hasOwnProperty(paneId)) { newPane = new Pane(paneId, _$el); _panes[paneId] = newPane; exports.trigger("paneCreate", newPane.id); newPane.$el.on("click.mainview dragover.mainview", functi...
javascript
{ "resource": "" }
q17241
_makeFirstPaneResizable
train
function _makeFirstPaneResizable() { var firstPane = _panes[FIRST_PANE]; Resizer.makeResizable(firstPane.$el, _orientation === HORIZONTAL ? Resizer.DIRECTION_VERTICAL : Resizer.DIRECTION_HORIZONTAL, _orientation === HORIZONTAL ? Resizer.POSITIO...
javascript
{ "resource": "" }
q17242
_doSplit
train
function _doSplit(orientation) { var firstPane, newPane; if (orientation === _orientation) { return; } firstPane = _panes[FIRST_PANE]; Resizer.removeSizable(firstPane.$el); if (_orientation) { _$el.removeClass("split-" + _orientation.toLowerCase...
javascript
{ "resource": "" }
q17243
_open
train
function _open(paneId, file, optionsIn) { var result = new $.Deferred(), options = optionsIn || {}; function doPostOpenActivation() { if (!options.noPaneActivate) { setActivePaneId(paneId); } } if (!file || !_getPane(paneId)) { ...
javascript
{ "resource": "" }
q17244
_mergePanes
train
function _mergePanes() { if (_panes.hasOwnProperty(SECOND_PANE)) { var firstPane = _panes[FIRST_PANE], secondPane = _panes[SECOND_PANE], fileList = secondPane.getViewList(), lastViewed = getCurrentlyViewedFile(); Resizer.removeSizable(fir...
javascript
{ "resource": "" }
q17245
_close
train
function _close(paneId, file, optionsIn) { var options = optionsIn || {}; _forEachPaneOrPanes(paneId, function (pane) { if (pane.removeView(file, options.noOpenNextFile) && (paneId === ACTIVE_PANE || pane.id === paneId)) { _removeFileFromMRU(pane.id, file); ex...
javascript
{ "resource": "" }
q17246
_closeList
train
function _closeList(paneId, fileList) { _forEachPaneOrPanes(paneId, function (pane) { var closedList = pane.removeViews(fileList); closedList.forEach(function (file) { _removeFileFromMRU(pane.id, file); }); exports.trigger("workingSetRemoveList", ...
javascript
{ "resource": "" }
q17247
_closeAll
train
function _closeAll(paneId) { _forEachPaneOrPanes(paneId, function (pane) { var closedList = pane.getViewList(); closedList.forEach(function (file) { _removeFileFromMRU(pane.id, file); }); pane._reset(); exports.trigger("workingSetRemov...
javascript
{ "resource": "" }
q17248
_findPaneForDocument
train
function _findPaneForDocument(document) { // First check for an editor view of the document var pane = _getPaneFromElement($(document._masterEditor.$el.parent().parent())); if (!pane) { // No view of the document, it may be in a working set and not yet opened var info = ...
javascript
{ "resource": "" }
q17249
_destroyEditorIfNotNeeded
train
function _destroyEditorIfNotNeeded(document) { if (!(document instanceof DocumentManager.Document)) { throw new Error("_destroyEditorIfUnneeded() should be passed a Document"); } if (document._masterEditor) { // findPaneForDocument tries to locate the pane in which the do...
javascript
{ "resource": "" }
q17250
_saveViewState
train
function _saveViewState() { function _computeSplitPercentage() { var available, used; if (getPaneCount() === 1) { // just short-circuit here and // return 100% to avoid any rounding issues return 1; } else { ...
javascript
{ "resource": "" }
q17251
_initialize
train
function _initialize($container) { if (_activePaneId) { throw new Error("MainViewManager has already been initialized"); } _$el = $container; _createPaneIfNecessary(FIRST_PANE); _activePaneId = FIRST_PANE; // One-time init so the pane has the "active" appeara...
javascript
{ "resource": "" }
q17252
setLayoutScheme
train
function setLayoutScheme(rows, columns) { if ((rows < 1) || (rows > 2) || (columns < 1) || (columns > 2) || (columns === 2 && rows === 2)) { console.error("setLayoutScheme unsupported layout " + rows + ", " + columns); return false; } if (rows === columns) { ...
javascript
{ "resource": "" }
q17253
getLayoutScheme
train
function getLayoutScheme() { var result = { rows: 1, columns: 1 }; if (_orientation === HORIZONTAL) { result.rows = 2; } else if (_orientation === VERTICAL) { result.columns = 2; } return result; }
javascript
{ "resource": "" }
q17254
InlineTimingFunctionEditor
train
function InlineTimingFunctionEditor(timingFunction, startBookmark, endBookmark) { this._timingFunction = timingFunction; this._startBookmark = startBookmark; this._endBookmark = endBookmark; this._isOwnChange = false; this._isHostChange = false; this._origin = "+InlineTim...
javascript
{ "resource": "" }
q17255
performNpmInstallIfRequired
train
function performNpmInstallIfRequired(npmOptions, validationResult, callback) { function finish() { callback(null, validationResult); } var installDirectory = path.join(validationResult.extractDir, validationResult.commonPrefix); var packageJson; try { packageJson = fs.readJsonSync...
javascript
{ "resource": "" }
q17256
showDialog
train
function showDialog() { var currentSettings = getValues(); var newSettings = {}; var themes = _.map(loadedThemes, function (theme) { return theme; }); var template = $("<div>").append($settings).html(); var $template = $(Mustache.render(template, {"setti...
javascript
{ "resource": "" }
q17257
getCurrentDocument
train
function getCurrentDocument() { var file = MainViewManager.getCurrentlyViewedFile(MainViewManager.ACTIVE_PANE); if (file) { return getOpenDocumentForPath(file.fullPath); } return null; }
javascript
{ "resource": "" }
q17258
getWorkingSet
train
function getWorkingSet() { DeprecationWarning.deprecationWarning("Use MainViewManager.getWorkingSet() instead of DocumentManager.getWorkingSet()", true); return MainViewManager.getWorkingSet(MainViewManager.ALL_PANES) .filter(function (file) { // Legacy didn't allow for files...
javascript
{ "resource": "" }
q17259
findInWorkingSet
train
function findInWorkingSet(fullPath) { DeprecationWarning.deprecationWarning("Use MainViewManager.findInWorkingSet() instead of DocumentManager.findInWorkingSet()", true); return MainViewManager.findInWorkingSet(MainViewManager.ACTIVE_PANE, fullPath); }
javascript
{ "resource": "" }
q17260
addToWorkingSet
train
function addToWorkingSet(file, index, forceRedraw) { DeprecationWarning.deprecationWarning("Use MainViewManager.addToWorkingSet() instead of DocumentManager.addToWorkingSet()", true); MainViewManager.addToWorkingSet(MainViewManager.ACTIVE_PANE, file, index, forceRedraw); }
javascript
{ "resource": "" }
q17261
removeListFromWorkingSet
train
function removeListFromWorkingSet(list) { DeprecationWarning.deprecationWarning("Use CommandManager.execute(Commands.FILE_CLOSE_LIST, {PaneId: MainViewManager.ALL_PANES, fileList: list}) instead of DocumentManager.removeListFromWorkingSet()", true); CommandManager.execute(Commands.FILE_CLOSE_LIST, {Pane...
javascript
{ "resource": "" }
q17262
closeAll
train
function closeAll() { DeprecationWarning.deprecationWarning("Use CommandManager.execute(Commands.FILE_CLOSE_ALL,{PaneId: MainViewManager.ALL_PANES}) instead of DocumentManager.closeAll()", true); CommandManager.execute(Commands.FILE_CLOSE_ALL, {PaneId: MainViewManager.ALL_PANES}); }
javascript
{ "resource": "" }
q17263
closeFullEditor
train
function closeFullEditor(file) { DeprecationWarning.deprecationWarning("Use CommandManager.execute(Commands.FILE_CLOSE, {File: file} instead of DocumentManager.closeFullEditor()", true); CommandManager.execute(Commands.FILE_CLOSE, {File: file}); }
javascript
{ "resource": "" }
q17264
setCurrentDocument
train
function setCurrentDocument(doc) { DeprecationWarning.deprecationWarning("Use CommandManager.execute(Commands.CMD_OPEN) instead of DocumentManager.setCurrentDocument()", true); CommandManager.execute(Commands.CMD_OPEN, {fullPath: doc.file.fullPath}); }
javascript
{ "resource": "" }
q17265
notifyPathDeleted
train
function notifyPathDeleted(fullPath) { // FileSyncManager.syncOpenDocuments() does all the work prompting // the user to save any unsaved changes and then calls us back // via notifyFileDeleted FileSyncManager.syncOpenDocuments(Strings.FILE_DELETED_TITLE); var projectRoot = Pr...
javascript
{ "resource": "" }
q17266
notifyPathNameChanged
train
function notifyPathNameChanged(oldName, newName) { // Notify all open documents _.forEach(_openDocuments, function (doc) { // TODO: Only notify affected documents? For now _notifyFilePathChange // just updates the language if the extension changed, so it's fine // to ...
javascript
{ "resource": "" }
q17267
_proxyDeprecatedEvent
train
function _proxyDeprecatedEvent(eventName) { DeprecationWarning.deprecateEvent(exports, MainViewManager, eventName, eventName, ...
javascript
{ "resource": "" }
q17268
marker
train
function marker(spec) { var elt = window.document.createElement("div"); elt.className = spec; return elt; }
javascript
{ "resource": "" }
q17269
updateFoldInfo
train
function updateFoldInfo(cm, from, to) { var minFoldSize = prefs.getSetting("minFoldSize") || 2; var opts = cm.state.foldGutter.options; var fade = prefs.getSetting("hideUntilMouseover"); var $gutter = $(cm.getGutterElement()); var i = from; function clear(m) { ...
javascript
{ "resource": "" }
q17270
updateInViewport
train
function updateInViewport(cm, from, to) { var vp = cm.getViewport(), state = cm.state.foldGutter; from = isNaN(from) ? vp.from : from; to = isNaN(to) ? vp.to : to; if (!state) { return; } cm.operation(function () { updateFoldInfo(cm, from, to); }); st...
javascript
{ "resource": "" }
q17271
getFoldOnLine
train
function getFoldOnLine(cm, line) { var pos = CodeMirror.Pos(line, 0); var folds = cm.findMarksAt(pos) || []; folds = folds.filter(isFold); return folds.length ? folds[0] : undefined; }
javascript
{ "resource": "" }
q17272
syncDocToFoldsCache
train
function syncDocToFoldsCache(cm, from, lineAdded) { var minFoldSize = prefs.getSetting("minFoldSize") || 2; var i, fold, range; if (lineAdded <= 0) { return; } for (i = from; i <= from + lineAdded; i = i + 1) { fold = getFoldOnLine(cm, i); if ...
javascript
{ "resource": "" }
q17273
moveRange
train
function moveRange(range, numLines) { return {from: CodeMirror.Pos(range.from.line + numLines, range.from.ch), to: CodeMirror.Pos(range.to.line + numLines, range.to.ch)}; }
javascript
{ "resource": "" }
q17274
onCursorActivity
train
function onCursorActivity(cm) { var state = cm.state.foldGutter; var vp = cm.getViewport(); window.clearTimeout(state.changeUpdate); state.changeUpdate = window.setTimeout(function () { //need to render the entire visible viewport to remove fold marks rendered from previous s...
javascript
{ "resource": "" }
q17275
onFold
train
function onFold(cm, from, to) { var state = cm.state.foldGutter; updateFoldInfo(cm, from.line, from.line + 1); }
javascript
{ "resource": "" }
q17276
onUnFold
train
function onUnFold(cm, from, to) { var state = cm.state.foldGutter; var vp = cm.getViewport(); delete cm._lineFolds[from.line]; updateFoldInfo(cm, from.line, to.line || vp.to); }
javascript
{ "resource": "" }
q17277
init
train
function init() { CodeMirror.defineOption("foldGutter", false, function (cm, val, old) { if (old && old !== CodeMirror.Init) { cm.clearGutter(cm.state.foldGutter.options.gutter); cm.state.foldGutter = null; cm.off("gutterClick", old.onGutterClick); ...
javascript
{ "resource": "" }
q17278
_getCondensedForm
train
function _getCondensedForm(filter) { if (!_.isArray(filter)) { return ""; } // Format filter in condensed form if (filter.length > 2) { return filter.slice(0, 2).join(", ") + " " + StringUtils.format(Strings.FILE_FILTER_CLIPPED_SUFFIX, filter.l...
javascript
{ "resource": "" }
q17279
_doPopulate
train
function _doPopulate() { var dropdownItems = [Strings.NEW_FILE_FILTER, Strings.CLEAR_FILE_FILTER], filterSets = PreferencesManager.get("fileFilters") || []; if (filterSets.length) { dropdownItems.push("---"); // Remove all the empty exclusion sets before concatenati...
javascript
{ "resource": "" }
q17280
_getFilterIndex
train
function _getFilterIndex(filterSets, filter) { var index = -1; if (!filter || !filterSets.length) { return index; } return _.findIndex(filterSets, _.partial(_.isEqual, filter)); }
javascript
{ "resource": "" }
q17281
filterFileList
train
function filterFileList(compiledFilter, files) { if (!compiledFilter) { return files; } var re = new RegExp(compiledFilter); return files.filter(function (f) { return !re.test(f.fullPath); }); }
javascript
{ "resource": "" }
q17282
getPathsMatchingFilter
train
function getPathsMatchingFilter(compiledFilter, filePaths) { if (!compiledFilter) { return filePaths; } var re = new RegExp(compiledFilter); return filePaths.filter(function (f) { return f.match(re); }); }
javascript
{ "resource": "" }
q17283
_handleDeleteFilter
train
function _handleDeleteFilter(e) { // Remove the filter set from the preferences and // clear the active filter set index from view state. var filterSets = PreferencesManager.get("fileFilters") || [], activeFilterIndex = PreferencesManager.getViewState("activeFileFilter"), ...
javascript
{ "resource": "" }
q17284
_handleEditFilter
train
function _handleEditFilter(e) { var filterSets = PreferencesManager.get("fileFilters") || [], filterIndex = $(e.target).parent().data("index") - FIRST_FILTER_INDEX; // Don't let the click bubble upward. e.stopPropagation(); // Close the dropdown first before opening the ed...
javascript
{ "resource": "" }
q17285
_handleListRendered
train
function _handleListRendered(event, $dropdown) { var activeFilterIndex = PreferencesManager.getViewState("activeFileFilter"), checkedItemIndex = (activeFilterIndex > -1) ? (activeFilterIndex + FIRST_FILTER_INDEX) : -1; _picker.setChecked(checkedItemIndex, true); $dropdown.find(".fil...
javascript
{ "resource": "" }
q17286
searchAndShowResults
train
function searchAndShowResults(queryInfo, scope, filter, replaceText, candidateFilesPromise) { return FindInFiles.doSearchInScope(queryInfo, scope, filter, replaceText, candidateFilesPromise) .done(function (zeroFilesToken) { // Done searching all files: show results i...
javascript
{ "resource": "" }
q17287
searchAndReplaceResults
train
function searchAndReplaceResults(queryInfo, scope, filter, replaceText, candidateFilesPromise) { return FindInFiles.doSearchInScope(queryInfo, scope, filter, replaceText, candidateFilesPromise) .done(function (zeroFilesToken) { // Done searching all files: replace all ...
javascript
{ "resource": "" }
q17288
_defferedSearch
train
function _defferedSearch() { if (_findBar && _findBar._options.multifile && !_findBar._options.replace) { _findBar.redoInstantSearch(); } }
javascript
{ "resource": "" }
q17289
ModalBar
train
function ModalBar(template, autoClose, animate) { if (animate === undefined) { animate = true; } this._handleKeydown = this._handleKeydown.bind(this); this._handleFocusChange = this._handleFocusChange.bind(this); this._$root = $("<div class='modal-bar'/>") ...
javascript
{ "resource": "" }
q17290
simplify
train
function simplify(folds) { if (!folds) { return; } var res = {}, range; Object.keys(folds).forEach(function (line) { range = folds[line]; res[line] = Array.isArray(range) ? range : [[range.from.line, range.from.ch], [range.to.line, range.to.ch]]; ...
javascript
{ "resource": "" }
q17291
getFolds
train
function getFolds(path) { var context = getViewStateContext(); var folds = PreferencesManager.getViewState(FOLDS_PREF_KEY, context); return inflate(folds[path]); }
javascript
{ "resource": "" }
q17292
setFolds
train
function setFolds(path, folds) { var context = getViewStateContext(); var allFolds = PreferencesManager.getViewState(FOLDS_PREF_KEY, context); allFolds[path] = simplify(folds); PreferencesManager.setViewState(FOLDS_PREF_KEY, allFolds, context); }
javascript
{ "resource": "" }
q17293
_convertToNumber
train
function _convertToNumber(str) { if (typeof str !== "string") { return { isNumber: false, value: null }; } var val = parseFloat(+str, 10), isNum = (typeof val === "number") && !isNaN(val) && (val !== Infinity) && (val !== -Infinity); return {...
javascript
{ "resource": "" }
q17294
_getValidBezierParams
train
function _getValidBezierParams(match) { var param, // take ease-in-out as default value in case there are no params yet (or they are invalid) def = [ ".42", "0", ".58", "1" ], oldIndex = match.index, // we need to store the old match.index to re-set the index afterwards ...
javascript
{ "resource": "" }
q17295
_getValidStepsParams
train
function _getValidStepsParams(match) { var param, def = [ "5", "end" ], params = def, oldIndex = match.index, // we need to store the old match.index to re-set the index afterwards originalString = match[0]; if (match) { match = match[1].split...
javascript
{ "resource": "" }
q17296
showHideHint
train
function showHideHint(hint, show, documentCode, editorCode) { if (!hint || !hint.elem) { return; } if (show) { hint.shown = true; hint.animationInProgress = false; hint.elem.removeClass("fadeout"); hint.elem.html(StringUtils.format(Str...
javascript
{ "resource": "" }
q17297
_tagMatch
train
function _tagMatch(match, type) { switch (type) { case BEZIER: match.isBezier = true; break; case STEP: match.isStep = true; break; } return match; }
javascript
{ "resource": "" }
q17298
bezierCurveMatch
train
function bezierCurveMatch(str, lax) { var match; // First look for any cubic-bezier(). match = str.match(BEZIER_CURVE_VALID_REGEX); if (match && _validateCubicBezierParams(match)) { // cubic-bezier() with valid params return _tagMatch(match, BEZIER); } match...
javascript
{ "resource": "" }
q17299
stepsMatch
train
function stepsMatch(str, lax) { var match; // First look for any steps(). match = str.match(STEPS_VALID_REGEX); if (match && _validateStepsParams(match)) { // cubic-bezier() with valid params return _tagMatch(match, STEP); } match = str.match(STEPS_GENERAL_R...
javascript
{ "resource": "" }