_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.getDocumentForPa... | 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
// o... | 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.tok... | 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 = reduceStyleSheetFor... | 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._onW... | 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, ... | 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;
... | 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 selectio... | 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 = {};
... | 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);
c... | 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;
}
/... | 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(... | 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.
... | 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, co... | 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.ge... | 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+... | 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() {
... | 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"));
$mrof... | 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();
... | 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();
... | 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 (re... | 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);
}),... | 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 ... | 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;
_addToMRO... | 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);
... | 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) {
FileUt... | 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.... | 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.... | 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 (detectedExcl... | 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.getExclud... | 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();
}
... | 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... | 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())
}... | 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);
$defe... | 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,
fil... | 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,
... | 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;
... | 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.li... | 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
... | 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,
... | 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;
}
... | 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("Sen... | 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 addPending... | 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;
... | 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_PR... | 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 (... | 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
... | javascript | {
"resource": ""
} |
q17167 | initTernModule | train | function initTernModule() {
var moduleDeferred = $.Deferred();
ternPromise = moduleDeferred.promise();
function prepareTern() {
_ternNodeDomain.exec("setInterface", {
messageIds : MessageIds
});
_tern... | 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;
a... | javascript | {
"resource": ""
} |
q17169 | resetModule | train | function resetModule() {
function resetTernServer() {
if (_ternNodeDomain.ready()) {
_ternNodeDomain.exec('resetTernServer');
}
}
if (_ternNodeDomain) {
if (addFilesPromise) {
// If w... | 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 ... | 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... | 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 ... | 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");
... | 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 bee... | 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);
... | 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 validat... | 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);
... | 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... | 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
... | 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;
}
... | 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();
... | 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.getFileForPa... | 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... | 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();
}
dele... | 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 || !extensionInf... | 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 ... | 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 - no... | 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;
}
... | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.