Prechádzať zdrojové kódy

Merge branch 'master' into debugger-ui

Borys Palka 5 rokov pred
rodič
commit
9e0f105855

+ 43 - 0
azure-pipelines.yml

@@ -0,0 +1,43 @@
+pool:
+  vmImage: 'ubuntu-16.04'
+
+strategy:
+  matrix:
+    Tests:
+      python.version: '3.7'
+      testResultsFiles: 'tests/**/junit.xml'
+
+steps:
+- bash: echo "##vso[task.prependpath]$CONDA/bin"
+  displayName: Add conda to PATH
+
+- bash: conda create --yes --quiet --name jupyterlab-debugger
+  displayName: Create a new conda environment
+
+- bash: |
+    source activate jupyterlab-debugger
+    conda install --yes --quiet -c conda-forge nodejs xeus-python ptvsd python=$PYTHON_VERSION
+    python -m pip install -U --pre jupyterlab
+  displayName: Install dependencies
+
+- bash: |
+    source activate jupyterlab-debugger
+    jlpm
+    jlpm run build
+  displayName: Build jupyterlab-debugger
+
+- bash: |
+    source activate jupyterlab-debugger
+    export JUPYTER_PATH=${CONDA_PREFIX}/share/jupyter
+    export XEUS_LOG=1
+    jlpm run test
+  displayName: Run the tests
+
+- task: PublishTestResults@2
+  displayName: 'Publish test results'
+  condition: variables['testResultsFiles']
+  inputs:
+    testResultsFiles: '$(testResultsFiles)'
+    testRunTitle: '$(group)'
+    mergeTestResults: true
+

+ 1 - 0
package.json

@@ -63,6 +63,7 @@
     "chai": "^4.2.0",
     "husky": "^3.0.2",
     "jest": "^24.8.0",
+    "jest-junit": "^6.3.0",
     "lint-staged": "^9.2.1",
     "prettier": "^1.18.2",
     "rimraf": "~2.6.2",

+ 0 - 45
src/breakpoints/breakpoints.ts

@@ -1,45 +0,0 @@
-// Copyright (c) Jupyter Development Team.
-// Distributed under the terms of the Modified BSD License.
-
-import { Toolbar, ToolbarButton } from '@jupyterlab/apputils';
-
-import { Widget, Panel } from '@phosphor/widgets';
-
-export class BreakPoints extends Panel {
-  readonly body: Panel;
-
-  readonly header: Panel;
-
-  readonly label: Widget;
-
-  readonly toolbar: Toolbar;
-
-  constructor() {
-    super();
-
-    this.header = new Panel();
-    this.header.addClass('jp-DebuggerSidebar-item-header');
-    this.addWidget(this.header);
-
-    this.label = new Widget();
-    this.label.node.textContent = 'BreakPoints';
-    this.label.addClass('jp-DebuggerSidebar-item-header-label');
-    this.header.addWidget(this.label);
-
-    const toolbar = new Toolbar();
-    toolbar.addItem(
-      'deactivate',
-      new ToolbarButton({
-        iconClassName: 'jp-DebuggerDeactivateIcon',
-        onClick: () => {
-          console.log('`deactivate` was clicked');
-        },
-        tooltip: 'Deactivate Breakpoints'
-      })
-    );
-    this.toolbar = toolbar;
-    this.header.addWidget(this.toolbar);
-  }
-}
-
-export namespace BreakPoints {}

+ 61 - 1
src/breakpoints/index.ts

@@ -1,4 +1,64 @@
 // Copyright (c) Jupyter Development Team.
 // Distributed under the terms of the Modified BSD License.
 
-export * from './breakpoints';
+import { Toolbar, ToolbarButton } from '@jupyterlab/apputils';
+
+import { Widget, Panel, PanelLayout } from '@phosphor/widgets';
+
+export class Breakpoints extends Panel {
+  constructor(options: Breakpoints.IOptions = {}) {
+    super();
+
+    this.model = {};
+    this.addClass('jp-DebuggerBreakpoints');
+    this.title.label = 'Breakpoints';
+
+    const header = new BreakpointsHeader(this.title.label);
+
+    this.addWidget(header);
+    this.addWidget(this.body);
+
+    header.toolbar.addItem(
+      'deactivate',
+      new ToolbarButton({
+        iconClassName: 'jp-DebuggerDeactivateIcon',
+        onClick: () => {
+          console.log('`deactivate` was clicked');
+        },
+        tooltip: 'Deactivate Breakpoints'
+      })
+    );
+  }
+
+  readonly body = new Panel();
+
+  readonly model: Breakpoints.IModel;
+}
+
+class BreakpointsHeader extends Widget {
+  constructor(title: string) {
+    super({ node: document.createElement('header') });
+
+    const layout = new PanelLayout();
+    const span = new Widget({ node: document.createElement('span') });
+
+    this.layout = layout;
+    span.node.textContent = title;
+    layout.addWidget(span);
+    layout.addWidget(this.toolbar);
+  }
+
+  readonly toolbar = new Toolbar();
+}
+
+export namespace Breakpoints {
+  /**
+   * The breakpoints UI model.
+   */
+  export interface IModel {}
+
+  /**
+   * Instantiation options for `Breakpoints`;
+   */
+  export interface IOptions extends Panel.IOptions {}
+}

