_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
52
373k
language
stringclasses
1 value
meta_information
dict
q44100
get
train
function get(start, end) { var result = [], i; for (i = Math.max(0, start); i < end && i < length; i++) { result.push(tokens[i]); } return result; }
javascript
{ "resource": "" }
q44101
lastTokenIndex
train
function lastTokenIndex(node) { var end = node.range[1], cursor = ends[end]; // If the node extends beyond its last token, get the token before the // next token if (typeof cursor === "undefined") { cursor = starts[end] - 1; } // If there isn't a next token, the desired token is the last one...
javascript
{ "resource": "" }
q44102
executeBinding
train
function executeBinding(binding) { var invocation = binding.invocation; if (invocation) { var command = binding.command; if (typeof(command.hrefCallback) === 'function') { var href = command.hrefCallback.call(invocation.handler || window, invocation); if (href.then){ href.then(function(l){...
javascript
{ "resource": "" }
q44103
train
function(parent, items, handler, userData, commandService) { var choices = this.getChoices(items, handler, userData); var addCheck = choices.some(function(choice) { return choice.checked; }); choices.forEach(function(choice) { if (choice.name) { var itemNode = document.createElement("li"); //$N...
javascript
{ "resource": "" }
q44104
train
function(items, handler, userData) { if (this.choiceCallback) { return this.choiceCallback.call(handler, items, userData); } return null; }
javascript
{ "resource": "" }
q44105
train
function(choice, items) { return function(event) { if (choice.callback) { choice.callback.call(choice, items, event); } }; }
javascript
{ "resource": "" }
q44106
updateRightSide
train
function updateRightSide() { // Many pages use the hash to determine the content. var parameters = PageUtil.matchResourceParameters(); var content = lib.node("rightContent"); //$NON-NLS-0$ lib.empty(content); var text = parameters.resource.length > 0 ? "Showing interesting info about " + parame...
javascript
{ "resource": "" }
q44107
isModifyingProp
train
function isModifyingProp(reference) { var node = reference.identifier; var parent = node.parent; while (parent && !stopNodePattern.test(parent.type)) { switch (parent.type) { // e.g. foo.a = 0; case "AssignmentExpression": return parent.left === node; // e.g. ++foo.a; case "Upd...
javascript
{ "resource": "" }
q44108
train
function(object) { var url = new URL(object.Location, self.location); return xhr("GET", url.href, { //$NON-NLS-0$ timeout: 15000, headers: { "Orion-Version": "1" }, //$NON-NLS-1$ //$NON-NLS-0$ log: false }).then(function(result) { return result.response; }.bind(this)); }
javascript
{ "resource": "" }
q44109
Resource
train
function Resource(name, type, inline, element) { this.name = name; this.type = type; this.inline = inline; this.element = element; }
javascript
{ "resource": "" }
q44110
dedupe
train
function dedupe(resources, onDupe) { // first create a map of name->[array of resources with same name] var names = {}; resources.forEach(function(scriptResource) { if (names[scriptResource.name] == null) { names[scriptResource.name] = []; } names[scriptResource.name].push(scriptResource); });...
javascript
{ "resource": "" }
q44111
ResourceType
train
function ResourceType(typeSpec) { this.include = typeSpec.include; if (this.include !== Resource.TYPE_SCRIPT && this.include !== Resource.TYPE_CSS && this.include != null) { throw new Error('invalid include property: ' + this.include); } }
javascript
{ "resource": "" }
q44112
train
function(node) { for (var i = 0; i < ResourceCache._cached.length; i++) { if (ResourceCache._cached[i].node === node) { return ResourceCache._cached[i].resource; } } return null; }
javascript
{ "resource": "" }
q44113
train
function(deleteLocation, eventData) { //return _doServiceCall(this._getService(deleteLocation), "deleteFile", arguments); //$NON-NLS-1$ return _doServiceCall(this._getService(deleteLocation), "deleteFile", arguments).then(function(result){ //$NON-NLS-0$ if(this.isEventFrozen()) { if(!this._frozenEvent.de...
javascript
{ "resource": "" }
q44114
train
function(targetLocation, options, parentLocation) { //return _doServiceCall(this._getService(targetLocation), "remoteImport", arguments); //$NON-NLS-1$ return _doServiceCall(this._getService(targetLocation), "remoteImport", arguments).then(function(result){ //$NON-NLS-0$ if(this.isEventFrozen()) { if(!th...
javascript
{ "resource": "" }
q44115
FolderView
train
function FolderView(options) { this.idCount = ID_COUNT++; this._parent = options.parent; this._metadata = options.metadata; this.menuBar = options.menuBar; this.fileClient = options.fileService; this.progress = options.progressService; this.serviceRegistry = options.serviceRegistry; this.commandRegistry...
javascript
{ "resource": "" }
q44116
getEnvsListForTemplate
train
function getEnvsListForTemplate(){ var envsList = []; var keys = Object.keys(allEnvs).sort(); for(var j = 0; j < keys.length; j++) { var key = keys[j]; if(key !== 'builtin'){ envsList.push(key); } } var templateList = { type: "link", //$NON-NLS-0$ values: envsList, title: 'ES...
javascript
{ "resource": "" }
q44117
createAdapter
train
function createAdapter(type) { var adapterConfig = adaptersConfig[type]; if (!adapterConfig) { throw new Error('Adapter type ' + type + ' has not been registered.'); } return new DebugAdapter(adaptersConfig[type], adaptersCwd[type]); }
javascript
{ "resource": "" }
q44118
SearchCrawler
train
function SearchCrawler( serviceRegistry, fileClient, searchParams, options) { this.registry= serviceRegistry; this.fileClient = fileClient; this.fileLocations = []; this.fileSkeleton = []; this._hitCounter = 0; this._totalCounter = 0; this._searchOnName = options && options.searchOnName; this._buildSke...
javascript
{ "resource": "" }
q44119
train
function(hideDelay) { this._showByKB = undefined; if (this._timeout) { window.clearTimeout(this._timeout); this._timeout = null; } if (!this.isShowing()) { //$NON-NLS-0$ return; } if (hideDelay === undefined) { hideDelay = this._hideDelay; } var self = this; this._timeout ...
javascript
{ "resource": "" }
q44120
train
function(childrenLocation, force) { return this.commandsRegistered.then(function() { if (childrenLocation && typeof childrenLocation === "object") { return this.load(childrenLocation); } return this.loadResourceList(childrenLocation, force); }.bind(this)); }
javascript
{ "resource": "" }
q44121
train
function(rowElement, model) { NavigatorRenderer.prototype.rowCallback.call(this, rowElement, model); // Search for the model in the Cut buffer and disable it if it is found var cutBuffer = FileCommands.getCutBuffer(); if (cutBuffer) { var matchFound = cutBuffer.some(function(cutModel) { return Fil...
javascript
{ "resource": "" }
q44122
convertPositions
train
function convertPositions(deferred, editorContext, item, proposal) { editorContext.getLineStart(item.textEdit.range.start.line).then(function(startLineOffset) { var completionOffset = item.textEdit.range.start.character + startLineOffset; for (var i = 0; i < proposal.positions.length; i++) { proposal.positi...
javascript
{ "resource": "" }
q44123
onFetchOnly
train
function onFetchOnly(node) { var i, loadedNode, resourceName; //Mark this script as loaded. node.setAttribute('data-orderloaded', 'loaded'); //Cycle through waiting scripts. If the matching node for them //is loaded, and is in the right order, add it to the DOM //to exe...
javascript
{ "resource": "" }
q44124
getCFdomains
train
function getCFdomains(appTarget, UserId, targetUrl, domainName, defaultDomainMode) { var domainArray = []; var waitFor; if (!defaultDomainMode){ waitFor = target.cfRequest("GET", UserId, targetUrl + appTarget.Org.entity.private_domains_url, domainName ? {"q": "name:" + api.encodeURIComponent(domainName)}: nul...
javascript
{ "resource": "" }
q44125
createDebugFileRouter
train
function createDebugFileRouter(adapterPool) { var router = express.Router(); router.get('/:connectionId/:referenceId/*', function(req, res) { if (!adapterPool.has(req.params.connectionId)) { res.sendStatus(404); return; } var adapter = adapterPool.get(req.params....
javascript
{ "resource": "" }
q44126
isParenWrapped
train
function isParenWrapped() { var tokenBefore, tokenAfter; return (tokenBefore = sourceCode.getTokenBefore(node)) && tokenBefore.value === "(" && (tokenAfter = sourceCode.getTokenAfter(node)) && tokenAfter.value === ")"; }
javascript
{ "resource": "" }
q44127
findJSDocComment
train
function findJSDocComment(comments, line) { if (comments) { for (var i = comments.length - 1; i >= 0; i--) { if (comments[i].type === "Block" && comments[i].value.charAt(0) === "*") { if (line - comments[i].loc.end.line <= 1) { return comments[i]; ...
javascript
{ "resource": "" }
q44128
train
function(node, beforeCount, afterCount) { if (node) { return (this.text !== null) ? this.text.slice(Math.max(node.range[0] - (beforeCount || 0), 0), node.range[1] + (afterCount || 0)) : null; } return this.text; }
javascript
{ "resource": "" }
q44129
train
function(node) { var leadingComments = node.leadingComments || [], trailingComments = node.trailingComments || []; /* * espree adds a "comments" array on Program nodes rather than * leadingComments/trailingComments. Comments are only left in the * Program node co...
javascript
{ "resource": "" }
q44130
train
function(node) { var parent = node.parent; switch (node.type) { case "ClassDeclaration": case "FunctionDeclaration": if (looksLikeExport(parent)) { return findJSDocComment(parent.leadingComments, parent.loc.start.line); } ...
javascript
{ "resource": "" }
q44131
train
function(index) { var result = null, resultParent = null, traverser = new Traverser(); traverser.traverse(this.ast, { enter: function(node, parent) { if (node.range[0] <= index && index < node.range[1]) { result = node; ...
javascript
{ "resource": "" }
q44132
train
function(first, second) { var text = this.text.slice(first.range[1], second.range[0]); return /\s/.test(text.replace(/\/\*.*?\*\//g, "")); }
javascript
{ "resource": "" }
q44133
createCompareWidget
train
function createCompareWidget(serviceRegistry, commandService, resource, hasConflicts, parentDivId, commandSpanId, editableInComparePage, gridRenderer, compareTo, toggleCommandSpanId, preferencesService, saveCmdContainerId, saveCmdId, titleIds, containerModel, standAloneOptions) { var setCompareSelection = f...
javascript
{ "resource": "" }
q44134
train
function(defaultDecorateError){ return function(error, target){ if(error.HttpCode !== 401){ error = defaultDecorateError(error, target); window.parent.postMessage(JSON.stringify({pageService: "orion.page.delegatedUI", //$NON-NLS-0$ source: "org.eclipse.orion.client.cf.deploy.uritemplate", //$NON-...
javascript
{ "resource": "" }
q44135
train
function(msg){ if (msg.HTML) { // msg is HTML to be inserted directly var span = document.createElement("span"); span.innerHTML = msg.Message; return span; } msg = msg.Message || msg; var chunks, msgNode; try { chunks = URLUtil.detectValidURL(msg); } catch (e) { /* containe...
javascript
{ "resource": "" }
q44136
train
function(message){ document.getElementById('messageLabel').classList.remove("errorMessage"); //$NON-NLS-0$//$NON-NLS-1$ document.getElementById('messageContainer').classList.remove("errorMessage"); //$NON-NLS-0$ //$NON-NLS-1$ lib.empty(document.getElementById('messageText')); //$NON-NLS-0$ document.getE...
javascript
{ "resource": "" }
q44137
train
function(){ document.getElementById('messageLabel').classList.remove("errorMessage"); //$NON-NLS-0$ //$NON-NLS-1$ document.getElementById('messageContainer').classList.remove("errorMessage"); //$NON-NLS-0$ //$NON-NLS-1$ lib.empty(document.getElementById('messageText')); //$NON-NLS-0$ document.getElementById...
javascript
{ "resource": "" }
q44138
train
function(message){ document.getElementById('messageLabel').classList.add("errorMessage"); //$NON-NLS-0$ //$NON-NLS-1$ document.getElementById('messageContainer').classList.add("errorMessage"); //$NON-NLS-0$ //$NON-NLS-1$ lib.empty(document.getElementById('messageText')); //$NON-NLS-0$ document.getElemen...
javascript
{ "resource": "" }
q44139
train
function(frameHolder){ var iframe = window.frameElement; setTimeout(function(){ var titleBar = document.getElementById('titleBar'); //$NON-NLS-0$ titleBar.addEventListener('mousedown', function(e) { //$NON-NLS-0$ if (e.srcElement.id !== 'closeDialog') { frameHolder._dragging = true; ...
javascript
{ "resource": "" }
q44140
train
function(options){ options = options || {}; var message = options.message || messages["loadingDeploymentSettings..."]; var showMessage = options.showMessage; var hideMessage = options.hideMessage; var preferences = options.preferences; var fileClient = options.fileClient; var resource = opt...
javascript
{ "resource": "" }
q44141
train
function(from, to) { var currentCursor = this.cursor(); var selection = this._scan(true, from, to); if(!selection){ selection = this._scan(false, from, to); } this.setCursor(currentCursor); return selection; }
javascript
{ "resource": "" }
q44142
train
function(forward, roundTrip) { var topSibling = this._findSibling(this._getTopLevelParent(this.cursor()), forward); if(topSibling){ this.setCursor(topSibling); } else if(roundTrip && this.firstLevelChildren.length > 0) { this.setCursor(forward ? this.firstLevelChildren[0] : this.firstLevelChildren[this...
javascript
{ "resource": "" }
q44143
train
function(collapsedModel) { if(!this._cursor){ return null; } if(this._inParentChain(this._cursor, collapsedModel)){ this.setCursor(collapsedModel); return this._cursor; } return null; }
javascript
{ "resource": "" }
q44144
train
function(){ this._cursor = null; this._prevCursor = null; this.root = null; //By default the cursor is pointed to the first child if(this.firstLevelChildren.length > 0){ this._cursor = this.firstLevelChildren[0]; this.root = this.firstLevelChildren[0].parent; } }
javascript
{ "resource": "" }
q44145
openInNewWindow
train
function openInNewWindow(event) { var isMac = window.navigator.platform.indexOf("Mac") !== -1; //$NON-NLS-0$ return (isMac && event.metaKey) || (!isMac && event.ctrlKey); }
javascript
{ "resource": "" }
q44146
followLink
train
function followLink(href, event) { if (event && openInNewWindow(event)) { window.open(urlModifier(href)); } else { window.location = urlModifier(href); } }
javascript
{ "resource": "" }
q44147
path2FolderName
train
function path2FolderName(filePath, keepTailSlash){ var pathSegs = filePath.split("/"); pathSegs.splice(pathSegs.length -1, 1); return keepTailSlash ? pathSegs.join("/") + "/" : pathSegs.join("/"); }
javascript
{ "resource": "" }
q44148
timeElapsed
train
function timeElapsed(timeStamp) { var diff = _timeDifference(timeStamp); var yearStr = _generateTimeString(diff.year, "a year", "years"); var monthStr = _generateTimeString(diff.month, "a month", "months"); var dayStr = _generateTimeString(diff.day, "a day", "days"); var hourStr = _generateTimeString(diff.hou...
javascript
{ "resource": "" }
q44149
displayableTimeElapsed
train
function displayableTimeElapsed(timeStamp) { var duration = timeElapsed(timeStamp); if(duration) { return i18nUtil.formatMessage(messages["timeAgo"], duration); } return messages["justNow"]; }
javascript
{ "resource": "" }
q44150
WrappedWorker
train
function WrappedWorker(script, onMessage, onError) { var wUrl = new URL(script, window.location.href); wUrl = new URL(urlModifier(wUrl.href)); wUrl.query.set("worker-language", ((navigator.languages && navigator.languages[0]) || navigator.language || navigator.userLanguage || 'root').toLowerCase()); //$NON-NL...
javascript
{ "resource": "" }
q44151
train
function(options) { PropertyWidget.apply(this, arguments); SettingsTextfield.apply(this, arguments); if (this.node && options.indent) { var spans = this.node.getElementsByTagName('span'); if (spans) { var span = spans[0]; var existingClassName = span.className; if (existingClassName) { span...
javascript
{ "resource": "" }
q44152
ConfigController
train
function ConfigController(preferences, configAdmin, pid) { this.preferences = preferences; this.configAdmin = configAdmin; this.pid = pid; this.config = this.defaultConfig = this.configPromise = null; }
javascript
{ "resource": "" }
q44153
train
function() { var configuration = this.config; if (!configuration) { var pid = this.pid, self = this; this.configPromise = this.configPromise || Deferred.all([ this.configAdmin.getDefaultConfiguration(pid), this.configAdmin.getConfiguration(pid) ]).then(function(result) { self.d...
javascript
{ "resource": "" }
q44154
train
function() { return this.initConfiguration().then(function(configuration) { var defaultProps = this.getDefaultProps(); if (!defaultProps) { return this.remove(); } configuration.update(defaultProps); }.bind(this)); }
javascript
{ "resource": "" }
q44155
train
function() { return this.initConfiguration().then(function(configuration) { configuration.remove(); this.config = null; this.configPromise = null; }.bind(this)); }
javascript
{ "resource": "" }
q44156
SettingsRenderer
train
function SettingsRenderer(settingsListExplorer, serviceRegistry) { this.serviceRegistry = serviceRegistry; this.childWidgets = []; SelectionRenderer.call(this, {cachePrefix: 'pluginSettings', noRowHighlighting: true}, settingsListExplorer); //$NON-NLS-0$ }
javascript
{ "resource": "" }
q44157
SettingsListExplorer
train
function SettingsListExplorer(serviceRegistry, categoryTitle) { Explorer.call(this, serviceRegistry, undefined, new SettingsRenderer(this, serviceRegistry)); this.categoryTitle = categoryTitle; }
javascript
{ "resource": "" }
q44158
SettingsList
train
function SettingsList(options) { this.serviceRegistry = options.serviceRegistry; this.prefService = this.serviceRegistry.getService('orion.core.preference'); //$NON-NLS-1$ var commandRegistry = this.commandRegistry = options.commandRegistry; this.settings = options.settings; this.title = options.title; this...
javascript
{ "resource": "" }
q44159
train
function(parentLocation, folderName) { var that = this; return this._getEntry(parentLocation).then(function(dirEntry) { var d = new orion.Deferred(); dirEntry.getDirectory(folderName, {create:true}, function() {d.resolve(that.read(parentLocation + "/" + folderName, true));}, d.reject); return d; ...
javascript
{ "resource": "" }
q44160
train
function(sourceLocation, targetLocation, name) { var that = this; if (sourceLocation.indexOf(this._rootLocation) === -1 || targetLocation.indexOf(this._rootLocation) === -1) { throw "Not supported"; } return this._getEntry(sourceLocation).then(function(entry) { return that._getEntry(targ...
javascript
{ "resource": "" }
q44161
train
function() { if (this._model) { this._model.removeEventListener("postChanged", this._listener.onChanged); //$NON-NLS-0$ this._model.removeEventListener("preChanging", this._listener.onChanging); //$NON-NLS-0$ this._model = null; } }
javascript
{ "resource": "" }
q44162
train
function(offset, baseOffset) { var projections = this._projections, delta = 0, i, projection; if (baseOffset) { for (i = 0; i < projections.length; i++) { projection = projections[i]; if (projection.start > offset) { break; } if (projection.end > offset) { return -1; } delta += projection....
javascript
{ "resource": "" }
q44163
train
function(escapePosition) { if (!this.isActive()) { return; } if (this._compoundChange) { this.endUndo(); this._compoundChange = null; } this._sortedPositions = null; var model = this.linkedModeModel; this.linkedModeModel = model.previousModel; model.parentGroup = model.pre...
javascript
{ "resource": "" }
q44164
train
function(_name, id) { //return the deferred so client can chain on post-processing var data = {}; data.Id = id; return _xhr("POST", this.workspaceBase, { headers: { "Orion-Version": "1", "Content-Type": "application/json;charset=UTF-8", "Slug": form.encodeSlug(_name) }, data: JSON...
javascript
{ "resource": "" }
q44165
train
function() { return _xhr("GET", this.workspaceBase, { headers: { "Orion-Version": "1" }, timeout: 15000 }).then(function(result) { var jsonData = result.response ? JSON.parse(result.response) : {}; return jsonData.Workspaces; }).then(function(result) { if (this.makeAbsolute) { ...
javascript
{ "resource": "" }
q44166
train
function(loc) { if (loc === this.fileBase) { loc = null; } return _xhr("GET", loc ? loc : this.workspaceBase, { headers: { "Orion-Version": "1" }, timeout: 15000, log: false }).then(function(result) { var jsonData = result.response ? JSON.parse(result.response) : {}; //in mo...
javascript
{ "resource": "" }
q44167
train
function(sourceLocation, options) { var headerData = { "Orion-Version": "1" }; if (options.OptionHeader) { headerData["X-Xfer-Options"] = options.OptionHeader; delete options.OptionHeader; } return sftpOperation("POST", sourceLocation, { headers: headerData, data: JSON.stringify(optio...
javascript
{ "resource": "" }
q44168
train
function(sourceLocation, findStr, option) { var url = new URL(sourceLocation, self.location); url.query.set("findStr", findStr); return _xhr("GET", url.href, { timeout: 120000, headers: { "Orion-Version": "1" }, log: false }).then(function(result) { return result.response ? JSON.par...
javascript
{ "resource": "" }
q44169
train
function(searchParams) { var query = _generateLuceneQuery(searchParams); return _xhr("GET", this.fileBase + "/../filesearch" + query, { headers: { "Accept": "application/json", "Orion-Version": "1" } }).then(function(result) { return result.response ? JSON.parse(result.response) : {}; ...
javascript
{ "resource": "" }
q44170
PluginList
train
function PluginList(options, parentNode) { objects.mixin(this, options); this.node = parentNode || document.createElement("div"); //$NON-NLS-0$ }
javascript
{ "resource": "" }
q44171
train
function(serviceRegistry) { EventTarget.attach(this); this._id = ID_INCREMENT++; debugSockets[this._id] = this; this._debugService = serviceRegistry.getService('orion.debug.service'); this._messageService = serviceRegistry.getService('orion.page.message'); this._socket = null; ...
javascript
{ "resource": "" }
q44172
generateColorByName
train
function generateColorByName(str) { var hue = 0; for (var i = 0; i < str.length; i++) { hue = (hue * PRIME + str.charCodeAt(i)) % MASK; } hue = Math.floor(hue * PRIME) % MASK / MASK; var rgb = hslToRgb(hue, SATURATION, LIGHTNESS); return ('#' + rgb[0].toString(16) + rgb[1].toString(16) +...
javascript
{ "resource": "" }
q44173
getManTemplateData
train
function getManTemplateData(command, context) { var manTemplateData = { l10n: l10n.propertyLookup, command: command, onclick: function(ev) { util.updateCommand(ev.currentTarget, context); }, ondblclick: function(ev) { util.executeCommand(ev.currentTarget, context); }, descri...
javascript
{ "resource": "" }
q44174
TextActions
train
function TextActions(editor, undoStack, find) { this.editor = editor; this.undoStack = undoStack; this._incrementalFind = new mFind.IncrementalFind(editor); this._find = find ? find : new mFindUI.FindUI(editor, undoStack); this._lastEditLocation = null; this.init(); }
javascript
{ "resource": "" }
q44175
train
function(openBracket, closeBracket) { if (openBracket === "[" && !this.autoPairSquareBrackets) { //$NON-NLS-0$ return false; } else if (openBracket === "{" && !this.autoPairBraces) { //$NON-NLS-0$ return false; } else if (openBracket === "(" && !this.autoPairParentheses) { //$NON-NLS-0$ retur...
javascript
{ "resource": "" }
q44176
train
function(quotation) { if (!this.autoPairQuotation) { return false; } var editor = this.editor; var textView = editor.getTextView(); if (textView.getOptions("readonly")) { return false; } //$NON-NLS-0$ var isQuotation = new RegExp("^\"$|^'$"); //$NON-NLS-0$ var isAlpha = new RegExp("\\w"); //$NON...
javascript
{ "resource": "" }
q44177
train
function(event) { /* * The event.proposal is an object with this shape: * { proposal: "[proposal string]", // Actual text of the proposal * description: "diplay string", // Optional * positions: [{ * offset: 10, // Offset of start position of parameter i * len...
javascript
{ "resource": "" }
q44178
escapePosition
train
function escapePosition() { if (typeof proposal.escapePosition === "number") { //$NON-NLS-0$ return proposal.escapePosition; } return event.data.start + proposal.proposal.length; }
javascript
{ "resource": "" }
q44179
train
function() { var editor = this.editor; var textView = editor.getTextView(); if (textView.getOptions("readonly")) { return false; } //$NON-NLS-0$ var model = editor.getModel(); forEachSelection(this, false, function(selection, setText) { if (selection.start !== selection.end) { return; } ...
javascript
{ "resource": "" }
q44180
trimCommitMessage
train
function trimCommitMessage(message) { var splitted = message.split(/\r\n|\n/); var iterator = 0; while(splitted.length > 0 && /^\s*$/.test(splitted[iterator])) { iterator++; } var maxMessageLength = 100; if (splitted[iterator].length > maxMessageLength) return splitted[iterator].substring(0,maxMessage...
javascript
{ "resource": "" }
q44181
getGerritFooter
train
function getGerritFooter(message) { var splitted = message.split(/\r\n|\n/); var footer = {}; var changeIdCount = 0, signedOffByPresent = false; for (var i = splitted.length-1; i >= 0; --i) { var changeId = "Change-Id: "; //$NON-NLS-0$ var signedOffBy = "Signed-off-by: "; //$NON-NLS-0$ if (split...
javascript
{ "resource": "" }
q44182
buildDeploymentTrigger
train
function buildDeploymentTrigger(options){ options = options || {}; return function(results){ var initialConfName = options.ConfName; var confName = results.ConfName; var disableUI = options.disableUI; var enableUI = options.enableUI; var showMessage = options.showMessage; var closeFrame = option...
javascript
{ "resource": "" }
q44183
uniqueLaunchConfigName
train
function uniqueLaunchConfigName(fileService, contentLocation, baseName) { return readLaunchConfigsFolder(fileService, contentLocation).then(function(children) { var counter = 0; for(var i=0; i<children.length; i++){ var childName = children[i].Name.replace(/\.launch$/, ""); //$NON-NLS-0$ if (baseName ==...
javascript
{ "resource": "" }
q44184
train
function() { var map = this.getContentTypesMap(); var types = []; for (var type in map) { if (Object.prototype.hasOwnProperty.call(map, type)) { types.push(map[type]); } } return types; }
javascript
{ "resource": "" }
q44185
train
function(contentTypeA, contentTypeB) { contentTypeA = (typeof contentTypeA === "string") ? this.getContentType(contentTypeA) : contentTypeA; //$NON-NLS-0$ contentTypeB = (typeof contentTypeB === "string") ? this.getContentType(contentTypeB) : contentTypeB; //$NON-NLS-0$ if (!contentTypeA || !contentTypeB) { re...
javascript
{ "resource": "" }
q44186
train
function(error, target){ error.Severity = "Error"; //$NON-NLS-0$ if (error.Message && error.Message.indexOf("The host is taken") === 0) //$NON-NLS-0$ error.Message = messages["theHostIsAlreadyIn"]; if (error.HttpCode === 404){ error = { State: "NOT_DEPLOYED", //$NON-NLS-0$ Message: error.M...
javascript
{ "resource": "" }
q44187
train
function(options){ var cFService = options.cFService; var showMessage = options.showMessage; var hideMessage = options.hideMessage; var showError = options.showError; var render = options.render; var self = this; var handleError = function(error, target, retryFunc){ error = self.defaultDecora...
javascript
{ "resource": "" }
q44188
train
function() { var value = this.getTextInputValue(); if (value) { var recentEntryArray = this.getRecentEntryArray(); if (!recentEntryArray) { recentEntryArray = []; } var indexOfElement = this._getIndexOfValue(recentEntryArray, value); //check if a duplicate entry exists if (0...
javascript
{ "resource": "" }
q44189
train
function(recentEntryArray, value) { var indexOfElement = -1; recentEntryArray.some(function(entry, index){ if (entry.value === value) { indexOfElement = index; return true; } return false; }); return indexOfElement; }
javascript
{ "resource": "" }
q44190
_samePaths
train
function _samePaths(file, path2, meta) { if (file === null) { return path2 === null; } if (typeof file === 'undefined') { return typeof path2 === 'undefined'; } if (path2 === null) { return file === null; } if (typeof path2 === 'undefined') { return typeof file === 'undefined'; }...
javascript
{ "resource": "" }
q44191
train
function(node) { var label = node.name; //include id if present var match = /id=['"]\S*["']/.exec(node.raw); //$NON-NLS-0$ if (match) { label = label + " " + match[0]; //$NON-NLS-0$ } //include class if present match = /class=['"]\S*["']/.exec(node.raw); //$NON-NLS-0$ if (match) { ...
javascript
{ "resource": "" }
q44192
train
function(dom) { //end recursion if (!dom) { return null; } var outline = []; for (var i = 0; i < dom.length; i++) { var node = dom[i]; if(this.skip(node)) { continue; } var element = { label: this.domToLabel(node), children: this.domToOutline(node.childr...
javascript
{ "resource": "" }
q44193
train
function(node) { //skip nodes with no name if (!node.name) { return true; } //skip formatting elements if (node.name === "b" || node.name === "i" || node.name === "em") { //$NON-NLS-0$ //$NON-NLS-1$ //$NON-NLS-2$ return true; } //skip paragraphs and other blocks of formatted ...
javascript
{ "resource": "" }
q44194
train
function(dom) { //recursively walk the dom looking for a body element for (var i = 0; i < dom.length; i++) { if (dom[i].name === "body") { //$NON-NLS-0$ return dom[i].children; } if (dom[i].children) { var result = this.findBody(dom[i].children); if (result) { return resu...
javascript
{ "resource": "" }
q44195
getSharedWorkspace
train
function getSharedWorkspace(req, res) { return sharedUtil.getSharedProjects(req, res, function(projects) { var workspaces = []; projects.forEach(function(project){ var projectSegs = project.Location.split("/"); var projectBelongingWorkspaceId = sharedUtil.getWorkspaceIdFromprojectLocation(project.Lo...
javascript
{ "resource": "" }
q44196
putFile
train
function putFile(req, res) { var rest = req.params["0"]; var file = fileUtil.getFile(req, rest); var fileRoot = options.fileRoot; if (req.params['parts'] === 'meta') { // TODO implement put of file attributes return sendStatus(501, res); } function write() { var ws = fs.createWriteStream(file.path)...
javascript
{ "resource": "" }
q44197
deleteFile
train
function deleteFile(req, res) { var rest = req.params["0"]; var file = fileUtil.getFile(req, rest); fileUtil.withStatsAndETag(file.path, function(error, stats, etag) { var callback = function(error) { if (error) { return writeError(500, res, error); } sendStatus(204, res); }; var ifMatch...
javascript
{ "resource": "" }
q44198
loadFile
train
function loadFile(req, res) { if (req.user) { // User access is not allowed. This method is only for the collab server writeError(403, res, 'Forbidden'); return; } var relativeFilePath = req.params['0']; var hubid = req.params['hubId']; return sharedProjects.getProjectPathFromHubID(hubid) .then(fu...
javascript
{ "resource": "" }
q44199
train
function (a, b) { var dx = (b[0] - a[0]) * this.kx; var dy = (b[1] - a[1]) * this.ky; if (!dx && !dy) return 0; var bearing = Math.atan2(dx, dy) * 180 / Math.PI; if (bearing > 180) bearing -= 360; return bearing; }
javascript
{ "resource": "" }