type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
|---|---|---|---|---|
ClassDeclaration
|
class VariablesView extends viewlet.CollapsibleViewletView {
private static MEMENTO = 'variablesview.memento';
constructor(actionRunner: actions.IActionRunner, private settings: any,
@IMessageService messageService: IMessageService,
@IContextMenuService contextMenuService: IContextMenuService,
@IDebugService private debugService: IDebugService,
@IInstantiationService private instantiationService: IInstantiationService
) {
super(actionRunner, !!settings[VariablesView.MEMENTO], nls.localize('variablesSection', "Variables Section"), messageService, contextMenuService);
}
public renderHeader(container: HTMLElement): void {
super.renderHeader(container);
const titleDiv = $('div.title').appendTo(container);
$('span').text(nls.localize('variables', "Variables")).appendTo(titleDiv);
}
public renderBody(container: HTMLElement): void {
dom.addClass(container, 'debug-variables');
this.treeContainer = renderViewTree(container);
this.tree = new treeimpl.Tree(this.treeContainer, {
dataSource: new viewer.VariablesDataSource(this.debugService),
renderer: this.instantiationService.createInstance(viewer.VariablesRenderer),
accessibilityProvider: new viewer.VariablesAccessibilityProvider(),
controller: new viewer.BaseDebugController(this.debugService, this.contextMenuService, new viewer.VariablesActionProvider(this.instantiationService))
}, debugTreeOptions(nls.localize('variablesAriaTreeLabel', "Debug Variables")));
const viewModel = this.debugService.getViewModel();
this.tree.setInput(viewModel);
const collapseAction = this.instantiationService.createInstance(viewlet.CollapseAction, this.tree, false, 'explorer-action collapse-explorer');
this.toolBar.setActions(actionbarregistry.prepareActions([collapseAction]))();
this.toDispose.push(viewModel.addListener2(debug.ViewModelEvents.FOCUSED_STACK_FRAME_UPDATED, () => this.onFocusedStackFrameUpdated()));
this.toDispose.push(this.debugService.addListener2(debug.ServiceEvents.STATE_CHANGED, () => {
collapseAction.enabled = this.debugService.getState() === debug.State.Running || this.debugService.getState() === debug.State.Stopped;
}));
}
private onFocusedStackFrameUpdated(): void {
this.tree.refresh().then(() => {
const stackFrame = this.debugService.getViewModel().getFocusedStackFrame();
if (stackFrame) {
return stackFrame.getScopes(this.debugService).then(scopes => {
if (scopes.length > 0) {
return this.tree.expand(scopes[0]);
}
});
}
}).done(null, errors.onUnexpectedError);
}
public shutdown(): void {
this.settings[VariablesView.MEMENTO] = (this.state === splitview.CollapsibleState.COLLAPSED);
super.shutdown();
}
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
ClassDeclaration
|
class WatchExpressionsView extends viewlet.CollapsibleViewletView {
private static MEMENTO = 'watchexpressionsview.memento';
constructor(actionRunner: actions.IActionRunner, private settings: any,
@IMessageService messageService: IMessageService,
@IContextMenuService contextMenuService: IContextMenuService,
@IDebugService private debugService: IDebugService,
@IInstantiationService private instantiationService: IInstantiationService
) {
super(actionRunner, !!settings[WatchExpressionsView.MEMENTO], nls.localize('expressionsSection', "Expressions Section"), messageService, contextMenuService);
this.toDispose.push(this.debugService.getModel().addListener2(debug.ModelEvents.WATCH_EXPRESSIONS_UPDATED, (we) => {
// only expand when a new watch expression is added.
if (we instanceof model.Expression) {
this.expand();
}
}));
}
public renderHeader(container: HTMLElement): void {
super.renderHeader(container);
const titleDiv = $('div.title').appendTo(container);
$('span').text(nls.localize('watch', "Watch")).appendTo(titleDiv);
}
public renderBody(container: HTMLElement): void {
dom.addClass(container, 'debug-watch');
this.treeContainer = renderViewTree(container);
const actionProvider = new viewer.WatchExpressionsActionProvider(this.instantiationService);
this.tree = new treeimpl.Tree(this.treeContainer, {
dataSource: new viewer.WatchExpressionsDataSource(this.debugService),
renderer: this.instantiationService.createInstance(viewer.WatchExpressionsRenderer, actionProvider, this.actionRunner),
accessibilityProvider: new viewer.WatchExpressionsAccessibilityProvider(),
controller: new viewer.WatchExpressionsController(this.debugService, this.contextMenuService, actionProvider)
}, debugTreeOptions(nls.localize('watchAriaTreeLabel', "Debug Watch Expressions")));
this.tree.setInput(this.debugService.getModel());
const addWatchExpressionAction = this.instantiationService.createInstance(debugactions.AddWatchExpressionAction, debugactions.AddWatchExpressionAction.ID, debugactions.AddWatchExpressionAction.LABEL);
const collapseAction = this.instantiationService.createInstance(viewlet.CollapseAction, this.tree, false, 'explorer-action collapse-explorer');
const removeAllWatchExpressionsAction = this.instantiationService.createInstance(debugactions.RemoveAllWatchExpressionsAction, debugactions.RemoveAllWatchExpressionsAction.ID, debugactions.RemoveAllWatchExpressionsAction.LABEL);
this.toolBar.setActions(actionbarregistry.prepareActions([addWatchExpressionAction, collapseAction, removeAllWatchExpressionsAction]))();
this.toDispose.push(this.debugService.getModel().addListener2(debug.ModelEvents.WATCH_EXPRESSIONS_UPDATED, (we: model.Expression) => this.onWatchExpressionsUpdated(we)));
this.toDispose.push(this.debugService.getViewModel().addListener2(debug.ViewModelEvents.SELECTED_EXPRESSION_UPDATED, (expression: debug.IExpression) => {
if (!expression || !(expression instanceof model.Expression)) {
return;
}
this.tree.refresh(expression, false).then(() => {
this.tree.setHighlight(expression);
const unbind = this.tree.addListener(events.EventType.HIGHLIGHT, (e: tree.IHighlightEvent) => {
if (!e.highlight) {
this.debugService.getViewModel().setSelectedExpression(null);
this.tree.refresh(expression).done(null, errors.onUnexpectedError);
unbind();
}
});
}).done(null, errors.onUnexpectedError);
}));
}
private onWatchExpressionsUpdated(we: model.Expression): void {
this.tree.refresh().done(() => {
return we instanceof model.Expression ? this.tree.reveal(we): TPromise.as(true);
}, errors.onUnexpectedError);
}
public shutdown(): void {
this.settings[WatchExpressionsView.MEMENTO] = (this.state === splitview.CollapsibleState.COLLAPSED);
super.shutdown();
}
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
ClassDeclaration
|
class CallStackView extends viewlet.CollapsibleViewletView {
private static MEMENTO = 'callstackview.memento';
private messageBox: HTMLDivElement;
private fullSize: number;
constructor(actionRunner: actions.IActionRunner, private settings: any,
@IMessageService messageService: IMessageService,
@IContextMenuService contextMenuService: IContextMenuService,
@IDebugService private debugService: IDebugService,
@IInstantiationService private instantiationService: IInstantiationService
) {
super(actionRunner, !!settings[CallStackView.MEMENTO], nls.localize('callstackSection', "Call Stack Section"), messageService, contextMenuService);
}
public renderHeader(container: HTMLElement): void {
super.renderHeader(container);
const titleDiv = $('div.title').appendTo(container);
$('span').text(nls.localize('callStack', "Call Stack")).appendTo(titleDiv);
}
public renderBody(container: HTMLElement): void {
dom.addClass(container, 'debug-call-stack');
this.renderMessageBox(container);
this.treeContainer = renderViewTree(container);
this.tree = new treeimpl.Tree(this.treeContainer, {
dataSource: new viewer.CallStackDataSource(),
renderer: this.instantiationService.createInstance(viewer.CallStackRenderer),
accessibilityProvider: this.instantiationService.createInstance(viewer.CallstackAccessibilityProvider)
}, debugTreeOptions(nls.localize('callStackAriaLabel', "Debug Call Stack")));
const debugModel = this.debugService.getModel();
this.tree.setInput(debugModel);
this.toDispose.push(this.tree.addListener2('selection', (e: tree.ISelectionEvent) => {
if (!e.selection.length) {
return;
}
const element = e.selection[0];
if (!(element instanceof model.StackFrame)) {
return;
}
const stackFrame = <debug.IStackFrame> element;
this.debugService.setFocusedStackFrameAndEvaluate(stackFrame);
const isMouse = (e.payload.origin === 'mouse');
let preserveFocus = isMouse;
const originalEvent:KeyboardEvent|MouseEvent = e && e.payload && e.payload.originalEvent;
if (originalEvent && isMouse && originalEvent.detail === 2) {
preserveFocus = false;
originalEvent.preventDefault(); // focus moves to editor, we need to prevent default
}
const sideBySide = (originalEvent && (originalEvent.ctrlKey || originalEvent.metaKey));
this.debugService.openOrRevealEditor(stackFrame.source, stackFrame.lineNumber, preserveFocus, sideBySide).done(null, errors.onUnexpectedError);
}));
this.toDispose.push(debugModel.addListener2(debug.ModelEvents.CALLSTACK_UPDATED, () => {
this.tree.refresh().done(null, errors.onUnexpectedError);
}));
this.toDispose.push(this.debugService.getViewModel().addListener2(debug.ViewModelEvents.FOCUSED_STACK_FRAME_UPDATED, () => {
const focussedThread = this.debugService.getModel().getThreads()[this.debugService.getViewModel().getFocusedThreadId()];
const previouslyHidden = this.messageBox.hidden;
if (focussedThread && focussedThread.stoppedReason && focussedThread.stoppedReason !== 'step') {
this.messageBox.textContent = nls.localize('debugStopped', "Paused on {0}.", focussedThread.stoppedReason);
focussedThread.stoppedReason === 'exception' ? this.messageBox.classList.add('exception') : this.messageBox.classList.remove('exception');
this.messageBox.hidden = false;
} else {
this.messageBox.hidden = true;
}
if (previouslyHidden !== this.messageBox.hidden) {
this.layoutBody(this.fullSize);
}
}));
this.toDispose.push(this.debugService.getViewModel().addListener2(debug.ViewModelEvents.FOCUSED_STACK_FRAME_UPDATED,() => {
const focused = this.debugService.getViewModel().getFocusedStackFrame();
if (focused) {
const threads = this.debugService.getModel().getThreads();
for (let ref in threads) {
if (threads[ref].callStack.some(sf => sf === focused)) {
this.tree.expand(threads[ref]);
}
}
this.tree.setFocus(focused);
}
}));
}
public layoutBody(size: number): void {
this.fullSize = size;
const sizeWithRespectToMessageBox = this.messageBox && !this.messageBox.hidden ? size - 27 : size;
super.layoutBody(sizeWithRespectToMessageBox);
}
private renderMessageBox(container: HTMLElement): void {
this.messageBox = document.createElement('div');
dom.addClass(this.messageBox, 'debug-message-box');
this.messageBox.hidden = true;
container.appendChild(this.messageBox);
}
public shutdown(): void {
this.settings[CallStackView.MEMENTO] = (this.state === splitview.CollapsibleState.COLLAPSED);
super.shutdown();
}
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
ClassDeclaration
|
class BreakpointsView extends viewlet.AdaptiveCollapsibleViewletView {
private static MAX_VISIBLE_FILES = 9;
private static MEMENTO = 'breakopintsview.memento';
constructor(actionRunner: actions.IActionRunner, private settings: any,
@IMessageService messageService: IMessageService,
@IContextMenuService contextMenuService: IContextMenuService,
@IDebugService private debugService: IDebugService,
@IInstantiationService private instantiationService: IInstantiationService
) {
super(actionRunner, BreakpointsView.getExpandedBodySize(
debugService.getModel().getBreakpoints().length + debugService.getModel().getFunctionBreakpoints().length + debugService.getModel().getExceptionBreakpoints().length),
!!settings[BreakpointsView.MEMENTO], nls.localize('breakpointsSection', "Breakpoints Section"), messageService, contextMenuService);
this.toDispose.push(this.debugService.getModel().addListener2(debug.ModelEvents.BREAKPOINTS_UPDATED,() => this.onBreakpointsChange()));
}
public renderHeader(container: HTMLElement): void {
super.renderHeader(container);
const titleDiv = $('div.title').appendTo(container);
$('span').text(nls.localize('breakpoints', "Breakpoints")).appendTo(titleDiv);
}
public renderBody(container: HTMLElement): void {
dom.addClass(container, 'debug-breakpoints');
this.treeContainer = renderViewTree(container);
const actionProvider = new viewer.BreakpointsActionProvider(this.instantiationService);
this.tree = new treeimpl.Tree(this.treeContainer, {
dataSource: new viewer.BreakpointsDataSource(),
renderer: this.instantiationService.createInstance(viewer.BreakpointsRenderer, actionProvider, this.actionRunner),
accessibilityProvider: this.instantiationService.createInstance(viewer.BreakpointsAccessibilityProvider),
controller: new viewer.BreakpointsController(this.debugService, this.contextMenuService, actionProvider),
sorter: {
compare(tree: tree.ITree, element: any, otherElement: any): number {
const first = <debug.IBreakpoint> element;
const second = <debug.IBreakpoint> otherElement;
if (first instanceof model.ExceptionBreakpoint) {
return -1;
}
if (second instanceof model.ExceptionBreakpoint) {
return 1;
}
if (first instanceof model.FunctionBreakpoint) {
return -1;
}
if(second instanceof model.FunctionBreakpoint) {
return 1;
}
if (first.source.uri.toString() !== second.source.uri.toString()) {
return first.source.uri.toString().localeCompare(second.source.uri.toString());
}
return first.desiredLineNumber - second.desiredLineNumber;
}
}
}, debugTreeOptions(nls.localize('breakpointsAriaTreeLabel', "Debug Breakpoints")));
const debugModel = this.debugService.getModel();
this.tree.setInput(debugModel);
this.toDispose.push(this.tree.addListener2('selection', (e: tree.ISelectionEvent) => {
if (!e.selection.length) {
return;
}
const element = e.selection[0];
if (!(element instanceof model.Breakpoint)) {
return;
}
const breakpoint = <debug.IBreakpoint> element;
if (!breakpoint.source.inMemory) {
const isMouse = (e.payload.origin === 'mouse');
let preserveFocus = isMouse;
const originalEvent:KeyboardEvent|MouseEvent = e && e.payload && e.payload.originalEvent;
if (originalEvent && isMouse && originalEvent.detail === 2) {
preserveFocus = false;
originalEvent.preventDefault(); // focus moves to editor, we need to prevent default
}
const sideBySide = (originalEvent && (originalEvent.ctrlKey || originalEvent.metaKey));
this.debugService.openOrRevealEditor(breakpoint.source, breakpoint.lineNumber, preserveFocus, sideBySide).done(null, errors.onUnexpectedError);
}
}));
}
public getActions(): actions.IAction[] {
return [
// this.instantiationService.createInstance(debugactions.AddFunctionBreakpointAction, debugactions.AddFunctionBreakpointAction.ID, debugactions.AddFunctionBreakpointAction.LABEL),
this.instantiationService.createInstance(debugactions.ReapplyBreakpointsAction, debugactions.ReapplyBreakpointsAction.ID, debugactions.ReapplyBreakpointsAction.LABEL),
this.instantiationService.createInstance(debugactions.ToggleBreakpointsActivatedAction, debugactions.ToggleBreakpointsActivatedAction.ID, debugactions.ToggleBreakpointsActivatedAction.LABEL),
this.instantiationService.createInstance(debugactions.RemoveAllBreakpointsAction, debugactions.RemoveAllBreakpointsAction.ID, debugactions.RemoveAllBreakpointsAction.LABEL)
];
}
private onBreakpointsChange(): void {
const model = this.debugService.getModel();
this.expandedBodySize = BreakpointsView.getExpandedBodySize(
model.getBreakpoints().length + model.getExceptionBreakpoints().length + model.getFunctionBreakpoints().length);
if (this.tree) {
this.tree.refresh();
}
}
private static getExpandedBodySize(length: number): number {
return Math.min(BreakpointsView.MAX_VISIBLE_FILES, length) * 22;
}
public shutdown(): void {
this.settings[BreakpointsView.MEMENTO] = (this.state === splitview.CollapsibleState.COLLAPSED);
super.shutdown();
}
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
ClassDeclaration
|
export class DebugViewlet extends viewlet.Viewlet {
private toDispose: lifecycle.IDisposable[];
private actions: actions.IAction[];
private progressRunner: IProgressRunner;
private viewletSettings: any;
private $el: builder.Builder;
private splitView: splitview.SplitView;
private views: viewlet.IViewletView[];
constructor(
@ITelemetryService telemetryService: ITelemetryService,
@IProgressService private progressService: IProgressService,
@IDebugService private debugService: IDebugService,
@IInstantiationService private instantiationService: IInstantiationService,
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@IStorageService storageService: IStorageService
) {
super(debug.VIEWLET_ID, telemetryService);
this.progressRunner = null;
this.viewletSettings = this.getMemento(storageService, memento.Scope.WORKSPACE);
this.views = [];
this.toDispose = [];
this.toDispose.push(this.debugService.addListener2(debug.ServiceEvents.STATE_CHANGED, () => {
this.onDebugServiceStateChange();
}));
}
// viewlet
public create(parent: builder.Builder): TPromise<void> {
super.create(parent);
this.$el = parent.div().addClass('debug-viewlet');
if (this.contextService.getWorkspace()) {
const actionRunner = this.getActionRunner();
this.views.push(this.instantiationService.createInstance(VariablesView, actionRunner, this.viewletSettings));
this.views.push(this.instantiationService.createInstance(WatchExpressionsView, actionRunner, this.viewletSettings));
this.views.push(this.instantiationService.createInstance(CallStackView, actionRunner, this.viewletSettings));
this.views.push(this.instantiationService.createInstance(BreakpointsView, actionRunner, this.viewletSettings));
this.splitView = new splitview.SplitView(this.$el.getHTMLElement());
this.toDispose.push(this.splitView);
this.views.forEach(v => this.splitView.addView(<any> v));
} else {
this.$el.append($([
'<div class="noworkspace-view">',
'<p>', nls.localize('noWorkspace', "There is no currently opened folder."), '</p>',
'<p>', nls.localize('pleaseRestartToDebug', "Open a folder in order to start debugging."), '</p>',
'</div>'
].join('')));
}
return TPromise.as(null);
}
public setVisible(visible: boolean): TPromise<void> {
return super.setVisible(visible).then(() => {
return Promise.join(this.views.map((view) => view.setVisible(visible)));
});
}
public layout(dimension: builder.Dimension): void {
if (this.splitView) {
this.splitView.layout(dimension.height);
}
}
public focus(): void {
super.focus();
if (this.views.length > 0) {
(<VariablesView>this.views[0]).focusBody();
}
}
public getActions(): actions.IAction[] {
if (this.debugService.getState() === debug.State.Disabled) {
return [];
}
if (!this.actions) {
this.actions = [
this.instantiationService.createInstance(debugactions.StartDebugAction, debugactions.StartDebugAction.ID, debugactions.StartDebugAction.LABEL),
this.instantiationService.createInstance(debugactions.SelectConfigAction, debugactions.SelectConfigAction.ID, debugactions.SelectConfigAction.LABEL),
this.instantiationService.createInstance(debugactions.ConfigureAction, debugactions.ConfigureAction.ID, debugactions.ConfigureAction.LABEL),
this.instantiationService.createInstance(debugactions.ToggleReplAction, debugactions.ToggleReplAction.ID, debugactions.ToggleReplAction.LABEL)
];
this.actions.forEach(a => {
this.toDispose.push(a);
});
}
return this.actions;
}
public getActionItem(action: actions.IAction): actionbar.IActionItem {
if (action.id === debugactions.SelectConfigAction.ID) {
return this.instantiationService.createInstance(dbgactionitems.SelectConfigActionItem, action);
}
return null;
}
private onDebugServiceStateChange(): void {
if (this.progressRunner) {
this.progressRunner.done();
}
if (this.debugService.getState() === debug.State.Initializing) {
this.progressRunner = this.progressService.show(true);
} else {
this.progressRunner = null;
}
}
public dispose(): void {
this.toDispose = lifecycle.disposeAll(this.toDispose);
super.dispose();
}
public shutdown(): void {
this.views.forEach(v => v.shutdown());
super.shutdown();
}
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
MethodDeclaration
|
public renderHeader(container: HTMLElement): void {
super.renderHeader(container);
const titleDiv = $('div.title').appendTo(container);
$('span').text(nls.localize('variables', "Variables")).appendTo(titleDiv);
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
MethodDeclaration
|
public renderBody(container: HTMLElement): void {
dom.addClass(container, 'debug-variables');
this.treeContainer = renderViewTree(container);
this.tree = new treeimpl.Tree(this.treeContainer, {
dataSource: new viewer.VariablesDataSource(this.debugService),
renderer: this.instantiationService.createInstance(viewer.VariablesRenderer),
accessibilityProvider: new viewer.VariablesAccessibilityProvider(),
controller: new viewer.BaseDebugController(this.debugService, this.contextMenuService, new viewer.VariablesActionProvider(this.instantiationService))
}, debugTreeOptions(nls.localize('variablesAriaTreeLabel', "Debug Variables")));
const viewModel = this.debugService.getViewModel();
this.tree.setInput(viewModel);
const collapseAction = this.instantiationService.createInstance(viewlet.CollapseAction, this.tree, false, 'explorer-action collapse-explorer');
this.toolBar.setActions(actionbarregistry.prepareActions([collapseAction]))();
this.toDispose.push(viewModel.addListener2(debug.ViewModelEvents.FOCUSED_STACK_FRAME_UPDATED, () => this.onFocusedStackFrameUpdated()));
this.toDispose.push(this.debugService.addListener2(debug.ServiceEvents.STATE_CHANGED, () => {
collapseAction.enabled = this.debugService.getState() === debug.State.Running || this.debugService.getState() === debug.State.Stopped;
}));
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
MethodDeclaration
|
private onFocusedStackFrameUpdated(): void {
this.tree.refresh().then(() => {
const stackFrame = this.debugService.getViewModel().getFocusedStackFrame();
if (stackFrame) {
return stackFrame.getScopes(this.debugService).then(scopes => {
if (scopes.length > 0) {
return this.tree.expand(scopes[0]);
}
});
}
}).done(null, errors.onUnexpectedError);
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
MethodDeclaration
|
public shutdown(): void {
this.settings[VariablesView.MEMENTO] = (this.state === splitview.CollapsibleState.COLLAPSED);
super.shutdown();
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
MethodDeclaration
|
public renderHeader(container: HTMLElement): void {
super.renderHeader(container);
const titleDiv = $('div.title').appendTo(container);
$('span').text(nls.localize('watch', "Watch")).appendTo(titleDiv);
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
MethodDeclaration
|
public renderBody(container: HTMLElement): void {
dom.addClass(container, 'debug-watch');
this.treeContainer = renderViewTree(container);
const actionProvider = new viewer.WatchExpressionsActionProvider(this.instantiationService);
this.tree = new treeimpl.Tree(this.treeContainer, {
dataSource: new viewer.WatchExpressionsDataSource(this.debugService),
renderer: this.instantiationService.createInstance(viewer.WatchExpressionsRenderer, actionProvider, this.actionRunner),
accessibilityProvider: new viewer.WatchExpressionsAccessibilityProvider(),
controller: new viewer.WatchExpressionsController(this.debugService, this.contextMenuService, actionProvider)
}, debugTreeOptions(nls.localize('watchAriaTreeLabel', "Debug Watch Expressions")));
this.tree.setInput(this.debugService.getModel());
const addWatchExpressionAction = this.instantiationService.createInstance(debugactions.AddWatchExpressionAction, debugactions.AddWatchExpressionAction.ID, debugactions.AddWatchExpressionAction.LABEL);
const collapseAction = this.instantiationService.createInstance(viewlet.CollapseAction, this.tree, false, 'explorer-action collapse-explorer');
const removeAllWatchExpressionsAction = this.instantiationService.createInstance(debugactions.RemoveAllWatchExpressionsAction, debugactions.RemoveAllWatchExpressionsAction.ID, debugactions.RemoveAllWatchExpressionsAction.LABEL);
this.toolBar.setActions(actionbarregistry.prepareActions([addWatchExpressionAction, collapseAction, removeAllWatchExpressionsAction]))();
this.toDispose.push(this.debugService.getModel().addListener2(debug.ModelEvents.WATCH_EXPRESSIONS_UPDATED, (we: model.Expression) => this.onWatchExpressionsUpdated(we)));
this.toDispose.push(this.debugService.getViewModel().addListener2(debug.ViewModelEvents.SELECTED_EXPRESSION_UPDATED, (expression: debug.IExpression) => {
if (!expression || !(expression instanceof model.Expression)) {
return;
}
this.tree.refresh(expression, false).then(() => {
this.tree.setHighlight(expression);
const unbind = this.tree.addListener(events.EventType.HIGHLIGHT, (e: tree.IHighlightEvent) => {
if (!e.highlight) {
this.debugService.getViewModel().setSelectedExpression(null);
this.tree.refresh(expression).done(null, errors.onUnexpectedError);
unbind();
}
});
}).done(null, errors.onUnexpectedError);
}));
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
MethodDeclaration
|
private onWatchExpressionsUpdated(we: model.Expression): void {
this.tree.refresh().done(() => {
return we instanceof model.Expression ? this.tree.reveal(we): TPromise.as(true);
}, errors.onUnexpectedError);
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
MethodDeclaration
|
public shutdown(): void {
this.settings[WatchExpressionsView.MEMENTO] = (this.state === splitview.CollapsibleState.COLLAPSED);
super.shutdown();
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
MethodDeclaration
|
public renderHeader(container: HTMLElement): void {
super.renderHeader(container);
const titleDiv = $('div.title').appendTo(container);
$('span').text(nls.localize('callStack', "Call Stack")).appendTo(titleDiv);
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
MethodDeclaration
|
public renderBody(container: HTMLElement): void {
dom.addClass(container, 'debug-call-stack');
this.renderMessageBox(container);
this.treeContainer = renderViewTree(container);
this.tree = new treeimpl.Tree(this.treeContainer, {
dataSource: new viewer.CallStackDataSource(),
renderer: this.instantiationService.createInstance(viewer.CallStackRenderer),
accessibilityProvider: this.instantiationService.createInstance(viewer.CallstackAccessibilityProvider)
}, debugTreeOptions(nls.localize('callStackAriaLabel', "Debug Call Stack")));
const debugModel = this.debugService.getModel();
this.tree.setInput(debugModel);
this.toDispose.push(this.tree.addListener2('selection', (e: tree.ISelectionEvent) => {
if (!e.selection.length) {
return;
}
const element = e.selection[0];
if (!(element instanceof model.StackFrame)) {
return;
}
const stackFrame = <debug.IStackFrame> element;
this.debugService.setFocusedStackFrameAndEvaluate(stackFrame);
const isMouse = (e.payload.origin === 'mouse');
let preserveFocus = isMouse;
const originalEvent:KeyboardEvent|MouseEvent = e && e.payload && e.payload.originalEvent;
if (originalEvent && isMouse && originalEvent.detail === 2) {
preserveFocus = false;
originalEvent.preventDefault(); // focus moves to editor, we need to prevent default
}
const sideBySide = (originalEvent && (originalEvent.ctrlKey || originalEvent.metaKey));
this.debugService.openOrRevealEditor(stackFrame.source, stackFrame.lineNumber, preserveFocus, sideBySide).done(null, errors.onUnexpectedError);
}));
this.toDispose.push(debugModel.addListener2(debug.ModelEvents.CALLSTACK_UPDATED, () => {
this.tree.refresh().done(null, errors.onUnexpectedError);
}));
this.toDispose.push(this.debugService.getViewModel().addListener2(debug.ViewModelEvents.FOCUSED_STACK_FRAME_UPDATED, () => {
const focussedThread = this.debugService.getModel().getThreads()[this.debugService.getViewModel().getFocusedThreadId()];
const previouslyHidden = this.messageBox.hidden;
if (focussedThread && focussedThread.stoppedReason && focussedThread.stoppedReason !== 'step') {
this.messageBox.textContent = nls.localize('debugStopped', "Paused on {0}.", focussedThread.stoppedReason);
focussedThread.stoppedReason === 'exception' ? this.messageBox.classList.add('exception') : this.messageBox.classList.remove('exception');
this.messageBox.hidden = false;
} else {
this.messageBox.hidden = true;
}
if (previouslyHidden !== this.messageBox.hidden) {
this.layoutBody(this.fullSize);
}
}));
this.toDispose.push(this.debugService.getViewModel().addListener2(debug.ViewModelEvents.FOCUSED_STACK_FRAME_UPDATED,() => {
const focused = this.debugService.getViewModel().getFocusedStackFrame();
if (focused) {
const threads = this.debugService.getModel().getThreads();
for (let ref in threads) {
if (threads[ref].callStack.some(sf => sf === focused)) {
this.tree.expand(threads[ref]);
}
}
this.tree.setFocus(focused);
}
}));
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
MethodDeclaration
|
public layoutBody(size: number): void {
this.fullSize = size;
const sizeWithRespectToMessageBox = this.messageBox && !this.messageBox.hidden ? size - 27 : size;
super.layoutBody(sizeWithRespectToMessageBox);
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
MethodDeclaration
|
private renderMessageBox(container: HTMLElement): void {
this.messageBox = document.createElement('div');
dom.addClass(this.messageBox, 'debug-message-box');
this.messageBox.hidden = true;
container.appendChild(this.messageBox);
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
MethodDeclaration
|
public shutdown(): void {
this.settings[CallStackView.MEMENTO] = (this.state === splitview.CollapsibleState.COLLAPSED);
super.shutdown();
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
MethodDeclaration
|
public renderHeader(container: HTMLElement): void {
super.renderHeader(container);
const titleDiv = $('div.title').appendTo(container);
$('span').text(nls.localize('breakpoints', "Breakpoints")).appendTo(titleDiv);
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
MethodDeclaration
|
public renderBody(container: HTMLElement): void {
dom.addClass(container, 'debug-breakpoints');
this.treeContainer = renderViewTree(container);
const actionProvider = new viewer.BreakpointsActionProvider(this.instantiationService);
this.tree = new treeimpl.Tree(this.treeContainer, {
dataSource: new viewer.BreakpointsDataSource(),
renderer: this.instantiationService.createInstance(viewer.BreakpointsRenderer, actionProvider, this.actionRunner),
accessibilityProvider: this.instantiationService.createInstance(viewer.BreakpointsAccessibilityProvider),
controller: new viewer.BreakpointsController(this.debugService, this.contextMenuService, actionProvider),
sorter: {
compare(tree: tree.ITree, element: any, otherElement: any): number {
const first = <debug.IBreakpoint> element;
const second = <debug.IBreakpoint> otherElement;
if (first instanceof model.ExceptionBreakpoint) {
return -1;
}
if (second instanceof model.ExceptionBreakpoint) {
return 1;
}
if (first instanceof model.FunctionBreakpoint) {
return -1;
}
if(second instanceof model.FunctionBreakpoint) {
return 1;
}
if (first.source.uri.toString() !== second.source.uri.toString()) {
return first.source.uri.toString().localeCompare(second.source.uri.toString());
}
return first.desiredLineNumber - second.desiredLineNumber;
}
}
}, debugTreeOptions(nls.localize('breakpointsAriaTreeLabel', "Debug Breakpoints")));
const debugModel = this.debugService.getModel();
this.tree.setInput(debugModel);
this.toDispose.push(this.tree.addListener2('selection', (e: tree.ISelectionEvent) => {
if (!e.selection.length) {
return;
}
const element = e.selection[0];
if (!(element instanceof model.Breakpoint)) {
return;
}
const breakpoint = <debug.IBreakpoint> element;
if (!breakpoint.source.inMemory) {
const isMouse = (e.payload.origin === 'mouse');
let preserveFocus = isMouse;
const originalEvent:KeyboardEvent|MouseEvent = e && e.payload && e.payload.originalEvent;
if (originalEvent && isMouse && originalEvent.detail === 2) {
preserveFocus = false;
originalEvent.preventDefault(); // focus moves to editor, we need to prevent default
}
const sideBySide = (originalEvent && (originalEvent.ctrlKey || originalEvent.metaKey));
this.debugService.openOrRevealEditor(breakpoint.source, breakpoint.lineNumber, preserveFocus, sideBySide).done(null, errors.onUnexpectedError);
}
}));
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
MethodDeclaration
|
compare(tree: tree.ITree, element: any, otherElement: any): number {
const first = <debug.IBreakpoint> element;
const second = <debug.IBreakpoint> otherElement;
if (first instanceof model.ExceptionBreakpoint) {
return -1;
}
if (second instanceof model.ExceptionBreakpoint) {
return 1;
}
if (first instanceof model.FunctionBreakpoint) {
return -1;
}
if(second instanceof model.FunctionBreakpoint) {
return 1;
}
if (first.source.uri.toString() !== second.source.uri.toString()) {
return first.source.uri.toString().localeCompare(second.source.uri.toString());
}
return first.desiredLineNumber - second.desiredLineNumber;
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
MethodDeclaration
|
public getActions(): actions.IAction[] {
return [
// this.instantiationService.createInstance(debugactions.AddFunctionBreakpointAction, debugactions.AddFunctionBreakpointAction.ID, debugactions.AddFunctionBreakpointAction.LABEL),
this.instantiationService.createInstance(debugactions.ReapplyBreakpointsAction, debugactions.ReapplyBreakpointsAction.ID, debugactions.ReapplyBreakpointsAction.LABEL),
this.instantiationService.createInstance(debugactions.ToggleBreakpointsActivatedAction, debugactions.ToggleBreakpointsActivatedAction.ID, debugactions.ToggleBreakpointsActivatedAction.LABEL),
this.instantiationService.createInstance(debugactions.RemoveAllBreakpointsAction, debugactions.RemoveAllBreakpointsAction.ID, debugactions.RemoveAllBreakpointsAction.LABEL)
];
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
MethodDeclaration
|
private onBreakpointsChange(): void {
const model = this.debugService.getModel();
this.expandedBodySize = BreakpointsView.getExpandedBodySize(
model.getBreakpoints().length + model.getExceptionBreakpoints().length + model.getFunctionBreakpoints().length);
if (this.tree) {
this.tree.refresh();
}
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
MethodDeclaration
|
private static getExpandedBodySize(length: number): number {
return Math.min(BreakpointsView.MAX_VISIBLE_FILES, length) * 22;
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
MethodDeclaration
|
public shutdown(): void {
this.settings[BreakpointsView.MEMENTO] = (this.state === splitview.CollapsibleState.COLLAPSED);
super.shutdown();
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
MethodDeclaration
|
// viewlet
public create(parent: builder.Builder): TPromise<void> {
super.create(parent);
this.$el = parent.div().addClass('debug-viewlet');
if (this.contextService.getWorkspace()) {
const actionRunner = this.getActionRunner();
this.views.push(this.instantiationService.createInstance(VariablesView, actionRunner, this.viewletSettings));
this.views.push(this.instantiationService.createInstance(WatchExpressionsView, actionRunner, this.viewletSettings));
this.views.push(this.instantiationService.createInstance(CallStackView, actionRunner, this.viewletSettings));
this.views.push(this.instantiationService.createInstance(BreakpointsView, actionRunner, this.viewletSettings));
this.splitView = new splitview.SplitView(this.$el.getHTMLElement());
this.toDispose.push(this.splitView);
this.views.forEach(v => this.splitView.addView(<any> v));
} else {
this.$el.append($([
'<div class="noworkspace-view">',
'<p>', nls.localize('noWorkspace', "There is no currently opened folder."), '</p>',
'<p>', nls.localize('pleaseRestartToDebug', "Open a folder in order to start debugging."), '</p>',
'</div>'
].join('')));
}
return TPromise.as(null);
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
MethodDeclaration
|
public setVisible(visible: boolean): TPromise<void> {
return super.setVisible(visible).then(() => {
return Promise.join(this.views.map((view) => view.setVisible(visible)));
});
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
MethodDeclaration
|
public layout(dimension: builder.Dimension): void {
if (this.splitView) {
this.splitView.layout(dimension.height);
}
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
MethodDeclaration
|
public focus(): void {
super.focus();
if (this.views.length > 0) {
(<VariablesView>this.views[0]).focusBody();
}
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
MethodDeclaration
|
public getActions(): actions.IAction[] {
if (this.debugService.getState() === debug.State.Disabled) {
return [];
}
if (!this.actions) {
this.actions = [
this.instantiationService.createInstance(debugactions.StartDebugAction, debugactions.StartDebugAction.ID, debugactions.StartDebugAction.LABEL),
this.instantiationService.createInstance(debugactions.SelectConfigAction, debugactions.SelectConfigAction.ID, debugactions.SelectConfigAction.LABEL),
this.instantiationService.createInstance(debugactions.ConfigureAction, debugactions.ConfigureAction.ID, debugactions.ConfigureAction.LABEL),
this.instantiationService.createInstance(debugactions.ToggleReplAction, debugactions.ToggleReplAction.ID, debugactions.ToggleReplAction.LABEL)
];
this.actions.forEach(a => {
this.toDispose.push(a);
});
}
return this.actions;
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
MethodDeclaration
|
public getActionItem(action: actions.IAction): actionbar.IActionItem {
if (action.id === debugactions.SelectConfigAction.ID) {
return this.instantiationService.createInstance(dbgactionitems.SelectConfigActionItem, action);
}
return null;
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
MethodDeclaration
|
private onDebugServiceStateChange(): void {
if (this.progressRunner) {
this.progressRunner.done();
}
if (this.debugService.getState() === debug.State.Initializing) {
this.progressRunner = this.progressService.show(true);
} else {
this.progressRunner = null;
}
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
MethodDeclaration
|
public dispose(): void {
this.toDispose = lifecycle.disposeAll(this.toDispose);
super.dispose();
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
MethodDeclaration
|
public shutdown(): void {
this.views.forEach(v => v.shutdown());
super.shutdown();
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
ArrowFunction
|
() => {
const snap = snapshot.render(
<Groups>
<Button design='accent'>Make payment</Button>
<>
<Button design='outline'>Download statement</Button>
<Button design='outline'>
<Trash size='xs' /> Delete statement
</Button>
</>
</Groups>
);
expect(snap).toMatchSnapshot();
}
|
Raiffeisen-DGTL/ViennaUI
|
workspaces/ui/src/Groups/Groups.spec.tsx
|
TypeScript
|
ArrowFunction
|
() => {
const snap = snapshot.render(
<Groups>
{null}
<Button design='accent'>Make payment</Button>
{false}
<Button design='outline'>
<Trash size='xs' /> Delete statement
</Button>
</Groups>
);
expect(snap).toMatchSnapshot();
}
|
Raiffeisen-DGTL/ViennaUI
|
workspaces/ui/src/Groups/Groups.spec.tsx
|
TypeScript
|
ArrowFunction
|
() => {
const snap = snapshot.render(
<Groups>
<Button design='accent'>Make payment</Button>
<Groups>
<Button design='outline'>Download statement</Button>
<Button design='outline'>
<Trash size='xs' /> Delete statement
</Button>
</Groups>
</Groups>
);
expect(snap).toMatchSnapshot();
}
|
Raiffeisen-DGTL/ViennaUI
|
workspaces/ui/src/Groups/Groups.spec.tsx
|
TypeScript
|
ArrowFunction
|
() => {
const designs: GroupsProps['design'][] = ['horizontal', 'vertical'];
designs.forEach((design) => {
const snap = snapshot.render(
<Groups design={design}>
<Button design='accent'>Make payment</Button>
<Button design='outline'>Download statement</Button>
<Button design='outline'>
<Trash size='xs' /> Delete statement
</Button>
</Groups>
);
expect(snap).toMatchSnapshot(design);
});
}
|
Raiffeisen-DGTL/ViennaUI
|
workspaces/ui/src/Groups/Groups.spec.tsx
|
TypeScript
|
ArrowFunction
|
(design) => {
const snap = snapshot.render(
<Groups design={design}>
<Button design='accent'>Make payment</Button>
<Button design='outline'>Download statement</Button>
<Button design='outline'>
<Trash size='xs' /> Delete statement
</Button>
</Groups>
);
expect(snap).toMatchSnapshot(design);
}
|
Raiffeisen-DGTL/ViennaUI
|
workspaces/ui/src/Groups/Groups.spec.tsx
|
TypeScript
|
ArrowFunction
|
() => {
const sizes: GroupsProps['size'][] = ['xs', 's', 'm', 'l', 'xl'];
sizes.forEach((size) => {
const snap = snapshot.render(
<Groups size={size}>
<Button design='accent'>Make payment</Button>
<Button design='outline'>Download statement</Button>
<Button design='outline'>
<Trash size='xs' /> Delete statement
</Button>
</Groups>
);
expect(snap).toMatchSnapshot(size);
});
}
|
Raiffeisen-DGTL/ViennaUI
|
workspaces/ui/src/Groups/Groups.spec.tsx
|
TypeScript
|
ArrowFunction
|
(size) => {
const snap = snapshot.render(
<Groups size={size}>
<Button design='accent'>Make payment</Button>
<Button design='outline'>Download statement</Button>
<Button design='outline'>
<Trash size='xs' /> Delete statement
</Button>
</Groups>
);
expect(snap).toMatchSnapshot(size);
}
|
Raiffeisen-DGTL/ViennaUI
|
workspaces/ui/src/Groups/Groups.spec.tsx
|
TypeScript
|
ArrowFunction
|
() => {
const snap = snapshot.render(
<Groups height='full'>
<Button design='accent'>Make payment</Button>
<Groups>
<Button design='outline'>Download statement</Button>
<Button design='outline'>
<Trash size='xs' /> Delete statement
</Button>
</Groups>
</Groups>
);
expect(snap).toMatchSnapshot();
}
|
Raiffeisen-DGTL/ViennaUI
|
workspaces/ui/src/Groups/Groups.spec.tsx
|
TypeScript
|
ArrowFunction
|
() => {
const snap = snapshot.render(
<Groups alignItems='stretch'>
<Button design='accent'>Make payment</Button>
<Button design='outline'>Download statement</Button>
<Button design='outline'>
<Trash size='xs' /> Delete statement
</Button>
</Groups>
);
expect(snap).toMatchSnapshot();
}
|
Raiffeisen-DGTL/ViennaUI
|
workspaces/ui/src/Groups/Groups.spec.tsx
|
TypeScript
|
ArrowFunction
|
() => {
const snap = snapshot.render(
<Groups justifyContent='center'>
<Button design='accent'>Make payment</Button>
<Button design='outline'>Download statement</Button>
<Button design='outline'>
<Trash size='xs' /> Delete statement
</Button>
</Groups>
);
expect(snap).toMatchSnapshot();
}
|
Raiffeisen-DGTL/ViennaUI
|
workspaces/ui/src/Groups/Groups.spec.tsx
|
TypeScript
|
ArrowFunction
|
() => {
const props = { className: 'className', id: 'Counter', title: 'title', onClick: () => 'Counter' };
const component = (
<Groups {...props}>
<Button design='accent'>Make payment</Button>
<Button design='outline'>Download statement</Button>
<Button design='outline'>
<Trash size='xs' /> Delete statement
</Button>
</Groups>
|
Raiffeisen-DGTL/ViennaUI
|
workspaces/ui/src/Groups/Groups.spec.tsx
|
TypeScript
|
ArrowFunction
|
() => 'Counter'
|
Raiffeisen-DGTL/ViennaUI
|
workspaces/ui/src/Groups/Groups.spec.tsx
|
TypeScript
|
ArrowFunction
|
() => {
const snap = snapshot.render(
<Groups clean>
<Button>{'A'}</Button>
{true}
{false}
{null}
{undefined}
{
<>
<Button>{'B'}</Button>
{true}
<Button>{'C'}</Button>
{null}
</>
}
|
Raiffeisen-DGTL/ViennaUI
|
workspaces/ui/src/Groups/Groups.spec.tsx
|
TypeScript
|
ArrowFunction
|
() => {
const { tableData } = useContext<Props | any>(SoccerContext);
const classes = useStyles();
const sortedTableDataByWins: Array<SoccerStanding> = tableData
.slice()
.sort((a: SoccerStanding, b: SoccerStanding) => b.won - a.won);
return (
<Table data-testid="StandingsTable">
<TableHead>
<TableRow>
<TableCell>Team</TableCell>
<TableCell>Won</TableCell>
<TableCell>Lost</TableCell>
<TableCell>Draw</TableCell>
<TableCell>Points</TableCell>
</TableRow>
</TableHead>
<TableBody>
{sortedTableDataByWins.map((soccerStanding) => {
const { won, draw, team, points, position, lost }: SoccerStanding =
soccerStanding;
return (
<TableRow key={position}>
<TableCell className={classes.center}>
{team?.crestUrl && (
<img
className={classes.img}
src={team.crestUrl}
alt={team?.name}
/>
)}
{team?.name && (
<span className={classes.team}>{team.name}</span>
|
gitmurali/soccer-app
|
src/components/Standings/Standings.tsx
|
TypeScript
|
ArrowFunction
|
(a: SoccerStanding, b: SoccerStanding) => b.won - a.won
|
gitmurali/soccer-app
|
src/components/Standings/Standings.tsx
|
TypeScript
|
ArrowFunction
|
(soccerStanding) => {
const { won, draw, team, points, position, lost }: SoccerStanding =
soccerStanding;
return (
<TableRow key={position}>
<TableCell className={classes.center}>
{team?.crestUrl && (
<img
className={classes.img}
src={team.crestUrl}
alt={team?.name}
/>
|
gitmurali/soccer-app
|
src/components/Standings/Standings.tsx
|
TypeScript
|
TypeAliasDeclaration
|
type Props = {
tableData: Array<SoccerStanding>;
};
|
gitmurali/soccer-app
|
src/components/Standings/Standings.tsx
|
TypeScript
|
ArrowFunction
|
() => {
return (
<div class="row gy-4 pb-5 mb-5">
<div>
<GithubSource name="ButtonGroupDocs" />
<h2>Button groups</h2>
<p class="lead">
Group a series of buttons together on a single line with the button
group.
</p>
</div>
<div>
<ButtonGroup aria-label="Basic example">
<Button variant="secondary">Left</Button>
<Button variant="secondary">Middle</Button>
<Button variant="secondary">Right</Button>
</ButtonGroup>
</div>
<div>
<h4>Button toolbar</h4>
<ButtonToolbar aria-label="Toolbar with button groups">
<ButtonGroup className="me-2" aria-label="First group">
<Button>1</Button> <Button>2</Button> <Button>3</Button>{" "}
<Button>4</Button>
</ButtonGroup>
<ButtonGroup className="me-2" aria-label="Second group">
<Button>5</Button> <Button>6</Button> <Button>7</Button>
</ButtonGroup>
<ButtonGroup aria-label="Third group">
<Button>8</Button>
</ButtonGroup>
</ButtonToolbar>
</div>
<div>
<p>
Feel free to mix input groups with button groups in your toolbars.
Similar to the example above, you’ll likely need some utilities though
to space things properly.
</p>
<ButtonToolbar className="mb-3" aria-label="Toolbar with Button groups">
<ButtonGroup className="me-2" aria-label="First group">
<Button variant="secondary">1</Button>{" "}
<Button variant="secondary">2</Button>{" "}
<Button variant="secondary">3</Button>{" "}
<Button variant="secondary">4</Button>
</ButtonGroup>
<InputGroup>
<InputGroup.Text id="btnGroupAddon">@</InputGroup.Text>
<FormControl
type="text"
placeholder="Input group example"
aria-label="Input group example"
aria-describedby="btnGroupAddon"
/>
</InputGroup>
</ButtonToolbar>
<ButtonToolbar
className="justify-content-between"
aria-label="Toolbar with Button groups"
>
<ButtonGroup aria-label="First group">
<Button variant="secondary">1</Button>{" "}
<Button variant="secondary">2</Button>{" "}
<Button variant="secondary">3</Button>{" "}
<Button variant="secondary">4</Button>
</ButtonGroup>
<InputGroup>
<InputGroup.Text id="btnGroupAddon2">@</InputGroup.Text>
<FormControl
type="text"
placeholder="Input group example"
aria-label="Input group example"
aria-describedby="btnGroupAddon2"
/>
</InputGroup>
</ButtonToolbar>
</div>
<div>
<h4>Sizing</h4>
<ButtonGroup size="lg" className="mb-2">
<Button>Left</Button>
<Button>Middle</Button>
<Button>Right</Button>
</ButtonGroup>
<br />
<ButtonGroup className="mb-2">
<Button>Left</Button>
<Button>Middle</Button>
<Button>Right</Button>
</ButtonGroup>
<br />
<ButtonGroup size="sm">
<Button>Left</Button>
<Button>Middle</Button>
<Button>Right</Button>
</ButtonGroup>
</div>
<div>
<h4>Nesting</h4>
<ButtonGroup>
<Button>1</Button>
<Button>2</Button>
<DropdownButton
as={ButtonGroup}
title="Dropdown"
id="bg-nested-dropdown"
>
<Dropdown.Item eventKey="1">Dropdown link</Dropdown.Item>
<Dropdown.Item eventKey="2">Dropdown link</Dropdown.Item>
</DropdownButton>
</ButtonGroup>
</div>
<div>
<h4>Vertical variation</h4>
<ButtonGroup vertical>
<Button>Button</Button>
<Button>Button</Button>
<DropdownButton
as={ButtonGroup}
title="Dropdown"
id="bg-vertical-dropdown-1"
>
<Dropdown.Item eventKey="1">Dropdown link</Dropdown.Item>
<Dropdown.Item eventKey="2">Dropdown link</Dropdown.Item>
</DropdownButton>
<Button>Button</Button>
<Button>Button</Button>
<DropdownButton
as={ButtonGroup}
title="Dropdown"
id="bg-vertical-dropdown-2"
>
<Dropdown.Item eventKey="1">Dropdown link</Dropdown.Item>
<Dropdown.Item eventKey="2">Dropdown link</Dropdown.Item>
</DropdownButton>
<DropdownButton
as={ButtonGroup}
title="Dropdown"
id="bg-vertical-dropdown-3"
>
<Dropdown.Item eventKey="1">Dropdown link</Dropdown.Item>
<Dropdown.Item eventKey="2">Dropdown link</Dropdown.Item>
</DropdownButton>
</ButtonGroup>
</div>
<ButtonGroupApi />
</div>
|
mjwwit/solid-bootstrap
|
www/src/docs/ButtonGroupDocs.tsx
|
TypeScript
|
ArrowFunction
|
() => {
let component: RecentActivityComponent;
let fixture: ComponentFixture<RecentActivityComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [RecentActivityComponent],
imports: [StoreModule.forRoot(reducers)],
schemas: [NO_ERRORS_SCHEMA],
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(RecentActivityComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
}
|
tenoritaiga/unfetter-ui
|
src/app/threat-beta/global-feed/recent-activity/recent-activity.component.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
TestBed.configureTestingModule({
declarations: [RecentActivityComponent],
imports: [StoreModule.forRoot(reducers)],
schemas: [NO_ERRORS_SCHEMA],
})
.compileComponents();
}
|
tenoritaiga/unfetter-ui
|
src/app/threat-beta/global-feed/recent-activity/recent-activity.component.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
fixture = TestBed.createComponent(RecentActivityComponent);
component = fixture.componentInstance;
fixture.detectChanges();
}
|
tenoritaiga/unfetter-ui
|
src/app/threat-beta/global-feed/recent-activity/recent-activity.component.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
let component: LimitComponent;
let fixture: ComponentFixture<LimitComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LimitComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(LimitComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
}
|
SapphireDb/ng-sapphiredb
|
src/app/data/limit/limit.component.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
TestBed.configureTestingModule({
declarations: [ LimitComponent ]
})
.compileComponents();
}
|
SapphireDb/ng-sapphiredb
|
src/app/data/limit/limit.component.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
fixture = TestBed.createComponent(LimitComponent);
component = fixture.componentInstance;
fixture.detectChanges();
}
|
SapphireDb/ng-sapphiredb
|
src/app/data/limit/limit.component.spec.ts
|
TypeScript
|
EnumDeclaration
|
/**
* Enum to used for Meridians to determine the
* direction they should face and what type
* of meridian they are
*/
export enum Orientation {
HORIZONTAL,
VERTICAL,
}
|
95-martin-orion/Cirq
|
cirq-web/cirq_ts/src/bloch_sphere/components/enums.ts
|
TypeScript
|
ArrowFunction
|
async () => {
await server.start();
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
await server.shutdown();
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
let manager: KernelManager;
let kernel: Kernel.IModel;
beforeAll(async () => {
jest.setTimeout(20000);
kernel = await KernelAPI.startNew();
});
beforeEach(() => {
manager = new KernelManager({ standby: 'never' });
return manager.ready;
});
afterEach(() => {
manager.dispose();
});
afterAll(async () => {
const models = await KernelAPI.listRunning();
await Promise.all(models.map(m => KernelAPI.shutdownKernel(m.id)));
});
describe('KernelManager', () => {
describe('#constructor()', () => {
it('should take the options as an argument', async () => {
manager.dispose();
manager = new KernelManager({
serverSettings: makeSettings(),
standby: 'never'
});
expect(manager instanceof KernelManager).toBe(true);
await manager.ready;
});
});
describe('#serverSettings', () => {
it('should get the server settings', async () => {
manager.dispose();
const serverSettings = makeSettings();
const standby = 'never';
const token = serverSettings.token;
manager = new KernelManager({ serverSettings, standby });
await manager.ready;
expect(manager.serverSettings.token).toBe(token);
});
});
describe('#running()', () => {
it('should get the running sessions', async () => {
await manager.refreshRunning();
expect(toArray(manager.running()).length).toBeGreaterThan(0);
});
});
describe('#runningChanged', () => {
it('should be emitted in refreshRunning when the running kernels changed', async () => {
let called = false;
manager.runningChanged.connect((sender, args) => {
expect(sender).toBe(manager);
expect(toArray(args).length).toBeGreaterThan(0);
called = true;
});
await KernelAPI.startNew();
await manager.refreshRunning();
expect(called).toBe(true);
});
it('should be emitted when a kernel is shut down', async () => {
const kernel = await manager.startNew();
await kernel.info;
let called = false;
manager.runningChanged.connect(() => {
called = true;
});
await manager.shutdown(kernel.id);
await manager.refreshRunning();
expect(called).toBe(true);
});
});
describe('#isReady', () => {
it('should test whether the manager is ready', async () => {
manager.dispose();
manager = new KernelManager({ standby: 'never' });
expect(manager.isReady).toBe(false);
await manager.ready;
expect(manager.isReady).toBe(true);
});
});
describe('#ready', () => {
it('should resolve when the manager is ready', () => {
return manager.ready;
});
});
describe('#refreshRunning()', () => {
it('should update the running kernels', async () => {
await manager.refreshRunning();
expect(toArray(manager.running()).length).toBeGreaterThan(0);
});
it('should update the running kernels when one is shut down', async () => {
const old = toArray(manager.running()).length;
await KernelAPI.startNew();
await manager.refreshRunning();
expect(toArray(manager.running()).length).toBeGreaterThan(old);
});
});
describe('#startNew()', () => {
it('should start a new kernel', () => {
return manager.startNew();
});
it('should emit a runningChanged signal', async () => {
let called = false;
manager.runningChanged.connect(() => {
called = true;
});
const kernel = await manager.startNew();
await kernel.info;
expect(called).toBe(true);
});
});
describe('#findById()', () => {
it('should find an existing kernel by id', async () => {
const id = kernel.id;
const model = await manager.findById(id);
expect(model!.id).toBe(id);
});
});
describe('#connectTo()', () => {
it('should connect to an existing kernel', () => {
const id = kernel.id;
const newConnection = manager.connectTo({ model: kernel });
expect(newConnection.model.id).toBe(id);
});
});
describe('shutdown()', () => {
it('should shut down a kernel by id', async () => {
const kernel = await manager.startNew();
await kernel.info;
await manager.shutdown(kernel.id);
expect(kernel.isDisposed).toBe(true);
});
it('should emit a runningChanged signal', async () => {
const kernel = await manager.startNew();
const emission = testEmission(manager.runningChanged, {
test: () => {
expect(kernel.isDisposed).toBe(false);
}
});
await kernel.info;
await manager.shutdown(kernel.id);
await emission;
});
it('should dispose of all relevant kernel connections', async () => {
const kernel0 = await manager.startNew();
const kernel1 = manager.connectTo({ model: kernel0.model });
await kernel0.info;
await kernel1.info;
await manager.refreshRunning();
await kernel0.shutdown();
expect(kernel0.status).toBe('dead');
expect(kernel0.isDisposed).toBe(true);
// Wait for the round trip to the server to update the connections.
await sleep(100);
expect(kernel1.status).toBe('dead');
expect(kernel1.isDisposed).toBe(true);
});
});
});
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
jest.setTimeout(20000);
kernel = await KernelAPI.startNew();
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
manager = new KernelManager({ standby: 'never' });
return manager.ready;
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
manager.dispose();
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
const models = await KernelAPI.listRunning();
await Promise.all(models.map(m => KernelAPI.shutdownKernel(m.id)));
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
m => KernelAPI.shutdownKernel(m.id)
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
describe('#constructor()', () => {
it('should take the options as an argument', async () => {
manager.dispose();
manager = new KernelManager({
serverSettings: makeSettings(),
standby: 'never'
});
expect(manager instanceof KernelManager).toBe(true);
await manager.ready;
});
});
describe('#serverSettings', () => {
it('should get the server settings', async () => {
manager.dispose();
const serverSettings = makeSettings();
const standby = 'never';
const token = serverSettings.token;
manager = new KernelManager({ serverSettings, standby });
await manager.ready;
expect(manager.serverSettings.token).toBe(token);
});
});
describe('#running()', () => {
it('should get the running sessions', async () => {
await manager.refreshRunning();
expect(toArray(manager.running()).length).toBeGreaterThan(0);
});
});
describe('#runningChanged', () => {
it('should be emitted in refreshRunning when the running kernels changed', async () => {
let called = false;
manager.runningChanged.connect((sender, args) => {
expect(sender).toBe(manager);
expect(toArray(args).length).toBeGreaterThan(0);
called = true;
});
await KernelAPI.startNew();
await manager.refreshRunning();
expect(called).toBe(true);
});
it('should be emitted when a kernel is shut down', async () => {
const kernel = await manager.startNew();
await kernel.info;
let called = false;
manager.runningChanged.connect(() => {
called = true;
});
await manager.shutdown(kernel.id);
await manager.refreshRunning();
expect(called).toBe(true);
});
});
describe('#isReady', () => {
it('should test whether the manager is ready', async () => {
manager.dispose();
manager = new KernelManager({ standby: 'never' });
expect(manager.isReady).toBe(false);
await manager.ready;
expect(manager.isReady).toBe(true);
});
});
describe('#ready', () => {
it('should resolve when the manager is ready', () => {
return manager.ready;
});
});
describe('#refreshRunning()', () => {
it('should update the running kernels', async () => {
await manager.refreshRunning();
expect(toArray(manager.running()).length).toBeGreaterThan(0);
});
it('should update the running kernels when one is shut down', async () => {
const old = toArray(manager.running()).length;
await KernelAPI.startNew();
await manager.refreshRunning();
expect(toArray(manager.running()).length).toBeGreaterThan(old);
});
});
describe('#startNew()', () => {
it('should start a new kernel', () => {
return manager.startNew();
});
it('should emit a runningChanged signal', async () => {
let called = false;
manager.runningChanged.connect(() => {
called = true;
});
const kernel = await manager.startNew();
await kernel.info;
expect(called).toBe(true);
});
});
describe('#findById()', () => {
it('should find an existing kernel by id', async () => {
const id = kernel.id;
const model = await manager.findById(id);
expect(model!.id).toBe(id);
});
});
describe('#connectTo()', () => {
it('should connect to an existing kernel', () => {
const id = kernel.id;
const newConnection = manager.connectTo({ model: kernel });
expect(newConnection.model.id).toBe(id);
});
});
describe('shutdown()', () => {
it('should shut down a kernel by id', async () => {
const kernel = await manager.startNew();
await kernel.info;
await manager.shutdown(kernel.id);
expect(kernel.isDisposed).toBe(true);
});
it('should emit a runningChanged signal', async () => {
const kernel = await manager.startNew();
const emission = testEmission(manager.runningChanged, {
test: () => {
expect(kernel.isDisposed).toBe(false);
}
});
await kernel.info;
await manager.shutdown(kernel.id);
await emission;
});
it('should dispose of all relevant kernel connections', async () => {
const kernel0 = await manager.startNew();
const kernel1 = manager.connectTo({ model: kernel0.model });
await kernel0.info;
await kernel1.info;
await manager.refreshRunning();
await kernel0.shutdown();
expect(kernel0.status).toBe('dead');
expect(kernel0.isDisposed).toBe(true);
// Wait for the round trip to the server to update the connections.
await sleep(100);
expect(kernel1.status).toBe('dead');
expect(kernel1.isDisposed).toBe(true);
});
});
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
it('should take the options as an argument', async () => {
manager.dispose();
manager = new KernelManager({
serverSettings: makeSettings(),
standby: 'never'
});
expect(manager instanceof KernelManager).toBe(true);
await manager.ready;
});
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
manager.dispose();
manager = new KernelManager({
serverSettings: makeSettings(),
standby: 'never'
});
expect(manager instanceof KernelManager).toBe(true);
await manager.ready;
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
it('should get the server settings', async () => {
manager.dispose();
const serverSettings = makeSettings();
const standby = 'never';
const token = serverSettings.token;
manager = new KernelManager({ serverSettings, standby });
await manager.ready;
expect(manager.serverSettings.token).toBe(token);
});
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
manager.dispose();
const serverSettings = makeSettings();
const standby = 'never';
const token = serverSettings.token;
manager = new KernelManager({ serverSettings, standby });
await manager.ready;
expect(manager.serverSettings.token).toBe(token);
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
it('should get the running sessions', async () => {
await manager.refreshRunning();
expect(toArray(manager.running()).length).toBeGreaterThan(0);
});
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
await manager.refreshRunning();
expect(toArray(manager.running()).length).toBeGreaterThan(0);
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
it('should be emitted in refreshRunning when the running kernels changed', async () => {
let called = false;
manager.runningChanged.connect((sender, args) => {
expect(sender).toBe(manager);
expect(toArray(args).length).toBeGreaterThan(0);
called = true;
});
await KernelAPI.startNew();
await manager.refreshRunning();
expect(called).toBe(true);
});
it('should be emitted when a kernel is shut down', async () => {
const kernel = await manager.startNew();
await kernel.info;
let called = false;
manager.runningChanged.connect(() => {
called = true;
});
await manager.shutdown(kernel.id);
await manager.refreshRunning();
expect(called).toBe(true);
});
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
let called = false;
manager.runningChanged.connect((sender, args) => {
expect(sender).toBe(manager);
expect(toArray(args).length).toBeGreaterThan(0);
called = true;
});
await KernelAPI.startNew();
await manager.refreshRunning();
expect(called).toBe(true);
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
(sender, args) => {
expect(sender).toBe(manager);
expect(toArray(args).length).toBeGreaterThan(0);
called = true;
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
const kernel = await manager.startNew();
await kernel.info;
let called = false;
manager.runningChanged.connect(() => {
called = true;
});
await manager.shutdown(kernel.id);
await manager.refreshRunning();
expect(called).toBe(true);
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
called = true;
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
it('should test whether the manager is ready', async () => {
manager.dispose();
manager = new KernelManager({ standby: 'never' });
expect(manager.isReady).toBe(false);
await manager.ready;
expect(manager.isReady).toBe(true);
});
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
manager.dispose();
manager = new KernelManager({ standby: 'never' });
expect(manager.isReady).toBe(false);
await manager.ready;
expect(manager.isReady).toBe(true);
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
it('should resolve when the manager is ready', () => {
return manager.ready;
});
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
return manager.ready;
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
it('should update the running kernels', async () => {
await manager.refreshRunning();
expect(toArray(manager.running()).length).toBeGreaterThan(0);
});
it('should update the running kernels when one is shut down', async () => {
const old = toArray(manager.running()).length;
await KernelAPI.startNew();
await manager.refreshRunning();
expect(toArray(manager.running()).length).toBeGreaterThan(old);
});
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
const old = toArray(manager.running()).length;
await KernelAPI.startNew();
await manager.refreshRunning();
expect(toArray(manager.running()).length).toBeGreaterThan(old);
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
it('should start a new kernel', () => {
return manager.startNew();
});
it('should emit a runningChanged signal', async () => {
let called = false;
manager.runningChanged.connect(() => {
called = true;
});
const kernel = await manager.startNew();
await kernel.info;
expect(called).toBe(true);
});
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
return manager.startNew();
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
let called = false;
manager.runningChanged.connect(() => {
called = true;
});
const kernel = await manager.startNew();
await kernel.info;
expect(called).toBe(true);
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
it('should find an existing kernel by id', async () => {
const id = kernel.id;
const model = await manager.findById(id);
expect(model!.id).toBe(id);
});
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
const id = kernel.id;
const model = await manager.findById(id);
expect(model!.id).toBe(id);
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
it('should connect to an existing kernel', () => {
const id = kernel.id;
const newConnection = manager.connectTo({ model: kernel });
expect(newConnection.model.id).toBe(id);
});
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
const id = kernel.id;
const newConnection = manager.connectTo({ model: kernel });
expect(newConnection.model.id).toBe(id);
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
it('should shut down a kernel by id', async () => {
const kernel = await manager.startNew();
await kernel.info;
await manager.shutdown(kernel.id);
expect(kernel.isDisposed).toBe(true);
});
it('should emit a runningChanged signal', async () => {
const kernel = await manager.startNew();
const emission = testEmission(manager.runningChanged, {
test: () => {
expect(kernel.isDisposed).toBe(false);
}
});
await kernel.info;
await manager.shutdown(kernel.id);
await emission;
});
it('should dispose of all relevant kernel connections', async () => {
const kernel0 = await manager.startNew();
const kernel1 = manager.connectTo({ model: kernel0.model });
await kernel0.info;
await kernel1.info;
await manager.refreshRunning();
await kernel0.shutdown();
expect(kernel0.status).toBe('dead');
expect(kernel0.isDisposed).toBe(true);
// Wait for the round trip to the server to update the connections.
await sleep(100);
expect(kernel1.status).toBe('dead');
expect(kernel1.isDisposed).toBe(true);
});
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
const kernel = await manager.startNew();
await kernel.info;
await manager.shutdown(kernel.id);
expect(kernel.isDisposed).toBe(true);
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
const kernel = await manager.startNew();
const emission = testEmission(manager.runningChanged, {
test: () => {
expect(kernel.isDisposed).toBe(false);
}
});
await kernel.info;
await manager.shutdown(kernel.id);
await emission;
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
() => {
expect(kernel.isDisposed).toBe(false);
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
async () => {
const kernel0 = await manager.startNew();
const kernel1 = manager.connectTo({ model: kernel0.model });
await kernel0.info;
await kernel1.info;
await manager.refreshRunning();
await kernel0.shutdown();
expect(kernel0.status).toBe('dead');
expect(kernel0.isDisposed).toBe(true);
// Wait for the round trip to the server to update the connections.
await sleep(100);
expect(kernel1.status).toBe('dead');
expect(kernel1.isDisposed).toBe(true);
}
|
Ashish-15s/jupyterlab
|
packages/services/test/kernel/manager.spec.ts
|
TypeScript
|
ArrowFunction
|
(done: any) => {
rollup.rollup(config)
.then((bundle: any) => {
const result = bundle.generate({
format: 'iife'
});
const path = join(Config.TMP_DIR, 'bundle.js');
writeFile(path, result.code, (error: any) => {
if (error) {
console.error(error);
process.exit(0);
}
done();
});
})
.catch((error: any) => {
console.error(error);
process.exit(0);
});
}
|
98abhinav/angular2-seed
|
tools/tasks/seed/build.bundles.app.rollup.aot.ts
|
TypeScript
|
ArrowFunction
|
(bundle: any) => {
const result = bundle.generate({
format: 'iife'
});
const path = join(Config.TMP_DIR, 'bundle.js');
writeFile(path, result.code, (error: any) => {
if (error) {
console.error(error);
process.exit(0);
}
done();
});
}
|
98abhinav/angular2-seed
|
tools/tasks/seed/build.bundles.app.rollup.aot.ts
|
TypeScript
|
ArrowFunction
|
(error: any) => {
if (error) {
console.error(error);
process.exit(0);
}
done();
}
|
98abhinav/angular2-seed
|
tools/tasks/seed/build.bundles.app.rollup.aot.ts
|
TypeScript
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.