+ 4 - 4
src/sidebar.ts

@@ -3,7 +3,7 @@
 
 import { SplitPanel } from '@phosphor/widgets';
 
-import { BreakPoints } from './breakpoints';
+import { Breakpoints } from './breakpoints';
 
 import { Debugger } from './debugger';
 
@@ -20,18 +20,18 @@ export class DebuggerSidebar extends SplitPanel {
 
     this.variables = new Variables();
     this.callstack = new Callstack();
-    this.breakPoints = new BreakPoints();
+    this.breakpoints = new Breakpoints();
 
     this.addWidget(this.variables);
     this.addWidget(this.callstack);
-    this.addWidget(this.breakPoints);
+    this.addWidget(this.breakpoints);
   }
 
   readonly variables: Variables;
 
   readonly callstack: Callstack;
 
-  readonly breakPoints: BreakPoints;
+  readonly breakpoints: Breakpoints;
 
   get model(): Debugger.Model | null {
     return this._model;

+ 4 - 0
style/breakpoints.css

@@ -0,0 +1,4 @@
+/*-----------------------------------------------------------------------------
+| Copyright (c) Jupyter Development Team.
+| Distributed under the terms of the Modified BSD License.
+|----------------------------------------------------------------------------*/

+ 4 - 0
style/callstack.css

@@ -0,0 +1,4 @@
+/*-----------------------------------------------------------------------------
+| Copyright (c) Jupyter Development Team.
+| Distributed under the terms of the Modified BSD License.
+|----------------------------------------------------------------------------*/

+ 3 - 1
style/index.css

@@ -2,12 +2,14 @@
 | Copyright (c) Jupyter Development Team.
 | Distributed under the terms of the Modified BSD License.
 |----------------------------------------------------------------------------*/
-@import './sidebar.css';
 @import './toolbar.css';
 @import './variables.css';
 @import './callstack.css';
 @import './breakpoints.css';
 
+@import './icons.css';
+@import './sidebar.css';
+
 .jp-Debugger {
   background: var(--jp-layout-color1);
   top: 0;

+ 10 - 0
style/sidebar.css

@@ -1,3 +1,8 @@
+/*-----------------------------------------------------------------------------
+| Copyright (c) Jupyter Development Team.
+| Distributed under the terms of the Modified BSD License.
+|----------------------------------------------------------------------------*/
+
 .jp-DebuggerSidebar {
   display: flex;
   flex-direction: column;
@@ -29,3 +34,8 @@
   padding-left: 8px;
   padding-right: 4px;
 }
+
+.jp-DebuggerSidebar .jp-Toolbar {
+  background: var(--jp-layout-color2);
+  box-shadow: none;
+}

+ 0 - 11
style/toolbar.css

@@ -1,11 +0,0 @@
-/*-----------------------------------------------------------------------------
-| Copyright (c) Jupyter Development Team.
-| Distributed under the terms of the Modified BSD License.
-|----------------------------------------------------------------------------*/
-
-@import './icons.css';
-
-.jp-DebuggerSidebar .jp-Toolbar {
-  background: var(--jp-layout-color2);
-  box-shadow: none;
-}

+ 5 - 0
style/variables.css

@@ -1,3 +1,8 @@
+/*-----------------------------------------------------------------------------
+| Copyright (c) Jupyter Development Team.
+| Distributed under the terms of the Modified BSD License.
+|----------------------------------------------------------------------------*/
+
 .jp-DebuggerVariables-body {
   border-bottom: solid var(--jp-border-width) var(--jp-border-color2);
   min-height: 24px;

+ 1 - 0
tests/jest.config.js

@@ -17,6 +17,7 @@ let local = {
 
 [
   'moduleNameMapper',
+  'reporters',
   'setupFilesAfterEnv',
   'setupFiles',
   'moduleFileExtensions'