_id
stringlengths
2
6
title
stringlengths
0
58
partition
stringclasses
3 values
text
stringlengths
52
373k
language
stringclasses
1 value
meta_information
dict
q44000
train
function() { var context = this.breakContext; var forkContext = this.forkContext; this.breakContext = context.upper; // Process this context here for other than switches and loops. if (!context.breakable) { var brokenForkContext = context.brokenForkContext; if (!brokenForkContext.empty) { ...
javascript
{ "resource": "" }
q44001
train
function(label) { var forkContext = this.forkContext; if (!forkContext.reachable) { return; } var context = getBreakContext(this, label); /* istanbul ignore else: foolproof (syntax error) */ if (context) { context.brokenForkContext.add(forkContext.head); } forkContext.replaceHead(for...
javascript
{ "resource": "" }
q44002
train
function(label) { var forkContext = this.forkContext; if (!forkContext.reachable) { return; } var context = getContinueContext(this, label); /* istanbul ignore else: foolproof (syntax error) */ if (context) { if (context.continueDestSegments) { makeLooped(this, forkContext.head, contex...
javascript
{ "resource": "" }
q44003
train
function() { var forkContext = this.forkContext; if (forkContext.reachable) { getReturnContext(this).returnedForkContext.add(forkContext.head); forkContext.replaceHead(forkContext.makeUnreachable(-1, -1)); } }
javascript
{ "resource": "" }
q44004
train
function() { var forkContext = this.forkContext; if (forkContext.reachable) { getThrowContext(this).thrownForkContext.add(forkContext.head); forkContext.replaceHead(forkContext.makeUnreachable(-1, -1)); } }
javascript
{ "resource": "" }
q44005
train
function(children) { var attempt = 0; var uniqueName = prefix; // find a unique name for the new artifact var possiblyCollidingNames = children.filter(function(child){ return 0 === child.Name.indexOf(prefix); }).map(function(child){ return child.Name; }); while (-1 !== po...
javascript
{ "resource": "" }
q44006
createNewArtifact
train
function createNewArtifact(namePrefix, parentItem, isDirectory) { var createFunction = function(name) { if (name) { var location = parentItem.Location; var functionName = isDirectory ? "createFolder" : "createFile"; var deferred = fileClient[functionName](location, name, {select: true}); prog...
javascript
{ "resource": "" }
q44007
train
function (annotationModel) { if (this._annotationModel) { this._annotationModel.removeEventListener("Changed", this._listener.onAnnotationModelChanged); //$NON-NLS-0$ } this._annotationModel = annotationModel; if (this._annotationModel) { this._annotationModel.addEventListener("Changed", this._liste...
javascript
{ "resource": "" }
q44008
train
function(lineIndex, e) { var tooltip = mTooltip.Tooltip.getTooltip(this._view); if (!tooltip) { return; } if (tooltip.isVisible() && this._tooltipLineIndex === lineIndex) { return; } this._tooltipLineIndex = lineIndex; // Prevent spurious mouse event (e.g. on a scroll) if (e.clientX === this....
javascript
{ "resource": "" }
q44009
train
function(lineIndex, e) { if (!this._currentClickGroup) { this._setCurrentGroup(-1); } if (this._hoverTimeout) { window.clearTimeout(this._hoverTimeout); this._hoverTimeout = null; } }
javascript
{ "resource": "" }
q44010
LineNumberRuler
train
function LineNumberRuler (annotationModel, rulerLocation, rulerStyle, oddStyle, evenStyle) { Ruler.call(this, annotationModel, rulerLocation, "page", rulerStyle); //$NON-NLS-0$ this._oddStyle = oddStyle || {style: {backgroundColor: "white"}}; //$NON-NLS-0$ this._evenStyle = evenStyle || {style: {backgroundColor: ...
javascript
{ "resource": "" }
q44011
train
function(params) { var result = []; for (var i = 0; i < this._templateComponents.length; i++) { result.push(this._templateComponents[i].expand(params)); } return result.join(""); }
javascript
{ "resource": "" }
q44012
train
function(items, userData) { var selfHostingConfig = this._siteClient.getSelfHostingConfig(); var self = this; var dialog = new ConvertToSelfHostingDialog({ serviceRegistry: this.serviceRegistry, fileClient: this.fileClient, siteClient: this._siteClient, selfHostingConfig: selfHostingConfig, func:...
javascript
{ "resource": "" }
q44013
train
function(location) { var deferred = new Deferred(); this._busyWhile(deferred, messages["Loading..."]); this._siteClient.loadSiteConfiguration(location).then( function(siteConfig) { this._setSiteConfiguration(siteConfig); this.setDirty(false); deferred.resolve(siteConfig); }.bind(this), functi...
javascript
{ "resource": "" }
q44014
train
function(site) { this._detachListeners(); this._modelListeners = this._modelListeners || []; var editor = this; function bindText(widget, modelField) { function commitWidgetValue(event) { var value = widget.value; //$NON-NLS-0$ var oldValue = site[modelField]; site[modelField] = value; var i...
javascript
{ "resource": "" }
q44015
train
function(refreshUI) { refreshUI = typeof refreshUI === "undefined" ? true : refreshUI; //$NON-NLS-0$ var siteConfig = this._siteConfiguration; // Omit the HostingStatus field from the object we send since it's likely to be updated from the // sites page, and we don't want to overwrite var status = siteConfig....
javascript
{ "resource": "" }
q44016
RichDropdown
train
function RichDropdown(options) { this._parentNode = options.parentNode; this._buttonName = options.buttonName; this._id = options.id || "dropDown"; this._buttonDecorator = options.buttonDecorator; this._populateFunction = options.populateFunction; this._noDropdownArrow = options.noDropdownArrow; th...
javascript
{ "resource": "" }
q44017
train
function(name, decorator, title) { var titleText = title || ""; //$NON-NLS-0$ lib.empty(this._dropdownTriggerButtonLabel); if (decorator) { this._dropdownTriggerButtonLabel.appendChild(decorator); } var nameNode = document.createTextNode(name); this._dropdownTriggerButtonLabel.app...
javascript
{ "resource": "" }
q44018
train
function(labelNode) { labelNode.id = this._dropdownTriggerButtonLabel.id; this._dropdownTriggerButton.replaceChild(labelNode, this._dropdownTriggerButtonLabel); this._dropdownTriggerButtonLabel = labelNode; }
javascript
{ "resource": "" }
q44019
train
function() { if (this._dropdownTriggerButton) { if (this._dropdownTriggerButton.dropdown) { this._dropdownTriggerButton.dropdown.destroy(); this._dropdownTriggerButton.dropdown = null; } this._dropdownTriggerButton = null; } }
javascript
{ "resource": "" }
q44020
train
function(msg, onDone, node, title) { if(node){ this._commandRegistry.confirmWithButtons(node, msg,[{label:"OK",callback:function(){ onDone(true); },type:"ok"},{label:"Cancel",callback:function(){ onDone(false); },type:"cancel"}]); }else{ var dialog = new mConfirmDialog.ConfirmDial...
javascript
{ "resource": "" }
q44021
CollabClient
train
function CollabClient(editor, inputManager, fileClient, serviceRegistry, commandRegistry, preferences) { mCollabFileCommands.createFileCommands(serviceRegistry, commandRegistry, fileClient); this.editor = editor; this.inputManager = inputManager; this.fileClient = fileClient; this.preferences = preferences; ...
javascript
{ "resource": "" }
q44022
train
function(callback) { var self = this; var userService = this.serviceRegistry.getService("orion.core.user"); var authServices = this.serviceRegistry.getServiceReferences("orion.core.auth"); var authService = this.serviceRegistry.getService(authServices[0]); authService.getUser().then(function(jsonData) {...
javascript
{ "resource": "" }
q44023
train
function(e) { this.location = e.input.resource; this.updateSelfFileAnnotation(); this.destroyOT(); this.sendCurrentLocation(); if (e.metadata.Attributes) { var projectSessionID = e.metadata.Attributes.hubID; if (this.projectSessionID !== projectSessionID) { this.projectSessionID = projectSes...
javascript
{ "resource": "" }
q44024
train
function(clientId, contextP, url, editing) { var peer = this.getPeer(clientId); // Peer might be loading. Once it is loaded, this annotation will be automatically updated, // so we can safely leave it blank. var name = (peer && peer.name) ? peer.name : 'Unknown'; var color = (peer && peer.color) ? peer.c...
javascript
{ "resource": "" }
q44025
train
function() { var self = this; if (!this.collabFileAnnotationsUpdateTimeoutId) { // No delayed update is assigned. Assign one. // This is necessary because we don't want duplicate UI action within a short period. this.collabFileAnnotationsUpdateTimeoutId = setTimeout(function() { self.collabFileAn...
javascript
{ "resource": "" }
q44026
train
function(peer) { if (this.peers[peer.id]) { // Update this.peers[peer.id] = peer; } else { // Add this.peers[peer.id] = peer; } if (this.collabHasFileAnnotation(peer.id)) { var annotation = this.getCollabFileAnnotation(peer.id); this.addOrUpdateCollabFileAnnotation(peer.id, contextPa...
javascript
{ "resource": "" }
q44027
train
function(syntaxChecker, timeout) { var time = timeout; if (!syntaxChecker){ time = -1; } this._autoSyntaxEnabled = time !== -1; this._autoSyntaxActive = false; if (!this._idle2) { var options = { document: document, timeout: time }; this._idle2 = new Idle(options)...
javascript
{ "resource": "" }
q44028
getBidiLayout
train
function getBidiLayout() { var _bidiLayout = localStorage.getItem(bidiLayoutStorage); if (_bidiLayout && (_bidiLayout === "rtl" || _bidiLayout === "ltr" || _bidiLayout === "auto")) { //$NON-NLS-0$ //$NON-NLS-1$ //$NON-NLS-2$ return _bidiLayout; } return "ltr"; //$NON-NLS-0$ }
javascript
{ "resource": "" }
q44029
getTextDirection
train
function getTextDirection(text) { bidiLayout = getBidiLayout(); if (!isBidiEnabled()) { return ""; } if (bidiLayout === "auto" && util.isIE) { //$NON-NLS-0$ return checkContextual(text); } return bidiLayout; }
javascript
{ "resource": "" }
q44030
foundNestedPseudoClass
train
function foundNestedPseudoClass() { var openParen = 0; for (var i = pos + 1; i < source_text.length; i++) { var ch = source_text.charAt(i); if (ch === "{") { return true; } else if (ch === '(') { // pseudocla...
javascript
{ "resource": "" }
q44031
processURLSegments
train
function processURLSegments(parentNode, segments) { segments.forEach(function(segment) { if (segment.urlStr){ var link = document.createElement("a"); //$NON-NLS-0$ link.href = segment.urlStr; link.appendChild(document.createTextNode(segment.segmentStr)); link.dir = bidiUtils.getTe...
javascript
{ "resource": "" }
q44032
empty
train
function empty(node) { while (node && node.hasChildNodes()) { var child = node.firstChild; node.removeChild(child); } }
javascript
{ "resource": "" }
q44033
onclick
train
function onclick(event) { autoDismissNodes.forEach(function(autoDismissNode) { var excludeNodeInDocument = false; var excluded = autoDismissNode.excludeNodes.some(function(excludeNode) { if(document.body.contains(excludeNode)) { excludeNodeInDocument = true; return excludeNode.contains...
javascript
{ "resource": "" }
q44034
getOffsetParent
train
function getOffsetParent(node) { var offsetParent = node.parentNode, documentElement = document.documentElement; while (offsetParent && offsetParent !== documentElement) { var style = window.getComputedStyle(offsetParent, null); if (!style) { break; } var overflow = style.getPropertyValue("overflow-y"...
javascript
{ "resource": "" }
q44035
stop
train
function stop(event) { if (window.document.all) { event.keyCode = 0; } if (event.preventDefault) { event.preventDefault(); event.stopPropagation(); } }
javascript
{ "resource": "" }
q44036
createNodes
train
function createNodes(templateString, parentNode) { var parent = parentNode; var newNodes = null; if (undefined === parent) { parent = document.createElement("div"); //$NON-NLS-0$ } parent.innerHTML = templateString; if (parent.children.length > 1) { newNodes = parent.children; } else...
javascript
{ "resource": "" }
q44037
train
function() { var outputDiv = document.getElementsByClassName("gcli-output")[0]; //$NON-NLS-0$ while (outputDiv.hasChildNodes()) { outputDiv.removeChild(outputDiv.lastChild); } this.output(i18nUtil.formatMessage(messages["AvailableCmdsType"], "<b>help</b>")); //$NON-NLS-0$ }
javascript
{ "resource": "" }
q44038
train
function(content) { var output = new mCli.Output(); this.commandOutputManager.onOutput({output: output}); output.complete(content); }
javascript
{ "resource": "" }
q44039
enterNode
train
function enterNode(node) { var comments = this.sourceCode.getComments(node); emitCommentsEnter(this, comments.leading); this.original.enterNode(node); emitCommentsEnter(this, comments.trailing); }
javascript
{ "resource": "" }
q44040
leaveNode
train
function leaveNode(node) { var comments = this.sourceCode.getComments(node); emitCommentsExit(this, comments.trailing); this.original.leaveNode(node); emitCommentsExit(this, comments.leading); }
javascript
{ "resource": "" }
q44041
train
function(proposal) { if (!proposal) { return false; } // now handle prefixes // if there is a non-empty selection, then replace it, // if overwrite is truthy, then also replace the prefix var view = this.textView; var sel = view.getSelection(); var start = this._initialCaretOffse...
javascript
{ "resource": "" }
q44042
train
function() { // figure out initial offset, it should be the minimum between // the beginning of the selection and the current caret offset var offset = this.textView.getCaretOffset(); var sel = this.textView.getSelection(); var selectionStart = Math.min(sel.start, sel.end); this._initialCare...
javascript
{ "resource": "" }
q44043
train
function(proposals) { // get rid of extra separators and titles var mappedProposals = proposals.map(function(proposalArray) { var element = proposalArray.filter(function(proposal, index) { var keepElement = true; if (STYLES[proposal.style] === STYLES.hr) { if ((0 === index) || ((proposal...
javascript
{ "resource": "" }
q44044
train
function(arrayOrObjectArray) { return arrayOrObjectArray.reduce(function(prev, curr) { var returnValue = prev; var filteredArray = null; if (curr && Array.isArray(curr)) { filteredArray = curr.filter(function(element){ return element; //filter out falsy elements }); ...
javascript
{ "resource": "" }
q44045
train
function(update, noContent) { var tooltip = mTooltip.Tooltip.getTooltip(this.contentAssist.textView); var self = this; var target = { getTooltipInfo: function() { var bounds = self.widget.parentNode.getBoundingClientRect(); var tipArea = {width: 350, height: bounds.height, top: bounds.top};...
javascript
{ "resource": "" }
q44046
train
function(cloneNode){ cloneNode.contentAssistProposalIndex = node.contentAssistProposalIndex; if (cloneNode.hasChildNodes()) { for (var i = 0 ; i < cloneNode.childNodes.length ; i++){ recursiveSetIndex(cloneNode.childNodes[i]); } } }
javascript
{ "resource": "" }
q44047
train
function() { if (this.model) { this.model.removeEventListener("Changing", this.listener.onModelChanging); this.model.removeEventListener("Changed", this.listener.onModelChanged); this.model.removeEventListener("Destroy", this.listener.onDestroy); } this.model = null; this.codeMirror = null; t...
javascript
{ "resource": "" }
q44048
train
function(startLine, endLine, partial) { if (!this.mode) { return; } var lineCount = this.model.getLineCount(); startLine = typeof startLine === "undefined" ? 0 : startLine; endLine = typeof endLine === "undefined" ? lineCount - 1 : Math.min(endLine, lineCount - 1); var mode = this.mode; var sta...
javascript
{ "resource": "" }
q44049
train
function(lineIndex, line, state) { if (!this.mode) { return; } var model = this.model; if (model.getLineStart(lineIndex) === model.getLineEnd(lineIndex) && this.mode.blankLine) { this.mode.blankLine(state); } var style = line.style || []; var text = model.getLine(lineIndex); var stream =...
javascript
{ "resource": "" }
q44050
train
function(token, str, pos) { if (!token && this.isWhitespaceVisible && /\s+/.test(str)) { var whitespaceStyles = [], start, type; for (var i=0; i < str.length; i++) { var chr = str[i]; if (chr !== type) { if (type) { whitespaceStyles.push([pos + start, pos + i, (type === "\t" ? TAB : SP...
javascript
{ "resource": "" }
q44051
train
function() { if (this.modeApplier) { this.modeApplier.removeEventListener("Highlight", this.listener.onHighlight); this.modeApplier.destroy(); } if (this.annotationModel) { // remove annotation listeners } if (this.textView) { this.textView.removeEventListener("LineStyle", this.listener.o...
javascript
{ "resource": "" }
q44052
DiffProvider
train
function DiffProvider(serviceRegistry, filter) { var allReferences = serviceRegistry.getServiceReferences("orion.core.diff"); //$NON-NLS-0$ var i, _references = allReferences; if (filter) { _references = []; for(i = 0; i < allReferences.length; ++i) { if (filter(allReferences[i])) { _references.pus...
javascript
{ "resource": "" }
q44053
train
function(ast, offset) { var found = null; CssVisitor.visit(ast, { visitNode: function(node) { if(node.range[0] <= offset) { if (node.range[1] === -1 || node.range[1] >= offset) { found = node; } else { return Visitor.SKIP; } } else { return Visitor....
javascript
{ "resource": "" }
q44054
getJavaHome
train
function getJavaHome() { if(!java_home) { if(typeof process.env.JAVA_HOME === 'string' && process.env.JAVA_HOME) { java_home = process.env.JAVA_HOME; } else if(process.platform === 'darwin') { java_home = cp.execSync("/usr/libexec/java_home").toString().trim(); } else if(process.platform === 'linux') { ...
javascript
{ "resource": "" }
q44055
runJavaServer
train
function runJavaServer(javaHome, options) { return new Promise(function(resolve, reject) { const child = path.join(javaHome, '/jre/bin/java'), params = []; if (DEBUG) { params.push('-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1044'); } params.push("-Dlog.level=ALL"); params.push('-Dec...
javascript
{ "resource": "" }
q44056
fork
train
function fork(modulePath, args, options) { return new Promise((resolve, reject) => { const newEnv = generatePatchedEnv(process.env, options.IN_PORT, options.OUT_PORT), childProcess = cp.spawn(modulePath, args, { silent: true, cwd: options.cwd, env: newEnv, execArgv: options.execArgv }); childProces...
javascript
{ "resource": "" }
q44057
populateThemes
train
function populateThemes(){ this.preferences.getTheme(function(themeStyles) { var selectElement = document.getElementById('editorTheme');//$NON-NLS-0$ while (selectElement.hasChildNodes() ){ selectElement.removeChild(selectElement.lastChild); } for (var i =0; i < themeStyles.styles.length; i++) { v...
javascript
{ "resource": "" }
q44058
checkForChanges
train
function checkForChanges(){ var changed = false; for (var i = 0; i < scopeList.length; i++){ // if a scope is modified if (getValueFromPath(currentTheme, scopeList[i].objPath[0]) !== getValueFromPath(originalTheme, scopeList[i].objPath[0])){ document.getElementById("scopeList").childNodes[i].classList.add...
javascript
{ "resource": "" }
q44059
apply
train
function apply() { document.getElementById("editorThemeName").value = currentTheme.name; //$NON-NLS-0$ for (var i = 0; i < scopeList.length; i++){ scopeList[i].value = defaultColor; // scopes with no value will have defaultColor showing for (var l = 0; l < scopeList[i].objPath.length; l++){ var temp = get...
javascript
{ "resource": "" }
q44060
generateScopeList
train
function generateScopeList(hiddenValues){ hiddenValues = hiddenValues || []; var htmlString = ""; var ieClass = util.isIE ? "-ie" : ""; //$NON-NLS-0$ for (var i = 0; i < scopeList.length; i++){ if (scopeList[i].id === "editorThemeFontSize"){ htmlString = htmlString + "<li><label for='editorThemeFontSize...
javascript
{ "resource": "" }
q44061
containsAssignment
train
function containsAssignment(node) { if (node.type === "AssignmentExpression") { return true; } else if (node.type === "ConditionalExpression" && (node.consequent.type === "AssignmentExpression" || node.alternate.type === "AssignmentExpression")) { return true; } else if ((node.left && node.left.typ...
javascript
{ "resource": "" }
q44062
isReturnAssignException
train
function isReturnAssignException(node) { if (!EXCEPT_RETURN_ASSIGN || !isInReturnStatement(node)) { return false; } if (node.type === "ReturnStatement") { return node.argument && containsAssignment(node.argument); } else if (node.type === "ArrowFunctionExpression" && node.body.type !== "BlockStatem...
javascript
{ "resource": "" }
q44063
isHeadOfExpressionStatement
train
function isHeadOfExpressionStatement(node) { var parent = node.parent; while (parent) { switch (parent.type) { case "SequenceExpression": if (parent.expressions[0] !== node || isParenthesised(node)) { return false; } break; case "UnaryExpression": case "UpdateExpressi...
javascript
{ "resource": "" }
q44064
CompareRuler
train
function CompareRuler (annoModel, rulerLocation, rulerOverview, rulerStyle) { mRulers.Ruler.call(this, annoModel, rulerLocation, rulerOverview, rulerStyle); }
javascript
{ "resource": "" }
q44065
LineNumberCompareRuler
train
function LineNumberCompareRuler (diffNavigator, mapperColumnIndex , annoModel, rulerLocation, rulerStyle, oddStyle, evenStyle) { orion.CompareRuler.call(this, annoModel, rulerLocation, "page", rulerStyle); //$NON-NLS-0$ this._diffNavigator = diffNavigator; this._oddStyle = oddStyle || {style: {backgroundColor: "w...
javascript
{ "resource": "" }
q44066
UndoStack
train
function UndoStack (view, size) { this.size = size !== undefined ? size : 100; this.reset(); var self = this; this._listener = { onChanging: function(e) { self._onChanging(e); }, onDestroy: function(e) { self._onDestroy(e); } }; if (view.getModel) { var model = view.getModel(); if ...
javascript
{ "resource": "" }
q44067
train
function (change) { if (this.compoundChange) { this.compoundChange.add(change); } else { var length = this.stack.length; this.stack.splice(this.index, length-this.index, change); this.index++; if (this.stack.length > this.size) { this.stack.shift(); this.index--; } } }
javascript
{ "resource": "" }
q44068
train
function() { this._commitUndo(); var changes = []; for (var i=this.index; i >= 0; i--) { changes = changes.concat(this.stack[i].getUndoChanges()); } return changes; }
javascript
{ "resource": "" }
q44069
train
function() { this._commitUndo(); var change, result = false; this._ignoreUndo = true; do { if (this.index <= 0) { break; } change = this.stack[--this.index]; } while (!(result = change.undo(this.view, true))); this._ignoreUndo = false; return result; }
javascript
{ "resource": "" }
q44070
train
function() { this._commitUndo(); var change, result = false; this._ignoreUndo = true; do { if (this.index >= this.stack.length) { break; } change = this.stack[this.index++]; } while (!(result = change.redo(this.view, true))); this._ignoreUndo = false; return result; }
javascript
{ "resource": "" }
q44071
Completer
train
function Completer(options, components) { this.requisition = components.requisition; this.scratchpad = options.scratchpad; this.input = { typed: '', cursor: { start: 0, end: 0 } }; this.choice = 0; this.element = components.element; this.element.classList.add('gcli-in-complete'); this.element.setAttribut...
javascript
{ "resource": "" }
q44072
checkAuthenticated
train
function checkAuthenticated(req, res, next) { if (!req.user) { api.writeError(401, res, "Not authenticated"); } else { req.user.workspaceDir = workspaceDir + (req.user.workspace ? "/" + req.user.workspace : ""); req.user.checkRights = checkRights; next(); } }
javascript
{ "resource": "" }
q44073
checkAccessRights
train
function checkAccessRights(req, res, next) { const uri = (typeof req.contextPath === "string" && req.baseUrl.substring(req.contextPath.length)) || req.baseUrl; req.user.checkRights(req.user.username, uri, req, res, next); }
javascript
{ "resource": "" }
q44074
tryLoadRouter
train
function tryLoadRouter(endpoint, options) { const args = []; var isEndpoint = typeof endpoint.endpoint === 'string'; if (isEndpoint) { args.push(endpoint.endpoint); args.push(responseTime({digits: 2, header: "X-Total-Response-Time", suffix: true})); } if (endpoint.authenticated) { args.push(options.authentic...
javascript
{ "resource": "" }
q44075
loadEndpoints
train
function loadEndpoints(endpoints, options, auth) { if (Array.isArray(endpoints)) { endpoints.forEach(function(endpoint) { if (auth !== Boolean(endpoint.authenticated)) { //after endpoints refactored, remove this check return; } const conditional = endpoint.hasOwnProperty("ifProp"); if (conditiona...
javascript
{ "resource": "" }
q44076
loadLanguageServers
train
function loadLanguageServers(servers, io, options) { if (Array.isArray(servers) && options.configParams.get('orion.single.user')) { const rootPath = path.join(__dirname, "languages"); if (!fs.existsSync(rootPath)) { logger.log("'languages' folder does not exist. Stopped loading language servers."); return; ...
javascript
{ "resource": "" }
q44077
treeJSON
train
function treeJSON(name, location, timestamp, dir, length, addNameToLoc) { location = api.toURLPath(location); if (typeof addNameToLoc == 'undefined' || addNameToLoc) { location += "/" + name; } var result = { Name: name, LocalTimeStamp: timestamp, ...
javascript
{ "resource": "" }
q44078
getChildren
train
function getChildren(fileRoot, directory, depth, excludes) { return fs.readdirAsync(directory) .then(function(files) { return Promise.map(files, function(file) { if (Array.isArray(excludes) && excludes.indexOf(file) !== -1) { return null; // omit ...
javascript
{ "resource": "" }
q44079
train
function() { if(!this.model.root) { return new Deferred().resolve(true); } var modelList = this.model.root.children || this.model.root.Children; if(!modelList) { return new Deferred().resolve(true); } var isDirty = modelList.some( function(child) { if(child.children && child.child...
javascript
{ "resource": "" }
q44080
train
function(node, offset, source) { if (node){ if (node.type === 'tag'){ var name = node.name ? node.name.toLowerCase() : ''; if (name === 'script' || name === 'style') { if (node.openrange && node.endrange){ // If we are in the tag itself we are not actually in the script block if (of...
javascript
{ "resource": "" }
q44081
train
function(node, offset, source) { if(node && source) { switch(node.type) { case 'tag': { // Smarter way now that we have end ranges if (node.endrange){ return offset > node.endrange[0] && offset < node.endrange[1]; } // TODO Delete the old way var _s = source.slice(node.r...
javascript
{ "resource": "" }
q44082
train
function(node, offset) { return node && node.type === 'comment' && offset >= node.range[0] && offset <= node.range[1]; }
javascript
{ "resource": "" }
q44083
train
function(node, source, params) { if(node) { var offset = params.offset; if(node.type === 'tag') { var tagNameEnd = node.range[0] + 1 + node.name.length; if(tagNameEnd < offset) { if (node.openrange){ return offset < node.openrange[1] || (offset === node.openrange[1] && source[offset-1]...
javascript
{ "resource": "" }
q44084
train
function(node, params) { if(node) { var offset = params.offset; if(node.type === 'tag') { if (node.openrange){ if (offset >= node.openrange[0] && offset <= node.openrange[1]){ return true; } } else if (offset >= node.range[0] && offset <= node.range[1]){ return true; }...
javascript
{ "resource": "" }
q44085
train
function(node, source) { if(node && node.type === 'tag' && node.name) { if (node.endrange && node.endrange.length === 2){ // If the HTML is incomplete, the parser recovery sometimes uses the end range of the parent element return node.name === source.substring(node.endrange[0]+2, node.endrange[1]-1); ...
javascript
{ "resource": "" }
q44086
train
function(node, source, params) { var proposals = []; var prefix = params.prefix ? params.prefix : ""; // we need to check if we need to rebuild the prefix for completion that contains a '-' var index = params.offset - prefix.length - 1; if (index > 0 && index < source.length) { var precedingChar = so...
javascript
{ "resource": "" }
q44087
train
function(node, source, params) { // TODO We can do better with the new parser, handle no quotes cases too if(node && node.type === 'attr') { if (node.valueRange) { var range = node.valueRange; return range[0] <= params.offset && range[1] >= params.offset; } return this.within('"', '"', sourc...
javascript
{ "resource": "" }
q44088
train
function(start, end, source, offset, bounds) { var idx = offset; var _c; var before = false; while(idx > bounds[0]) { _c = source[idx]; if(_c === start) { before = true; break; } idx--; } if(before) { idx = offset; while(idx < bounds[1]) { _c = source[idx]; ...
javascript
{ "resource": "" }
q44089
handle
train
function handle(operationLocation, onSuccess, onError) { var def = new Deferred(); _trackCancel(operationLocation, def); _getOperation({location: operationLocation, timeout: 100}, def, onSuccess, onError); return def; }
javascript
{ "resource": "" }
q44090
ProblemsView
train
function ProblemsView(options, slideout) { if(slideout) { SlideoutViewMode.call(this, slideout); } var parentId = options.parentId ? options.parentId : "orion.PropertyPanel.container"; this._parent = lib.node(parentId); this.serviceRegistry = options.serviceRegistry; this.commandRegistry = options...
javascript
{ "resource": "" }
q44091
_doServiceCall
train
function _doServiceCall(service, methodName, args) { var serviceMethod = service[methodName]; var clientDeferred = new Deferred(); if (typeof serviceMethod !== 'function') { //$NON-NLS-0$ throw messages['Service method missing: '] + methodName; } // On success, just forward the result to the client var o...
javascript
{ "resource": "" }
q44092
SiteClient
train
function SiteClient(serviceRegistry, siteService, siteServiceRef) { this._serviceRegistry = serviceRegistry; this._siteService = siteService; this._selfHost = siteServiceRef.getProperty('canSelfHost'); //$NON-NLS-0$ this._selfHostConfig = siteServiceRef.getProperty('selfHostingConfig'); //$NON-NLS-0$ this._si...
javascript
{ "resource": "" }
q44093
train
function(site, file) { if (!site) { var d = new Deferred(); d.resolve(false); return d; } return this.getURLOnSite(site, file).then(function(url) { return url !== null; }); }
javascript
{ "resource": "" }
q44094
train
function(item) { this.scope(""); return this.fileClient.getWorkspace(item.Location).then(function(workspace) { return this.loadRoot(workspace).then(function() { return this.showItem(item, false); // call with reroot=false to avoid recursion }.bind(this)); }.bind(this)); }
javascript
{ "resource": "" }
q44095
train
function(eventName, listener) { if (typeof listener === "function" || listener.handleEvent) { this._namedListeners[eventName] = this._namedListeners[eventName] || []; this._namedListeners[eventName].push(listener); } }
javascript
{ "resource": "" }
q44096
train
function(eventName, listener) { var listeners = this._namedListeners[eventName]; if (listeners) { for (var i = 0; i < listeners.length; i++) { if (listeners[i] === listener) { if (listeners.length === 1) { delete this._namedListeners[eventName]; } else { listeners.splice...
javascript
{ "resource": "" }
q44097
NumberType
train
function NumberType(typeSpec) { // Default to integer values this._allowFloat = !!typeSpec.allowFloat; if (typeSpec) { this._min = typeSpec.min; this._max = typeSpec.max; this._step = typeSpec.step || 1; if (!this._allowFloat && (this._isFloat(this._min) || this._isFloat(this._m...
javascript
{ "resource": "" }
q44098
DelegateType
train
function DelegateType(typeSpec) { if (typeof typeSpec.delegateType !== 'function') { throw new Error('Instances of DelegateType need typeSpec.delegateType to be a function that returns a type'); } Object.keys(typeSpec).forEach(function(key) { this[key] = typeSpec[key]; }, this); }
javascript
{ "resource": "" }
q44099
ArrayType
train
function ArrayType(typeSpec) { if (!typeSpec.subtype) { console.error('Array.typeSpec is missing subtype. Assuming string.' + JSON.stringify(typeSpec)); typeSpec.subtype = 'string'; } Object.keys(typeSpec).forEach(function(key) { this[key] = typeSpec[key]; }, this); this.subtype = types.g...
javascript
{ "resource": "" }