diff --git a/build/ci/postInstall.js b/build/ci/postInstall.js index 42f85b47fc46..3198674c4668 100644 --- a/build/ci/postInstall.js +++ b/build/ci/postInstall.js @@ -14,7 +14,7 @@ var constants_1 = require("../constants"); * The solution is to modify the type definition file after `npm install`. */ function fixJupyterLabDTSFiles() { - var relativePath = path.join('node_modules', '@jupyterlab', 'coreutils', 'lib', 'settingregistry.d.ts'); + var relativePath = path.join('node_modules', '@jupyterlab', 'services', 'node_modules', '@jupyterlab', 'coreutils', 'lib', 'settingregistry.d.ts'); var filePath = path.join(constants_1.ExtensionRootDir, relativePath); if (!fs.existsSync(filePath)) { throw new Error("Type Definition file from JupyterLab not found '" + filePath + "' (pvsc post install script)"); diff --git a/package-lock.json b/package-lock.json index 25e961603517..39679948ba9d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1197,202 +1197,22 @@ "integrity": "sha512-EzRFg92bRSD1W/zeuNkeGwph0nkWf+pP2l/lYW4/5hav7RjKKBN5kV1Ix7Tvi0CMu3pC4Wi/U7rNisiJMR3ORg==", "dev": true }, - "@jupyterlab/apputils": { - "version": "0.19.1", - "resolved": "https://registry.npmjs.org/@jupyterlab/apputils/-/apputils-0.19.1.tgz", - "integrity": "sha512-//vajDyVyKwXU7qycRBJC37dljjWeya+YpJV3z5sSXgVBefEBZ0kcrJ92ugDSht4I4SRv6x+kw6K9mBXKaYu9Q==", - "requires": { - "@jupyterlab/coreutils": "^2.2.1", - "@jupyterlab/services": "^3.2.1", - "@phosphor/algorithm": "^1.1.2", - "@phosphor/commands": "^1.6.1", - "@phosphor/coreutils": "^1.3.0", - "@phosphor/disposable": "^1.1.2", - "@phosphor/domutils": "^1.1.2", - "@phosphor/messaging": "^1.2.2", - "@phosphor/properties": "^1.1.2", - "@phosphor/signaling": "^1.2.2", - "@phosphor/virtualdom": "^1.1.2", - "@phosphor/widgets": "^1.6.0", - "@types/react": "~16.4.13", - "react": "~16.4.2", - "react-dom": "~16.4.2", - "sanitize-html": "~1.18.2" - }, - "dependencies": { - "@types/react": { - "version": "16.4.18", - "resolved": "https://registry.npmjs.org/@types/react/-/react-16.4.18.tgz", - "integrity": "sha512-eFzJKEg6pdeaukVLVZ8Xb79CTl/ysX+ExmOfAAqcFlCCK5TgFDD9kWR0S18sglQ3EmM8U+80enjUqbfnUyqpdA==", - "requires": { - "@types/prop-types": "*", - "csstype": "^2.2.0" - } - }, - "react": { - "version": "16.4.2", - "resolved": "https://registry.npmjs.org/react/-/react-16.4.2.tgz", - "integrity": "sha512-dMv7YrbxO4y2aqnvA7f/ik9ibeLSHQJTI6TrYAenPSaQ6OXfb+Oti+oJiy8WBxgRzlKatYqtCjphTgDSCEiWFg==", - "requires": { - "fbjs": "^0.8.16", - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1", - "prop-types": "^15.6.0" - } - }, - "react-dom": { - "version": "16.4.2", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.4.2.tgz", - "integrity": "sha512-Usl73nQqzvmJN+89r97zmeUpQDKDlh58eX6Hbs/ERdDHzeBzWy+ENk7fsGQ+5KxArV1iOFPT46/VneklK9zoWw==", - "requires": { - "fbjs": "^0.8.16", - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1", - "prop-types": "^15.6.0" - } - } - } - }, - "@jupyterlab/attachments": { - "version": "0.19.1", - "resolved": "https://registry.npmjs.org/@jupyterlab/attachments/-/attachments-0.19.1.tgz", - "integrity": "sha512-JujH1ExOao6ytb0J305iqOtj+GxISq/9zgt9kugwUCYZpvGdHau7WAYQs5YDPIQSZjSdYzjBREssFoirOOSVmA==", - "requires": { - "@jupyterlab/coreutils": "^2.2.1", - "@jupyterlab/observables": "^2.1.1", - "@jupyterlab/rendermime": "^0.19.1", - "@jupyterlab/rendermime-interfaces": "^1.2.1", - "@phosphor/disposable": "^1.1.2", - "@phosphor/signaling": "^1.2.2" - } - }, - "@jupyterlab/cells": { - "version": "0.19.1", - "resolved": "https://registry.npmjs.org/@jupyterlab/cells/-/cells-0.19.1.tgz", - "integrity": "sha512-7vVriCTVC6sXPDvh1/L2WzdAga2Xkg0cFgEcXuIJLwt25ppmqs9DYgMhhUBr0G734mZwmQDXCJ/BqOUw1qgHKg==", - "requires": { - "@jupyterlab/apputils": "^0.19.1", - "@jupyterlab/attachments": "^0.19.1", - "@jupyterlab/codeeditor": "^0.19.1", - "@jupyterlab/codemirror": "^0.19.1", - "@jupyterlab/coreutils": "^2.2.1", - "@jupyterlab/observables": "^2.1.1", - "@jupyterlab/outputarea": "^0.19.1", - "@jupyterlab/rendermime": "^0.19.1", - "@jupyterlab/services": "^3.2.1", - "@phosphor/coreutils": "^1.3.0", - "@phosphor/messaging": "^1.2.2", - "@phosphor/signaling": "^1.2.2", - "@phosphor/widgets": "^1.6.0", - "react": "~16.4.2" - }, - "dependencies": { - "react": { - "version": "16.4.2", - "resolved": "https://registry.npmjs.org/react/-/react-16.4.2.tgz", - "integrity": "sha512-dMv7YrbxO4y2aqnvA7f/ik9ibeLSHQJTI6TrYAenPSaQ6OXfb+Oti+oJiy8WBxgRzlKatYqtCjphTgDSCEiWFg==", - "requires": { - "fbjs": "^0.8.16", - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1", - "prop-types": "^15.6.0" - } - } - } - }, - "@jupyterlab/codeeditor": { - "version": "0.19.1", - "resolved": "https://registry.npmjs.org/@jupyterlab/codeeditor/-/codeeditor-0.19.1.tgz", - "integrity": "sha512-mCL4YiCCX5JOAIs21mleSmlkejAw6FVLwmvKGxBCwoNj+cSYUKzGBYuA2xvxAZi/5HaiQU8R+ITbAwk2QoMc6w==", - "requires": { - "@jupyterlab/coreutils": "^2.2.1", - "@jupyterlab/observables": "^2.1.1", - "@phosphor/coreutils": "^1.3.0", - "@phosphor/disposable": "^1.1.2", - "@phosphor/messaging": "^1.2.2", - "@phosphor/signaling": "^1.2.2", - "@phosphor/widgets": "^1.6.0", - "react": "~16.4.2", - "react-dom": "~16.4.2" - }, - "dependencies": { - "react": { - "version": "16.4.2", - "resolved": "https://registry.npmjs.org/react/-/react-16.4.2.tgz", - "integrity": "sha512-dMv7YrbxO4y2aqnvA7f/ik9ibeLSHQJTI6TrYAenPSaQ6OXfb+Oti+oJiy8WBxgRzlKatYqtCjphTgDSCEiWFg==", - "requires": { - "fbjs": "^0.8.16", - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1", - "prop-types": "^15.6.0" - } - }, - "react-dom": { - "version": "16.4.2", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.4.2.tgz", - "integrity": "sha512-Usl73nQqzvmJN+89r97zmeUpQDKDlh58eX6Hbs/ERdDHzeBzWy+ENk7fsGQ+5KxArV1iOFPT46/VneklK9zoWw==", - "requires": { - "fbjs": "^0.8.16", - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1", - "prop-types": "^15.6.0" - } - } - } - }, - "@jupyterlab/codemirror": { - "version": "0.19.1", - "resolved": "https://registry.npmjs.org/@jupyterlab/codemirror/-/codemirror-0.19.1.tgz", - "integrity": "sha512-JbZRm9vW1lN4Y4VghBQEys7vWoaZM54E0OdTlWjJq1kF8WhKWzp8Do/tnQ5fKVUGw40BMB0xBnfAaHHCSs5vHw==", - "requires": { - "@jupyterlab/apputils": "^0.19.1", - "@jupyterlab/codeeditor": "^0.19.1", - "@jupyterlab/coreutils": "^2.2.1", - "@jupyterlab/observables": "^2.1.1", - "@phosphor/algorithm": "^1.1.2", - "@phosphor/coreutils": "^1.3.0", - "@phosphor/disposable": "^1.1.2", - "@phosphor/signaling": "^1.2.2", - "codemirror": "~5.39.0" - } - }, "@jupyterlab/coreutils": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@jupyterlab/coreutils/-/coreutils-2.2.1.tgz", - "integrity": "sha512-XkGMBXqEAnENC4fK/L3uEqqxyNUtf4TI/1XNDln7d5VOPHQJSBTbYlBAZ0AQotn2qbs4WqmV6icxje2ITVedqQ==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@jupyterlab/coreutils/-/coreutils-3.1.0.tgz", + "integrity": "sha512-ZqgzDUyanyvc86gtCrIbc1M6iniKHYmWNWHvWOcnq3KIP3wk3grchsTYPTfQDxcUS6F04baPGp/KohEU2ml40Q==", "requires": { - "@phosphor/algorithm": "^1.1.2", - "@phosphor/coreutils": "^1.3.0", - "@phosphor/disposable": "^1.1.2", - "@phosphor/signaling": "^1.2.2", - "ajv": "~5.1.6", - "comment-json": "^1.1.3", + "@phosphor/commands": "^1.6.3", + "@phosphor/coreutils": "^1.3.1", + "@phosphor/disposable": "^1.2.0", + "@phosphor/properties": "^1.1.3", + "@phosphor/signaling": "^1.2.3", + "ajv": "^6.5.5", + "json5": "^2.1.0", "minimist": "~1.2.0", - "moment": "~2.21.0", + "moment": "^2.24.0", "path-posix": "~1.0.0", "url-parse": "~1.4.3" - }, - "dependencies": { - "ajv": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.1.6.tgz", - "integrity": "sha1-Sy8aGd7Ok9V6whYDfj6XkcfdFWQ=", - "requires": { - "co": "^4.6.0", - "json-schema-traverse": "^0.3.0", - "json-stable-stringify": "^1.0.1" - } - }, - "json-schema-traverse": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", - "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" - }, - "moment": { - "version": "2.21.0", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.21.0.tgz", - "integrity": "sha512-TCZ36BjURTeFTM/CwRcViQlfkMvL1/vFISuNLO5GkcVm1+QHfbSiNqZuWeMFjj1/3+uAjXswgRk30j1kkLYJBQ==" - } } }, "@jupyterlab/observables": { @@ -1407,54 +1227,6 @@ "@phosphor/signaling": "^1.2.3" } }, - "@jupyterlab/outputarea": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/@jupyterlab/outputarea/-/outputarea-0.19.2.tgz", - "integrity": "sha512-uYL/RfwY//83UWsmENg4b4s6wXr9OWE4zbKtMY4zoJoT5tsnWyIiSnvy26m/Pslo1Y1wlLjVPqCoJFcEARKb+A==", - "requires": { - "@jupyterlab/apputils": "^0.19.1", - "@jupyterlab/coreutils": "^2.2.1", - "@jupyterlab/observables": "^2.1.1", - "@jupyterlab/rendermime": "^0.19.1", - "@jupyterlab/rendermime-interfaces": "^1.2.1", - "@jupyterlab/services": "^3.2.1", - "@phosphor/algorithm": "^1.1.2", - "@phosphor/coreutils": "^1.3.0", - "@phosphor/disposable": "^1.1.2", - "@phosphor/messaging": "^1.2.2", - "@phosphor/signaling": "^1.2.2", - "@phosphor/widgets": "^1.6.0" - } - }, - "@jupyterlab/rendermime": { - "version": "0.19.1", - "resolved": "https://registry.npmjs.org/@jupyterlab/rendermime/-/rendermime-0.19.1.tgz", - "integrity": "sha512-MD+/lMwFa/b9QtJyFghTXFqkuRha74+vWTaPcfzREdHRiKYHYPHWOD/gb8cLIr4c7J3VaEVZWEpI8udYgyANvA==", - "requires": { - "@jupyterlab/apputils": "^0.19.1", - "@jupyterlab/codemirror": "^0.19.1", - "@jupyterlab/coreutils": "^2.2.1", - "@jupyterlab/observables": "^2.1.1", - "@jupyterlab/rendermime-interfaces": "^1.2.1", - "@jupyterlab/services": "^3.2.1", - "@phosphor/algorithm": "^1.1.2", - "@phosphor/coreutils": "^1.3.0", - "@phosphor/messaging": "^1.2.2", - "@phosphor/signaling": "^1.2.2", - "@phosphor/widgets": "^1.6.0", - "ansi_up": "^3.0.0", - "marked": "~0.4.0" - } - }, - "@jupyterlab/rendermime-interfaces": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@jupyterlab/rendermime-interfaces/-/rendermime-interfaces-1.4.0.tgz", - "integrity": "sha512-6GtbudtK7Yl37ldnQUQ6hTUDzjVgemiDXokEdsSTLPOPoPwKw3gaEBfxrOz/LBITfqIfbpuBzYU8lQ4rHq0TfQ==", - "requires": { - "@phosphor/coreutils": "^1.3.1", - "@phosphor/widgets": "^1.8.0" - } - }, "@jupyterlab/services": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/@jupyterlab/services/-/services-3.2.1.tgz", @@ -1517,15 +1289,9 @@ } }, "@msrvida/python-program-analysis": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/@msrvida/python-program-analysis/-/python-program-analysis-0.2.6.tgz", - "integrity": "sha512-DlclIdsuwMktplZlxhTCky0fLIAy925MCEWKqdU/6PLV6L+FiG7jZ7/V2qZohjmBdJEuJoifERWzkUrP+PaH0A==", - "requires": { - "@jupyterlab/cells": "^0.19.1", - "@jupyterlab/coreutils": "^2.2.1", - "@jupyterlab/rendermime": "^0.19.1", - "js-yaml": "^3.13.1" - } + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@msrvida/python-program-analysis/-/python-program-analysis-0.4.1.tgz", + "integrity": "sha512-8jCtPTTxXyvN3udvz71inScvFvQil7Wh61newdrq79CjuV0W634GCDGuyGpI5G+kgX9PbBZPQJTc1+BMNMB5sQ==" }, "@nteract/markdown": { "version": "3.0.1", @@ -1688,16 +1454,16 @@ } }, "@phosphor/commands": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/@phosphor/commands/-/commands-1.7.1.tgz", - "integrity": "sha512-KELPYLrNLVkMA5XntDogQkKXWbhLhpjxLBD75faywoe4GCyVsm//CA7Wn50+eVo0pI87z27Qbtzo0TR6NH4Jvw==", + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@phosphor/commands/-/commands-1.7.2.tgz", + "integrity": "sha512-iSyBIWMHsus323BVEARBhuVZNnVel8USo+FIPaAxGcq+icTSSe6+NtSxVQSmZblGN6Qm4iw6I6VtiSx0e6YDgQ==", "requires": { "@phosphor/algorithm": "^1.2.0", "@phosphor/coreutils": "^1.3.1", - "@phosphor/disposable": "^1.3.0", + "@phosphor/disposable": "^1.3.1", "@phosphor/domutils": "^1.1.4", "@phosphor/keyboard": "^1.1.3", - "@phosphor/signaling": "^1.3.0" + "@phosphor/signaling": "^1.3.1" }, "dependencies": { "@phosphor/algorithm": { @@ -1706,18 +1472,18 @@ "integrity": "sha512-C9+dnjXyU2QAkWCW6QVDGExk4hhwxzAKf5/FIuYlHAI9X5vFv99PYm0EREDxX1PbMuvfFBZhPNu0PvuSDQ7sFA==" }, "@phosphor/disposable": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@phosphor/disposable/-/disposable-1.3.0.tgz", - "integrity": "sha512-wHQov7HoS20mU6yuEz5ZMPhfxHdcxGovjPoid0QwccUEOm33UBkWlxaJGm9ONycezIX8je7ZuPOf/gf7JI6Dlg==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@phosphor/disposable/-/disposable-1.3.1.tgz", + "integrity": "sha512-0NGzoTXTOizWizK/brKKd5EjJhuuEH4903tLika7q6wl/u0tgneJlTh7R+MBVeih0iNxtuJAfBa3IEY6Qmj+Sw==", "requires": { "@phosphor/algorithm": "^1.2.0", - "@phosphor/signaling": "^1.3.0" + "@phosphor/signaling": "^1.3.1" } }, "@phosphor/signaling": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@phosphor/signaling/-/signaling-1.3.0.tgz", - "integrity": "sha512-ZbG2Mof4LGSkaEuDicqA2o2TKu3i5zanjr2GkevI/82aKBD7cI1NGLGT55HZwtE87/gOF4FIM3d3DeyrFDMjMQ==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@phosphor/signaling/-/signaling-1.3.1.tgz", + "integrity": "sha512-Eq3wVCPQAhUd9+gUGaYygMr+ov7dhSGblSBXiDzpZlSIfa8OVD4P3cCvYXr/acDTNmZ/gHTcSFO8/n3rDkeXzg==", "requires": { "@phosphor/algorithm": "^1.2.0" } @@ -1743,39 +1509,6 @@ "resolved": "https://registry.npmjs.org/@phosphor/domutils/-/domutils-1.1.4.tgz", "integrity": "sha512-ivwq5TWjQpKcHKXO8PrMl+/cKqbgxPClPiCKc1gwbMd+6hnW5VLwNG0WBzJTxCzXK43HxX18oH+tOZ3E04wc3w==" }, - "@phosphor/dragdrop": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@phosphor/dragdrop/-/dragdrop-1.4.0.tgz", - "integrity": "sha512-JqmDAKczviUe7NEkiDf/A6H2glgVmHAREip8dGBli4lvV+CQqPFyl4Xm7XCnR9qiEqNrP+0SfwPpywNa0me3nQ==", - "requires": { - "@phosphor/coreutils": "^1.3.1", - "@phosphor/disposable": "^1.3.0" - }, - "dependencies": { - "@phosphor/algorithm": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@phosphor/algorithm/-/algorithm-1.2.0.tgz", - "integrity": "sha512-C9+dnjXyU2QAkWCW6QVDGExk4hhwxzAKf5/FIuYlHAI9X5vFv99PYm0EREDxX1PbMuvfFBZhPNu0PvuSDQ7sFA==" - }, - "@phosphor/disposable": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@phosphor/disposable/-/disposable-1.3.0.tgz", - "integrity": "sha512-wHQov7HoS20mU6yuEz5ZMPhfxHdcxGovjPoid0QwccUEOm33UBkWlxaJGm9ONycezIX8je7ZuPOf/gf7JI6Dlg==", - "requires": { - "@phosphor/algorithm": "^1.2.0", - "@phosphor/signaling": "^1.3.0" - } - }, - "@phosphor/signaling": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@phosphor/signaling/-/signaling-1.3.0.tgz", - "integrity": "sha512-ZbG2Mof4LGSkaEuDicqA2o2TKu3i5zanjr2GkevI/82aKBD7cI1NGLGT55HZwtE87/gOF4FIM3d3DeyrFDMjMQ==", - "requires": { - "@phosphor/algorithm": "^1.2.0" - } - } - } - }, "@phosphor/keyboard": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/@phosphor/keyboard/-/keyboard-1.1.3.tgz", @@ -1803,80 +1536,6 @@ "@phosphor/algorithm": "^1.1.3" } }, - "@phosphor/virtualdom": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@phosphor/virtualdom/-/virtualdom-1.2.0.tgz", - "integrity": "sha512-L9mKNhK2XtVjzjuHLG2uYuepSz8uPyu6vhF4EgCP0rt0TiLYaZeHwuNu3XeFbul9DMOn49eBpye/tfQVd4Ks+w==", - "requires": { - "@phosphor/algorithm": "^1.2.0" - }, - "dependencies": { - "@phosphor/algorithm": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@phosphor/algorithm/-/algorithm-1.2.0.tgz", - "integrity": "sha512-C9+dnjXyU2QAkWCW6QVDGExk4hhwxzAKf5/FIuYlHAI9X5vFv99PYm0EREDxX1PbMuvfFBZhPNu0PvuSDQ7sFA==" - } - } - }, - "@phosphor/widgets": { - "version": "1.9.2", - "resolved": "https://registry.npmjs.org/@phosphor/widgets/-/widgets-1.9.2.tgz", - "integrity": "sha512-93BOdp3lGsEdkpa+bv+XhIKqRyNKStu71IeDtvqiRyRyMjDnMjwfQCjNDdYbsWYyWWKk4TH7buC0cIlmbIPAHQ==", - "requires": { - "@phosphor/algorithm": "^1.2.0", - "@phosphor/commands": "^1.7.1", - "@phosphor/coreutils": "^1.3.1", - "@phosphor/disposable": "^1.3.0", - "@phosphor/domutils": "^1.1.4", - "@phosphor/dragdrop": "^1.4.0", - "@phosphor/keyboard": "^1.1.3", - "@phosphor/messaging": "^1.3.0", - "@phosphor/properties": "^1.1.3", - "@phosphor/signaling": "^1.3.0", - "@phosphor/virtualdom": "^1.2.0" - }, - "dependencies": { - "@phosphor/algorithm": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@phosphor/algorithm/-/algorithm-1.2.0.tgz", - "integrity": "sha512-C9+dnjXyU2QAkWCW6QVDGExk4hhwxzAKf5/FIuYlHAI9X5vFv99PYm0EREDxX1PbMuvfFBZhPNu0PvuSDQ7sFA==" - }, - "@phosphor/collections": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@phosphor/collections/-/collections-1.2.0.tgz", - "integrity": "sha512-T9/0EjSuY6+ga2LIFRZ0xupciOR3Qnyy8Q95lhGTC0FXZUFwC8fl9e8On6IcwasCszS+1n8dtZUWSIynfgdpzw==", - "requires": { - "@phosphor/algorithm": "^1.2.0" - } - }, - "@phosphor/disposable": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@phosphor/disposable/-/disposable-1.3.0.tgz", - "integrity": "sha512-wHQov7HoS20mU6yuEz5ZMPhfxHdcxGovjPoid0QwccUEOm33UBkWlxaJGm9ONycezIX8je7ZuPOf/gf7JI6Dlg==", - "requires": { - "@phosphor/algorithm": "^1.2.0", - "@phosphor/signaling": "^1.3.0" - } - }, - "@phosphor/messaging": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@phosphor/messaging/-/messaging-1.3.0.tgz", - "integrity": "sha512-k0JE+BTMKlkM335S2AmmJxoYYNRwOdW5jKBqLgjJdGRvUQkM0+2i60ahM45+J23atGJDv9esKUUBINiKHFhLew==", - "requires": { - "@phosphor/algorithm": "^1.2.0", - "@phosphor/collections": "^1.2.0" - } - }, - "@phosphor/signaling": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@phosphor/signaling/-/signaling-1.3.0.tgz", - "integrity": "sha512-ZbG2Mof4LGSkaEuDicqA2o2TKu3i5zanjr2GkevI/82aKBD7cI1NGLGT55HZwtE87/gOF4FIM3d3DeyrFDMjMQ==", - "requires": { - "@phosphor/algorithm": "^1.2.0" - } - } - } - }, "@sindresorhus/is": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.7.0.tgz", @@ -2248,7 +1907,8 @@ "@types/prop-types": { "version": "15.7.1", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.1.tgz", - "integrity": "sha512-CFzn9idOEpHrgdw8JsoTkaDDyRWk1jrzIV8djzcgpq0y9tG4B4lFT+Nxh52DVpDXV+n4+NPNv7M1Dj5uMp6XFg==" + "integrity": "sha512-CFzn9idOEpHrgdw8JsoTkaDDyRWk1jrzIV8djzcgpq0y9tG4B4lFT+Nxh52DVpDXV+n4+NPNv7M1Dj5uMp6XFg==", + "dev": true }, "@types/react": { "version": "16.8.23", @@ -2866,11 +2526,6 @@ "integrity": "sha1-qCJQ3bABXponyoLoLqYDu/pF768=", "dev": true }, - "ansi_up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi_up/-/ansi_up-3.0.0.tgz", - "integrity": "sha1-J/Rdj0V9nO/1nk6gPI5vE8GjA+g=" - }, "anymatch": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", @@ -3285,7 +2940,8 @@ "array-uniq": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", - "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=" + "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", + "dev": true }, "array-unique": { "version": "0.3.2", @@ -3323,7 +2979,8 @@ "asap": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", - "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=" + "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=", + "dev": true }, "asn1": { "version": "0.2.4", @@ -5626,11 +5283,6 @@ "urlgrey": "^0.4.4" } }, - "codemirror": { - "version": "5.39.2", - "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-5.39.2.tgz", - "integrity": "sha512-mchBy0kQ1Wggi+e58SmoLgKO4nG7s/BqNg6/6TRbhsnXI/KRG+fKAvRQ1LLhZZ6ZtUoDQ0dl5aMhE+IkSRh60Q==" - }, "collapse-white-space": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-1.0.5.tgz", @@ -6057,7 +5709,8 @@ "core-js": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz", - "integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY=" + "integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY=", + "dev": true }, "core-js-compat": { "version": "3.1.4", @@ -6567,7 +6220,8 @@ "csstype": { "version": "2.6.6", "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.6.tgz", - "integrity": "sha512-RpFbQGUE74iyPgvr46U9t1xoQBM8T4BL8SxrN66Le2xYAPSaDJJKeztV3awugusb3g3G9iL8StmkBBXhcbbXhg==" + "integrity": "sha512-RpFbQGUE74iyPgvr46U9t1xoQBM8T4BL8SxrN66Le2xYAPSaDJJKeztV3awugusb3g3G9iL8StmkBBXhcbbXhg==", + "dev": true }, "cucumber-html-reporter": { "version": "4.0.5", @@ -7441,6 +7095,7 @@ "version": "0.1.1", "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.1.tgz", "integrity": "sha512-l0IU0pPzLWSHBcieZbpOKgkIn3ts3vAh7ZuFyXNwJxJXk/c4Gwj9xaTJwIDVQCXawWD0qb3IzMGH5rglQaO0XA==", + "dev": true, "requires": { "domelementtype": "^1.3.0", "entities": "^1.1.1" @@ -7466,7 +7121,8 @@ "domelementtype": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", - "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==" + "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==", + "dev": true }, "domexception": { "version": "1.0.1", @@ -7481,6 +7137,7 @@ "version": "2.4.2", "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.2.tgz", "integrity": "sha512-JiK04h0Ht5u/80fdLMCEmV4zkNh2BcoMFBmZ/91WtYZ8qVXSKjiw7fXMgFPnHcSZgOo3XdinHvmnDUeMf5R4wA==", + "dev": true, "requires": { "domelementtype": "1" } @@ -7489,6 +7146,7 @@ "version": "1.7.0", "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.7.0.tgz", "integrity": "sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==", + "dev": true, "requires": { "dom-serializer": "0", "domelementtype": "1" @@ -7783,7 +7441,8 @@ "entities": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", - "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==" + "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==", + "dev": true }, "env-paths": { "version": "1.0.0", @@ -8633,6 +8292,7 @@ "version": "0.8.17", "resolved": "https://registry.npmjs.org/fbjs/-/fbjs-0.8.17.tgz", "integrity": "sha1-xNWY6taUkRJlPWWIsBpc3Nn5D90=", + "dev": true, "requires": { "core-js": "^1.0.0", "isomorphic-fetch": "^2.1.1", @@ -10762,6 +10422,7 @@ "version": "3.10.1", "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", "integrity": "sha512-IgieNijUMbkDovyoKObU1DUhm1iwNYE/fuifEoEHfd1oZKZDaONBSkal7Y01shxsM49R4XaMdGez3WnF9UfiCQ==", + "dev": true, "requires": { "domelementtype": "^1.3.1", "domhandler": "^2.3.0", @@ -11588,6 +11249,7 @@ "version": "2.2.1", "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz", "integrity": "sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk=", + "dev": true, "requires": { "node-fetch": "^1.0.1", "whatwg-fetch": ">=0.10.0" @@ -11946,7 +11608,6 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.0.tgz", "integrity": "sha512-8Mh9h6xViijj36g7Dxi+Y4S6hNGV96vcJZr/SrlHh1LR/pEn/8j/+qIBbs44YKl69Lrfctp4QD+AdWLTMqEZAQ==", - "dev": true, "requires": { "minimist": "^1.2.0" } @@ -12313,11 +11974,6 @@ "integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY=", "dev": true }, - "lodash.clonedeep": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", - "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=" - }, "lodash.curry": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/lodash.curry/-/lodash.curry-4.1.1.tgz", @@ -12342,11 +11998,6 @@ "integrity": "sha1-yQRGkMIeBClL6qUXcS/e0fqI3pg=", "dev": true }, - "lodash.escaperegexp": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/lodash.escaperegexp/-/lodash.escaperegexp-4.1.2.tgz", - "integrity": "sha1-ZHYsSGGAglGKw99Mz11YhtriA0c=" - }, "lodash.flatten": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", @@ -12380,17 +12031,8 @@ "lodash.isplainobject": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", - "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=" - }, - "lodash.isstring": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", - "integrity": "sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=" - }, - "lodash.mergewith": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz", - "integrity": "sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ==" + "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=", + "dev": true }, "lodash.some": { "version": "4.6.0", @@ -12620,11 +12262,6 @@ "uc.micro": "^1.0.5" } }, - "marked": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/marked/-/marked-0.4.0.tgz", - "integrity": "sha512-tMsdNBgOsrUophCAFQl0XPe6Zqk/uy9gnue+jIIKhykO51hxyu6uNx7zBPy0+y/WKYVZZMspV9YeXLNdKk+iYw==" - }, "martinez-polygon-clipping": { "version": "0.1.5", "resolved": "https://registry.npmjs.org/martinez-polygon-clipping/-/martinez-polygon-clipping-0.1.5.tgz", @@ -13325,8 +12962,7 @@ "moment": { "version": "2.24.0", "resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz", - "integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==", - "dev": true + "integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==" }, "monaco-editor": { "version": "0.18.1", @@ -13933,7 +13569,8 @@ "number-is-nan": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true }, "numeral": { "version": "2.0.6", @@ -15063,16 +14700,6 @@ "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", "dev": true }, - "postcss": { - "version": "6.0.23", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.23.tgz", - "integrity": "sha512-soOk1h6J3VMTZtVeVpv15/Hpdl2cBLX3CAw4TAbkpTJiNPk9YP/zWcD1ND+xEtvyuuvKzbxliTOIyvkSeSJ6ag==", - "requires": { - "chalk": "^2.4.1", - "source-map": "^0.6.1", - "supports-color": "^5.4.0" - } - }, "postcss-modules-extract-imports": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-1.2.1.tgz", @@ -15307,6 +14934,7 @@ "version": "7.3.1", "resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz", "integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==", + "dev": true, "requires": { "asap": "~2.0.3" } @@ -16643,23 +16271,6 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, - "sanitize-html": { - "version": "1.18.5", - "resolved": "https://registry.npmjs.org/sanitize-html/-/sanitize-html-1.18.5.tgz", - "integrity": "sha512-z0MV+AqOnDZVSQQHr/vwimRykKVyPuGZnjWDzIiV1mdgQEG9HMx9qrEapcOQeUmSsPvHZ04BXTuXQkB/vvbU9A==", - "requires": { - "chalk": "^2.3.0", - "htmlparser2": "^3.9.0", - "lodash.clonedeep": "^4.5.0", - "lodash.escaperegexp": "^4.1.2", - "lodash.isplainobject": "^4.0.6", - "lodash.isstring": "^4.0.1", - "lodash.mergewith": "^4.6.0", - "postcss": "^6.0.14", - "srcset": "^1.0.0", - "xtend": "^4.0.0" - } - }, "sass-loader": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-7.1.0.tgz", @@ -16922,7 +16533,8 @@ "setimmediate": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", - "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=" + "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=", + "dev": true }, "setprototypeof": { "version": "1.1.1", @@ -17379,15 +16991,6 @@ "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" }, - "srcset": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/srcset/-/srcset-1.0.0.tgz", - "integrity": "sha1-pWad4StC87HV6D7QPHEEb8SPQe8=", - "requires": { - "array-uniq": "^1.0.2", - "number-is-nan": "^1.0.0" - } - }, "sshpk": { "version": "1.16.1", "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", @@ -18918,7 +18521,8 @@ "ua-parser-js": { "version": "0.7.20", "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.20.tgz", - "integrity": "sha512-8OaIKfzL5cpx8eCMAhhvTlft8GYF8b2eQr6JkCyVdrgjcytyOmPCXrqXFcUnhonRpLlh5yxEZVohm6mzaowUOw==" + "integrity": "sha512-8OaIKfzL5cpx8eCMAhhvTlft8GYF8b2eQr6JkCyVdrgjcytyOmPCXrqXFcUnhonRpLlh5yxEZVohm6mzaowUOw==", + "dev": true }, "uc.micro": { "version": "1.0.6", @@ -20082,7 +19686,8 @@ "whatwg-fetch": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz", - "integrity": "sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q==" + "integrity": "sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q==", + "dev": true }, "whatwg-mimetype": { "version": "2.3.0", diff --git a/package.json b/package.json index 6803d0f35d7d..5a60eed45889 100644 --- a/package.json +++ b/package.json @@ -1693,9 +1693,15 @@ "scope": "resource" }, "python.dataScience.enableGather": { + "type": "boolean", + "default": true, + "description": "Enable code gather for executed cells. For a gathered cell, that cell and only the code it depends on will be exported to a new notebook.", + "scope": "resource" + }, + "python.dataScience.gatherToScript": { "type": "boolean", "default": false, - "description": "Enable code gathering for single cells in the interactive window (experimental).", + "description": "Gather code to a python script rather than a notebook.", "scope": "resource" }, "python.dataScience.codeLenses": { @@ -2679,7 +2685,8 @@ "dependencies": { "@blueprintjs/select": "3.10.0", "@jupyterlab/services": "^3.2.1", - "@msrvida/python-program-analysis": "^0.2.6", + "@jupyterlab/coreutils": "^3.1.0", + "@msrvida/python-program-analysis": "^0.4.1", "ansi-regex": "^4.1.0", "arch": "^2.1.0", "azure-storage": "^2.10.3", diff --git a/package.nls.json b/package.nls.json index d30f4e203bc7..f674c8424efd 100644 --- a/package.nls.json +++ b/package.nls.json @@ -378,5 +378,7 @@ "DataScience.notebookNotFound" : "python -m jupyter notebook --version is not running", "DataScience.findJupyterCommandProgress" : "Active interpreter does not support {0}. Searching for the best available interpreter.", "DataScience.findJupyterCommandProgressCheckInterpreter": "Checking {0}.", - "DataScience.findJupyterCommandProgressSearchCurrentPath": "Searching current path." + "DataScience.findJupyterCommandProgressSearchCurrentPath": "Searching current path.", + "DataScience.gatheredScriptDescription": "# This file contains only the code required to produce the results of the gathered cell.\n", + "DataScience.gatheredNotebookDescriptionInMarkdown": "# Gathered Notebook\nGenerated from ```{0}```\n\nThis notebook contains only the code and cells required to produce the same results as the gathered cell.\n\nPlease note that the python analysis is quite conservative, so if it is unsure whether a line of code is necessary for execution, it will err on the side of including it." } diff --git a/src/client/common/types.ts b/src/client/common/types.ts index f7c391103f6d..46649d0dff99 100644 --- a/src/client/common/types.ts +++ b/src/client/common/types.ts @@ -324,6 +324,7 @@ export interface IDataScienceSettings { collapseCellInputCodeByDefault: boolean; maxOutputSize: number; enableGather?: boolean; + gatherToScript?: boolean; gatherRules?: IGatherRule[]; sendSelectionToInteractiveWindow: boolean; markdownRegularExpression: string; diff --git a/src/client/common/utils/localize.ts b/src/client/common/utils/localize.ts index e57898002f11..9b0c66070954 100644 --- a/src/client/common/utils/localize.ts +++ b/src/client/common/utils/localize.ts @@ -294,6 +294,8 @@ export namespace DataScience { export const findJupyterCommandProgress = localize('DataScience.findJupyterCommandProgress', 'Active interpreter does not support {0}. Searching for the best available interpreter.'); export const findJupyterCommandProgressCheckInterpreter = localize('DataScience.findJupyterCommandProgressCheckInterpreter', 'Checking {0}.'); export const findJupyterCommandProgressSearchCurrentPath = localize('DataScience.findJupyterCommandProgressSearchCurrentPath', 'Searching current path.'); + export const gatheredScriptDescription = localize('DataScience.gatheredScriptDescription', '# This file contains the minimal amount of code required to produce the code cell gathered.\n'); + export const gatheredNotebookDescriptionInMarkdown = localize('DataScience.gatheredNotebookDescriptionInMarkdown', '## This notebook was generated for a cell gathered from {0}.'); } export namespace DebugConfigStrings { diff --git a/src/client/datascience/cellFactory.ts b/src/client/datascience/cellFactory.ts index 6fcc20387ffb..cbc881f625b4 100644 --- a/src/client/datascience/cellFactory.ts +++ b/src/client/datascience/cellFactory.ts @@ -107,10 +107,56 @@ export function hasCells(document: TextDocument, settings?: IDataScienceSettings return false; } -export function generateCellRanges(document: TextDocument, settings?: IDataScienceSettings): { range: Range; title: string; cell_type: string }[] { +// CellRange is used as the basis for creating new ICells. We only use it in this file. +interface ICellRange { + range: Range; + title: string; + cell_type: string; +} + +export function generateCellsFromString(source: string, settings?: IDataScienceSettings): ICell[] { + const lines: string[] = source.splitLines({ trim: false, removeEmptyEntries: false }); + + // Find all the lines that start a cell + const matcher = new CellMatcher(settings); + const starts: { startLine: number; title: string; code: string; cell_type: string }[] = []; + let currentCode: string | undefined; + for (let index = 0; index < lines.length; index += 1) { + const line = lines[index]; + if (matcher.isCell(line)) { + if (starts.length > 0 && currentCode) { + const previousCell = starts[starts.length - 1]; + previousCell.code = currentCode; + } + const results = matcher.exec(line); + if (results !== undefined) { + starts.push({ + startLine: index + 1, + title: results, + cell_type: matcher.getCellType(line), + code: '' + }); + } + currentCode = undefined; + } + currentCode = currentCode ? `${currentCode}\n${line}` : line; + } + + if (starts.length >= 1 && currentCode) { + const previousCell = starts[starts.length - 1]; + previousCell.code = currentCode; + } + + // For each one, get its text and turn it into a cell + return Array.prototype.concat(...starts.map(s => { + return generateCells(settings, s.code, '', s.startLine, false, uuid()); + })); +} + +export function generateCellRangesFromDocument(document: TextDocument, settings?: IDataScienceSettings): ICellRange[] { // Implmentation of getCells here based on Don's Jupyter extension work const matcher = new CellMatcher(settings); - const cells : { range: Range; title: string; cell_type: string }[] = []; + const cells: ICellRange[] = []; for (let index = 0; index < document.lineCount; index += 1) { const line = document.lineAt(index); if (matcher.isCell(line.text)) { @@ -140,12 +186,11 @@ export function generateCellRanges(document: TextDocument, settings?: IDataScien } export function generateCellsFromDocument(document: TextDocument, settings?: IDataScienceSettings): ICell[] { - // Get our ranges. They'll determine our cells - const ranges = generateCellRanges(document, settings); + const ranges = generateCellRangesFromDocument(document, settings); // For each one, get its text and turn it into a cell - return Array.prototype.concat(...ranges.map(r => { - const code = document.getText(r.range); - return generateCells(settings, code, document.fileName, r.range.start.line, false, uuid()); + return Array.prototype.concat(...ranges.map(cr => { + const code = document.getText(cr.range); + return generateCells(settings, code, '', cr.range.start.line, false, uuid()); })); } diff --git a/src/client/datascience/constants.ts b/src/client/datascience/constants.ts index 541897f1f4a6..562d8cce6b30 100644 --- a/src/client/datascience/constants.ts +++ b/src/client/datascience/constants.ts @@ -203,6 +203,7 @@ export enum Telemetry { NotebookOpenCount = 'DATASCIENCE.NATIVE.NOTEBOOK_OPEN_COUNT', NotebookOpenTime = 'DS_INTERNAL.NATIVE.NOTEBOOK_OPEN_TIME', SessionIdleTimeout = 'DATASCIENCE.JUPYTER_IDLE_TIMEOUT', + NotebookExecutionActivated = 'DATASCIENCE.NOTEBOOK.EXECUTION.ACTIVATED', JupyterNotInstalledErrorShown = 'DATASCIENCE.JUPYTER_NOT_INSTALLED_ERROR_SHOWN', UserInstalledJupyter = 'DATASCIENCE.USER_INSTALLED_JUPYTER', UserDidNotInstallJupyter = 'DATASCIENCE.USER_DID_NOT_INSTALL_JUPYTER' diff --git a/src/client/datascience/editor-integration/codeLensFactory.ts b/src/client/datascience/editor-integration/codeLensFactory.ts index 180711da5893..58750962bbba 100644 --- a/src/client/datascience/editor-integration/codeLensFactory.ts +++ b/src/client/datascience/editor-integration/codeLensFactory.ts @@ -9,7 +9,7 @@ import { IFileSystem } from '../../common/platform/types'; import { IConfigurationService } from '../../common/types'; import * as localize from '../../common/utils/localize'; import { noop } from '../../common/utils/misc'; -import { generateCellRanges } from '../cellFactory'; +import { generateCellRangesFromDocument } from '../cellFactory'; import { CodeLensCommands, Commands } from '../constants'; import { InteractiveWindowMessages } from '../interactive-common/interactiveWindowTypes'; import { ICell, ICellHashProvider, ICodeLensFactory, IFileHashes, IInteractiveWindowListener } from '../types'; @@ -63,7 +63,7 @@ export class CodeLensFactory implements ICodeLensFactory, IInteractiveWindowList } public createCodeLenses(document: TextDocument): CodeLens[] { - const ranges = generateCellRanges(document, this.configService.getSettings().datascience); + const ranges = generateCellRangesFromDocument(document, this.configService.getSettings().datascience); const commands = this.enumerateCommands(); const hashes = this.configService.getSettings().datascience.addGotoCodeLenses ? this.hashProvider.getHashes() : []; const codeLenses: CodeLens[] = []; diff --git a/src/client/datascience/editor-integration/decorator.ts b/src/client/datascience/editor-integration/decorator.ts index e8e62b5c1bd2..42c5cd3b7097 100644 --- a/src/client/datascience/editor-integration/decorator.ts +++ b/src/client/datascience/editor-integration/decorator.ts @@ -8,7 +8,7 @@ import { IExtensionSingleActivationService } from '../../activation/types'; import { IDocumentManager } from '../../common/application/types'; import { PYTHON_LANGUAGE } from '../../common/constants'; import { IConfigurationService, IDisposable, IDisposableRegistry } from '../../common/types'; -import { generateCellRanges } from '../cellFactory'; +import { generateCellRangesFromDocument } from '../cellFactory'; @injectable() export class Decorator implements IExtensionSingleActivationService, IDisposable { @@ -100,7 +100,7 @@ export class Decorator implements IExtensionSingleActivationService, IDisposable const settings = this.configuration.getSettings().datascience; if (settings.decorateCells && settings.enabled) { // Find all of the cells - const cells = generateCellRanges(editor.document, this.configuration.getSettings().datascience); + const cells = generateCellRangesFromDocument(editor.document, this.configuration.getSettings().datascience); // Find the range for our active cell. const currentRange = cells.map(c => c.range).filter(r => r.contains(editor.selection.anchor)); diff --git a/src/client/datascience/gather/gather.ts b/src/client/datascience/gather/gather.ts index 8a578989a719..c28000ea5e39 100644 --- a/src/client/datascience/gather/gather.ts +++ b/src/client/datascience/gather/gather.ts @@ -1,29 +1,22 @@ -import { DataflowAnalyzer } from '@msrvida/python-program-analysis'; -import { Cell as ICell, LogCell } from '@msrvida/python-program-analysis/dist/es5/cell'; -import { CellSlice } from '@msrvida/python-program-analysis/dist/es5/cellslice'; -import { ExecutionLogSlicer } from '@msrvida/python-program-analysis/dist/es5/log-slicer'; +import { CellSlice, DataflowAnalyzer, ExecutionLogSlicer } from '@msrvida/python-program-analysis'; +import { Cell as IGatherCell } from '@msrvida/python-program-analysis/dist/es5/cell'; import { inject, injectable } from 'inversify'; -// tslint:disable-next-line: no-require-imports -import cloneDeep = require('lodash/cloneDeep'); import { IApplicationShell, ICommandManager } from '../../common/application/types'; import { traceInfo } from '../../common/logger'; import { IConfigurationService, IDisposableRegistry } from '../../common/types'; import * as localize from '../../common/utils/localize'; // tslint:disable-next-line: no-duplicate-imports import { Common } from '../../common/utils/localize'; -import { noop } from '../../common/utils/misc'; -import { CellMatcher } from '../cellMatcher'; -import { concatMultilineStringInput } from '../common'; import { Identifiers } from '../constants'; -import { CellState, ICell as IVscCell, IGatherExecution, INotebookExecutionLogger } from '../types'; +import { CellState, ICell as IVscCell, IGatherExecution } from '../types'; /** * An adapter class to wrap the code gathering functionality from [microsoft/python-program-analysis](https://www.npmjs.com/package/@msrvida/python-program-analysis). */ @injectable() -export class GatherExecution implements IGatherExecution, INotebookExecutionLogger { - private _executionSlicer: ExecutionLogSlicer; +export class GatherExecution implements IGatherExecution { + private _executionSlicer: ExecutionLogSlicer; private dataflowAnalyzer: DataflowAnalyzer; private _enabled: boolean; @@ -44,40 +37,24 @@ export class GatherExecution implements IGatherExecution, INotebookExecutionLogg traceInfo('Gathering tools have been activated'); } + public logExecution(vscCell: IVscCell): void { + const gatherCell = convertVscToGatherCell(vscCell); - public async preExecute(_vscCell: IVscCell, _silent: boolean): Promise { - // This function is just implemented here for compliance with the INotebookExecutionLogger interface - noop(); + if (gatherCell) { + this._executionSlicer.logExecution(gatherCell); + } } - public async postExecute(vscCell: IVscCell, _silent: boolean): Promise { - if (this._enabled) { - // Don't log if vscCell.data.source is an empty string or if it was - // silently executed. Original Jupyter extension also does this. - if (vscCell.data.source !== '' && !_silent) { - // First make a copy of this cell, as we are going to modify it - const cloneCell: IVscCell = cloneDeep(vscCell); - - // Strip first line marker. We can't do this at JupyterServer.executeCodeObservable because it messes up hashing - const cellMatcher = new CellMatcher(this.configService.getSettings().datascience); - cloneCell.data.source = cellMatcher.stripFirstMarker(concatMultilineStringInput(vscCell.data.source)); - - // Convert IVscCell to IGatherCell - const cell = convertVscToGatherCell(cloneCell) as LogCell; - - // Call internal logging method - this._executionSlicer.logExecution(cell); - } - } + public async resetLog(): Promise { + this._executionSlicer.reset(); } /** * For a given code cell, returns a string representing a program containing all the code it depends on. */ public gatherCode(vscCell: IVscCell): string { - // sliceAllExecutions does a lookup based on executionEventId - const cell = convertVscToGatherCell(vscCell); - if (cell === undefined) { + const gatherCell = convertVscToGatherCell(vscCell); + if (!gatherCell) { return ''; } @@ -85,11 +62,11 @@ export class GatherExecution implements IGatherExecution, INotebookExecutionLogg const defaultCellMarker = this.configService.getSettings().datascience.defaultCellMarker || Identifiers.DefaultCodeCellMarker; // Call internal slice method - const slices = this._executionSlicer.sliceAllExecutions(cell); + const slices = this._executionSlicer.sliceAllExecutions(gatherCell.persistentId); const program = slices.length > 0 ? slices[0].cellSlices.reduce(concat, '').replace(/#%%/g, defaultCellMarker) : ''; // Add a comment at the top of the file explaining what gather does - const descriptor = '# This file contains the minimal amount of code required to produce the code cell you gathered.\n'; + const descriptor = localize.DataScience.gatheredScriptDescription(); return descriptor.concat(program); } @@ -122,7 +99,7 @@ export class GatherExecution implements IGatherExecution, INotebookExecutionLogg /** * Accumulator to concatenate cell slices for a sliced program, preserving cell structures. */ -function concat(existingText: string, newText: CellSlice) { +function concat(existingText: string, newText: CellSlice): string { // Include our cell marker so that cell slices are preserved return `${existingText}#%%\n${newText.textSliceLines}\n\n`; } @@ -131,14 +108,11 @@ function concat(existingText: string, newText: CellSlice) { * This is called to convert VS Code ICells to Gather ICells for logging. * @param cell A cell object conforming to the VS Code cell interface */ -function convertVscToGatherCell(cell: IVscCell): ICell | undefined { +function convertVscToGatherCell(cell: IVscCell): IGatherCell | undefined { // This should always be true since we only want to log code cells. Putting this here so types match for outputs property if (cell.data.cell_type === 'code') { - const result: ICell = { + const result: IGatherCell = { // tslint:disable-next-line no-unnecessary-local-variable - id: cell.id, - gathered: false, - dirty: false, text: cell.data.source, // This may need to change for native notebook support since in the original Gather code this refers to the number of times that this same cell was executed @@ -147,9 +121,7 @@ function convertVscToGatherCell(cell: IVscCell): ICell | undefined { // This may need to change for native notebook support, since this is intended to persist in the metadata for a notebook that is saved and then re-loaded persistentId: cell.id, - outputs: cell.data.outputs, - hasError: cell.state === CellState.error, - is_cell: true + hasError: cell.state === CellState.error // tslint:disable-next-line: no-any } as any; return result; diff --git a/src/client/datascience/gather/gatherListener.ts b/src/client/datascience/gather/gatherListener.ts index c5639afe5b18..75b09fb6e857 100644 --- a/src/client/datascience/gather/gatherListener.ts +++ b/src/client/datascience/gather/gatherListener.ts @@ -1,23 +1,37 @@ import { inject, injectable } from 'inversify'; -import { Event, EventEmitter, Position, ViewColumn } from 'vscode'; +import * as uuid from 'uuid/v4'; +import { Event, EventEmitter, Position, Uri, ViewColumn } from 'vscode'; import { IApplicationShell, IDocumentManager } from '../../common/application/types'; import { PYTHON_LANGUAGE } from '../../common/constants'; import { IFileSystem } from '../../common/platform/types'; +import { IConfigurationService } from '../../common/types'; +import * as localize from '../../common/utils/localize'; import { noop } from '../../common/utils/misc'; -import { InteractiveWindowMessages } from '../interactive-common/interactiveWindowTypes'; -import { ICell, IGatherExecution, IInteractiveWindowListener } from '../types'; +import { generateCellsFromString } from '../cellFactory'; +import { IInteractiveWindowMapping, InteractiveWindowMessages } from '../interactive-common/interactiveWindowTypes'; +import { ICell, IGatherExecution, IInteractiveWindowListener, IInteractiveWindowProvider, IJupyterExecution, INotebook, INotebookEditorProvider, INotebookExporter } from '../types'; +import { GatherLogger } from './gatherLogger'; @injectable() export class GatherListener implements IInteractiveWindowListener { // tslint:disable-next-line: no-any private postEmitter: EventEmitter<{ message: string; payload: any }> = new EventEmitter<{ message: string; payload: any }>(); + private gatherLogger: GatherLogger; + private notebookUri: Uri = Uri.parse(''); constructor( - @inject(IDocumentManager) private documentManager: IDocumentManager, + @inject(IGatherExecution) private gather: IGatherExecution, @inject(IApplicationShell) private applicationShell: IApplicationShell, - @inject(IGatherExecution) private gatherExecution: IGatherExecution, + @inject(INotebookExporter) private jupyterExporter: INotebookExporter, + @inject(INotebookEditorProvider) private ipynbProvider: INotebookEditorProvider, + @inject(IJupyterExecution) private jupyterExecution: IJupyterExecution, + @inject(IInteractiveWindowProvider) private interactiveWindowProvider: IInteractiveWindowProvider, + @inject(IConfigurationService) private configService: IConfigurationService, + @inject(IDocumentManager) private documentManager: IDocumentManager, @inject(IFileSystem) private fileSystem: IFileSystem - ) { } + ) { + this.gatherLogger = new GatherLogger(this.gather, this.configService); + } public dispose() { noop(); @@ -31,11 +45,16 @@ export class GatherListener implements IInteractiveWindowListener { // tslint:disable-next-line: no-any public onMessage(message: string, payload?: any): void { switch (message) { - case InteractiveWindowMessages.GatherCode: - if (payload) { - const cell = payload as ICell; - this.gatherCode(cell); - } + case InteractiveWindowMessages.NotebookExecutionActivated: + this.handleMessage(message, payload, this.doSetLogger); + break; + + case InteractiveWindowMessages.GatherCodeRequest: + this.handleMessage(message, payload, this.doGather); + break; + + case InteractiveWindowMessages.RestartKernel: + this.gather.resetLog(); break; default: @@ -43,18 +62,77 @@ export class GatherListener implements IInteractiveWindowListener { } } - public gatherCode(payload: ICell) { + // tslint:disable:no-any + private handleMessage(_message: T, payload: any, handler: (args: M[T]) => void) { + const args = payload as M[T]; + handler.bind(this)(args); + } + + private doSetLogger(payload: Uri): void { + this.setLogger(payload).ignoreErrors(); + } + + private async setLogger(notebookUri: Uri) { + this.notebookUri = notebookUri; + + // First get the active server + const activeServer = await this.jupyterExecution.getServer(await this.interactiveWindowProvider.getNotebookOptions()); + + let nb: INotebook | undefined; + // If that works, see if there's a matching notebook running + if (activeServer) { + nb = await activeServer.getNotebook(notebookUri); + + // If we have an executing notebook, add the gather logger. + if (nb) { + nb.addLogger(this.gatherLogger); + } + } + } + + private doGather(payload: ICell): void { this.gatherCodeInternal(payload).catch(err => { this.applicationShell.showErrorMessage(err); }); } private gatherCodeInternal = async (cell: ICell) => { - const slicedProgram = this.gatherExecution.gatherCode(cell); + const slicedProgram = this.gather.gatherCode(cell); + + if (this.configService.getSettings().datascience.gatherToScript) { + await this.showFile(slicedProgram, cell.file); + } else { + await this.showNotebook(slicedProgram); + } + } + + private async showNotebook(slicedProgram: string) { + if (slicedProgram) { + let cells: ICell[] = [{ + id: uuid(), + file: '', + line: 0, + state: 0, + data: { + cell_type: 'markdown', + source: localize.DataScience.gatheredNotebookDescriptionInMarkdown().format(this.notebookUri.fsPath), + metadata: {} + } + }]; + + // Create new notebook with the returned program and open it. + cells = cells.concat(generateCellsFromString(slicedProgram)); + + const notebook = await this.jupyterExporter.translateToNotebook(cells); + const contents = JSON.stringify(notebook); + await this.ipynbProvider.createNew(contents); + } + } + private async showFile(slicedProgram: string, filename: string) { // Don't want to open the gathered code on top of the interactive window let viewColumn: ViewColumn | undefined; - const fileNameMatch = this.documentManager.visibleTextEditors.filter(textEditor => this.fileSystem.arePathsSame(textEditor.document.fileName, cell.file)); + const fileNameMatch = this.documentManager.visibleTextEditors.filter(textEditor => this.fileSystem.arePathsSame(textEditor.document.fileName, filename)); const definedVisibleEditors = this.documentManager.visibleTextEditors.filter(textEditor => textEditor.viewColumn !== undefined); if (this.documentManager.visibleTextEditors.length > 0 && fileNameMatch.length > 0) { // Original file is visible diff --git a/src/client/datascience/gather/gatherLogger.ts b/src/client/datascience/gather/gatherLogger.ts new file mode 100644 index 000000000000..efae3af72ce0 --- /dev/null +++ b/src/client/datascience/gather/gatherLogger.ts @@ -0,0 +1,41 @@ +import { inject, injectable } from 'inversify'; +// tslint:disable-next-line: no-require-imports +import cloneDeep = require('lodash/cloneDeep'); +import { IConfigurationService } from '../../common/types'; +import { noop } from '../../common/utils/misc'; +import { CellMatcher } from '../cellMatcher'; +import { concatMultilineStringInput } from '../common'; +import { ICell as IVscCell, IGatherExecution, INotebookExecutionLogger } from '../types'; +import { GatherExecution } from './gather'; + +@injectable() +export class GatherLogger implements INotebookExecutionLogger { + + constructor( + @inject(GatherExecution) private gather: IGatherExecution, + @inject(IConfigurationService) private configService: IConfigurationService + ) { + } + + public async preExecute(_vscCell: IVscCell, _silent: boolean): Promise { + // This function is just implemented here for compliance with the INotebookExecutionLogger interface + noop(); + } + + public async postExecute(vscCell: IVscCell, _silent: boolean): Promise { + if (this.gather.enabled) { + // Don't log if vscCell.data.source is an empty string or if it was + // silently executed. Original Jupyter extension also does this. + if (vscCell.data.source !== '' && !_silent) { + // First make a copy of this cell, as we are going to modify it + const cloneCell: IVscCell = cloneDeep(vscCell); + + // Strip first line marker. We can't do this at JupyterServer.executeCodeObservable because it messes up hashing + const cellMatcher = new CellMatcher(this.configService.getSettings().datascience); + cloneCell.data.source = cellMatcher.stripFirstMarker(concatMultilineStringInput(vscCell.data.source)); + + this.gather.logExecution(cloneCell); + } + } + } +} diff --git a/src/client/datascience/interactive-common/interactiveBase.ts b/src/client/datascience/interactive-common/interactiveBase.ts index 764e44796dd9..d8a0915a49a3 100644 --- a/src/client/datascience/interactive-common/interactiveBase.ts +++ b/src/client/datascience/interactive-common/interactiveBase.ts @@ -29,7 +29,7 @@ import * as localize from '../../common/utils/localize'; import { StopWatch } from '../../common/utils/stopWatch'; import { IInterpreterService, PythonInterpreter } from '../../interpreter/contracts'; import { captureTelemetry, sendTelemetryEvent } from '../../telemetry'; -import { generateCellRanges } from '../cellFactory'; +import { generateCellRangesFromDocument } from '../cellFactory'; import { CellMatcher } from '../cellMatcher'; import { Identifiers, Telemetry } from '../constants'; import { ColumnWarningSize } from '../data-viewing/types'; @@ -1013,7 +1013,7 @@ export abstract class InteractiveBase extends WebViewHost 0; const line = editor.selection.start.line; const revealLine = line + 1; @@ -1088,6 +1088,11 @@ export abstract class InteractiveBase extends WebViewHost = new Map(); private executedEditors: Set = new Set(); private notebookCount: number = 0; @@ -72,7 +73,6 @@ export class NativeEditorProvider implements INotebookEditorProvider, IAsyncDisp sendTelemetryEvent(Telemetry.NotebookRunCount, this.executedEditors.size); sendTelemetryEvent(Telemetry.NotebookWorkspaceCount, this.notebookCount); } - public get activeEditor(): INotebookEditor | undefined { const active = [...this.activeEditors.entries()].find(e => e[1].active); if (active) { @@ -106,11 +106,15 @@ export class NativeEditorProvider implements INotebookEditorProvider, IAsyncDisp } @captureTelemetry(Telemetry.CreateNewNotebook, undefined, false) - public async createNew(): Promise { + public async createNew(contents?: string): Promise { // Create a new URI for the dummy file using our root workspace path const uri = await this.getNextNewNotebookUri(); this.notebookCount += 1; - return this.open(uri, ''); + if (contents) { + return this.open(uri, contents); + } else { + return this.open(uri, ''); + } } public async getNotebookOptions(): Promise { @@ -130,6 +134,7 @@ export class NativeEditorProvider implements INotebookEditorProvider, IAsyncDisp purpose: Identifiers.HistoryPurpose // Share the same one as the interactive window. Just need a new session }; } + /** * Open ipynb files when user opens an ipynb file. * diff --git a/src/client/datascience/interactive-window/interactiveWindowCommandListener.ts b/src/client/datascience/interactive-window/interactiveWindowCommandListener.ts index 458f69092004..19b0c8dbefe3 100644 --- a/src/client/datascience/interactive-window/interactiveWindowCommandListener.ts +++ b/src/client/datascience/interactive-window/interactiveWindowCommandListener.ts @@ -16,7 +16,7 @@ import { IConfigurationService, IDisposableRegistry, ILogger } from '../../commo import * as localize from '../../common/utils/localize'; import { captureTelemetry } from '../../telemetry'; import { CommandSource } from '../../testing/common/constants'; -import { generateCellRanges, generateCellsFromDocument } from '../cellFactory'; +import { generateCellRangesFromDocument, generateCellsFromDocument } from '../cellFactory'; import { Commands, Identifiers, Telemetry } from '../constants'; import { JupyterInstallError } from '../jupyter/jupyterInstallError'; import { @@ -198,7 +198,7 @@ export class InteractiveWindowCommandListener implements IDataScienceCommandList // If the current file is the active editor, then generate cells from the document. const activeEditor = this.documentManager.activeTextEditor; if (activeEditor && activeEditor.document && this.fileSystem.arePathsSame(activeEditor.document.fileName, file)) { - const ranges = generateCellRanges(activeEditor.document); + const ranges = generateCellRangesFromDocument(activeEditor.document); if (ranges.length > 0) { // Ask user for path const output = await this.showExportDialog(); diff --git a/src/client/datascience/jupyter/jupyterImporter.ts b/src/client/datascience/jupyter/jupyterImporter.ts index 2757cde4548b..c7db56d274bb 100644 --- a/src/client/datascience/jupyter/jupyterImporter.ts +++ b/src/client/datascience/jupyter/jupyterImporter.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. 'use strict'; -import { nbformat } from '@jupyterlab/coreutils/lib/nbformat'; +import { nbformat } from '@jupyterlab/coreutils'; import * as fs from 'fs-extra'; import { inject, injectable } from 'inversify'; import * as os from 'os'; diff --git a/src/client/datascience/jupyter/jupyterKernelSpec.ts b/src/client/datascience/jupyter/jupyterKernelSpec.ts index 9881db8671c7..25b171e0464c 100644 --- a/src/client/datascience/jupyter/jupyterKernelSpec.ts +++ b/src/client/datascience/jupyter/jupyterKernelSpec.ts @@ -15,7 +15,7 @@ export class JupyterKernelSpec implements IJupyterKernelSpec { public language: string; public path: string; public specFile: string | undefined; - constructor(specModel : Kernel.ISpecModel, file?: string) { + constructor(specModel: Kernel.ISpecModel, file?: string) { this.name = specModel.name; this.language = specModel.language; this.path = specModel.argv && specModel.argv.length > 0 ? specModel.argv[0] : ''; diff --git a/src/client/datascience/jupyter/jupyterNotebook.ts b/src/client/datascience/jupyter/jupyterNotebook.ts index 94bcf6186119..cf95a9f3befd 100644 --- a/src/client/datascience/jupyter/jupyterNotebook.ts +++ b/src/client/datascience/jupyter/jupyterNotebook.ts @@ -255,6 +255,10 @@ export class JupyterNotebookBase implements INotebook { return this.updateWorkingDirectory(file); } + public addLogger(logger: INotebookExecutionLogger) { + this.loggers.push(logger); + } + public executeObservable(code: string, file: string, line: number, id: string, silent: boolean = false): Observable { // Create an observable and wrap the result so we can time it. const stopWatch = new StopWatch(); diff --git a/src/client/datascience/jupyter/liveshare/guestJupyterNotebook.ts b/src/client/datascience/jupyter/liveshare/guestJupyterNotebook.ts index d2c8a572f6f2..f55a9c486323 100644 --- a/src/client/datascience/jupyter/liveshare/guestJupyterNotebook.ts +++ b/src/client/datascience/jupyter/liveshare/guestJupyterNotebook.ts @@ -14,7 +14,7 @@ import { createDeferred } from '../../../common/utils/async'; import * as localize from '../../../common/utils/localize'; import { noop } from '../../../common/utils/misc'; import { LiveShare, LiveShareCommands } from '../../constants'; -import { ICell, INotebook, INotebookCompletion, INotebookServer, InterruptResult } from '../../types'; +import { ICell, INotebook, INotebookCompletion, INotebookExecutionLogger, INotebookServer, InterruptResult } from '../../types'; import { LiveShareParticipantDefault, LiveShareParticipantGuest } from './liveShareParticipantMixin'; import { ResponseQueue } from './responseQueue'; import { IExecuteObservableResponse, ILiveShareParticipant, IServerResponse } from './types'; @@ -92,6 +92,10 @@ export class GuestJupyterNotebook return Promise.resolve(); } + public addLogger(_logger: INotebookExecutionLogger): void { + noop(); + } + public async setMatplotLibStyle(_useDark: boolean): Promise { // Guest can't change the style. Maybe output a warning here? } diff --git a/src/client/datascience/serviceRegistry.ts b/src/client/datascience/serviceRegistry.ts index 996090a2cae2..7a811e612c8d 100644 --- a/src/client/datascience/serviceRegistry.ts +++ b/src/client/datascience/serviceRegistry.ts @@ -110,14 +110,13 @@ export function registerTypes(serviceManager: IServiceManager) { serviceManager.add(IDataScienceErrorHandler, DataScienceErrorHandler); serviceManager.addSingleton(ICodeLensFactory, CodeLensFactory); serviceManager.addSingleton(ICellHashProvider, CellHashProvider); - serviceManager.addSingleton(IGatherExecution, GatherExecution); + serviceManager.add(IGatherExecution, GatherExecution); serviceManager.addBinding(ICellHashProvider, IInteractiveWindowListener); serviceManager.addBinding(ICellHashProvider, INotebookExecutionLogger); serviceManager.addBinding(IJupyterDebugger, ICellHashListener); serviceManager.addSingleton(INotebookEditorProvider, NativeEditorProvider); serviceManager.add(INotebookEditor, NativeEditor); serviceManager.addSingleton(IDataScienceCommandListener, NativeEditorCommandListener); - serviceManager.addBinding(IGatherExecution, INotebookExecutionLogger); serviceManager.addBinding(ICodeLensFactory, IInteractiveWindowListener); serviceManager.addSingleton(IDebugLocationTracker, DebugLocationTrackerFactory); } diff --git a/src/client/datascience/types.ts b/src/client/datascience/types.ts index 59332f93098c..d686c68adeb2 100644 --- a/src/client/datascience/types.ts +++ b/src/client/datascience/types.ts @@ -98,6 +98,7 @@ export interface INotebook extends IAsyncDisposable { setLaunchingFile(file: string): Promise; getSysInfo(): Promise; setMatplotLibStyle(useDark: boolean): Promise; + addLogger(logger: INotebookExecutionLogger): void; } export interface INotebookServerOptions { @@ -118,7 +119,9 @@ export interface INotebookExecutionLogger { export const IGatherExecution = Symbol('IGatherExecution'); export interface IGatherExecution { enabled: boolean; + logExecution(vscCell: ICell): void; gatherCode(vscCell: ICell): string; + resetLog(): void; } export const IJupyterExecution = Symbol('IJupyterExecution'); @@ -241,7 +244,7 @@ export interface INotebookEditorProvider { readonly editors: INotebookEditor[]; open(file: Uri, contents: string): Promise; show(file: Uri): Promise; - createNew(): Promise; + createNew(contents?: string): Promise; getNotebookOptions(): Promise; } diff --git a/src/client/telemetry/index.ts b/src/client/telemetry/index.ts index 91e0a1e98e67..f1332872a4d3 100644 --- a/src/client/telemetry/index.ts +++ b/src/client/telemetry/index.ts @@ -1362,6 +1362,7 @@ export interface IEventNamePropertyMapping { [Telemetry.CodeLensAverageAcquisitionTime]: never | undefined; [Telemetry.CollapseAll]: never | undefined; [Telemetry.ConnectFailedJupyter]: never | undefined; + [Telemetry.NotebookExecutionActivated]: never | undefined; [Telemetry.ConnectLocalJupyter]: never | undefined; [Telemetry.ConnectRemoteJupyter]: never | undefined; [Telemetry.ConnectRemoteFailedJupyter]: never | undefined; diff --git a/src/datascience-ui/history-react/interactivePanel.tsx b/src/datascience-ui/history-react/interactivePanel.tsx index b64187253155..575180eaa77c 100644 --- a/src/datascience-ui/history-react/interactivePanel.tsx +++ b/src/datascience-ui/history-react/interactivePanel.tsx @@ -363,11 +363,12 @@ export class InteractivePanel extends React.Component this.stateController.gatherCell(cell); const hasNoSource = !cell || !cell.cell.file || cell.cell.file === Identifiers.EmptyFileName; + const gatherHidden = !cell || !this.state.enableGather || cell.cell.data.cell_type !== 'code'; return ( [
-
); } diff --git a/src/datascience-ui/native-editor/nativeEditor.tsx b/src/datascience-ui/native-editor/nativeEditor.tsx index 87758d27a2f2..d11c5917d52c 100644 --- a/src/datascience-ui/native-editor/nativeEditor.tsx +++ b/src/datascience-ui/native-editor/nativeEditor.tsx @@ -59,7 +59,7 @@ export class NativeEditor extends React.Component(IInteractiveWindowListener, GatherListener); this.serviceManager.addBinding(ICellHashProvider, INotebookExecutionLogger); this.serviceManager.addBinding(IJupyterDebugger, ICellHashListener); - this.serviceManager.addSingleton(IGatherExecution, GatherExecution); - this.serviceManager.addBinding(IGatherExecution, INotebookExecutionLogger); + this.serviceManager.add(IGatherExecution, GatherExecution); this.serviceManager.addSingleton(ICodeLensFactory, CodeLensFactory); this.serviceManager.addSingleton(IShellDetector, TerminalNameShellDetector); this.serviceManager.addSingleton(InterpeterHashProviderFactory, InterpeterHashProviderFactory); diff --git a/src/test/datascience/editor-integration/codewatcher.unit.test.ts b/src/test/datascience/editor-integration/codewatcher.unit.test.ts index 09ef0f3b8499..bf9c26228fe5 100644 --- a/src/test/datascience/editor-integration/codewatcher.unit.test.ts +++ b/src/test/datascience/editor-integration/codewatcher.unit.test.ts @@ -179,7 +179,7 @@ suite('DataScience Code Watcher Unit Tests', () => { const fileName = Uri.file('test.py').fsPath; const version = 1; const inputText = `#%%`; - const document = createDocument(inputText, fileName, version, TypeMoq.Times.atLeastOnce()); + const document = createDocument(inputText, fileName, version, TypeMoq.Times.atLeastOnce(), true); codeWatcher.setDocument(document.object); @@ -200,7 +200,7 @@ suite('DataScience Code Watcher Unit Tests', () => { const fileName = Uri.file('test.py').fsPath; const version = 1; const inputText = `dummy`; - const document = createDocument(inputText, fileName, version, TypeMoq.Times.atLeastOnce()); + const document = createDocument(inputText, fileName, version, TypeMoq.Times.atLeastOnce(), true); codeWatcher.setDocument(document.object); @@ -228,7 +228,7 @@ third line #%% fourth line`; - const document = createDocument(inputText, fileName, version, TypeMoq.Times.atLeastOnce()); + const document = createDocument(inputText, fileName, version, TypeMoq.Times.atLeastOnce(), true); codeWatcher.setDocument(document.object); @@ -265,7 +265,7 @@ fourth line pythonSettings.datascience.codeRegularExpression = '(#\\s*\\|#\\s*\\)'; pythonSettings.datascience.markdownRegularExpression = '(#\\s*\\|#\\s*\\)'; - const document = createDocument(inputText, fileName, version, TypeMoq.Times.atLeastOnce()); + const document = createDocument(inputText, fileName, version, TypeMoq.Times.atLeastOnce(), true); codeWatcher.setDocument(document.object); @@ -303,7 +303,7 @@ fourth line pythonSettings.datascience.codeRegularExpression = '# * code cell)'; pythonSettings.datascience.markdownRegularExpression = '(#\\s*\\|#\\s*\\)'; - const document = createDocument(inputText, fileName, version, TypeMoq.Times.atLeastOnce()); + const document = createDocument(inputText, fileName, version, TypeMoq.Times.atLeastOnce(), true); codeWatcher.setDocument(document.object); @@ -356,8 +356,10 @@ fourth line `#%% testing1 #%% -testing2`; // Command tests override getText, so just need the ranges here - const document = createDocument(inputText, fileName, version, TypeMoq.Times.atLeastOnce(), true); +testing2`; + const document = createDocument(inputText, fileName, version, TypeMoq.Times.atLeastOnce()); + + document.setup(doc => doc.getText()).returns(() => inputText).verifiable(TypeMoq.Times.exactly(1)); codeWatcher.setDocument(document.object); @@ -384,28 +386,20 @@ testing2`; // Command tests override getText, so just need the ranges here `#%% testing1 #%% -testing2`; // Command tests override getText, so just need the ranges here - const document = createDocument(inputText, fileName, version, TypeMoq.Times.atLeastOnce()); - - // Specify our range and text here - const testRange1 = new Range(0, 0, 1, 8); - const testString1 = 'testing1'; - document.setup(doc => doc.getText(testRange1)).returns(() => testString1).verifiable(TypeMoq.Times.once()); - const testRange2 = new Range(2, 0, 3, 8); - const testString2 = 'testing2'; - document.setup(doc => doc.getText(testRange2)).returns(() => testString2).verifiable(TypeMoq.Times.once()); +testing2`; + const document = createDocument(inputText, fileName, version, TypeMoq.Times.atLeastOnce(), true); codeWatcher.setDocument(document.object); // Set up our expected calls to add code - activeInteractiveWindow.setup(h => h.addCode(TypeMoq.It.isValue(testString1), + activeInteractiveWindow.setup(h => h.addCode(TypeMoq.It.isValue('#%%\ntesting1'), TypeMoq.It.isValue(fileName), TypeMoq.It.isValue(0), TypeMoq.It.isAny(), TypeMoq.It.isAny() )).returns(() => Promise.resolve(true)).verifiable(TypeMoq.Times.once()); - activeInteractiveWindow.setup(h => h.addCode(TypeMoq.It.isValue(testString2), + activeInteractiveWindow.setup(h => h.addCode(TypeMoq.It.isValue('#%%\ntesting2'), TypeMoq.It.isValue(fileName), TypeMoq.It.isValue(2), TypeMoq.It.isAny(), @@ -427,13 +421,12 @@ testing2`; // Command tests override getText, so just need the ranges here testing1 #%% testing2`; - const document = createDocument(inputText, fileName, version, TypeMoq.Times.atLeastOnce()); - document.setup(d => d.getText(new Range(2, 0, 3, 8))).returns(() => 'testing2').verifiable(TypeMoq.Times.atLeastOnce()); + const document = createDocument(inputText, fileName, version, TypeMoq.Times.atLeastOnce(), true); codeWatcher.setDocument(document.object); // Set up our expected calls to add code - activeInteractiveWindow.setup(h => h.addCode(TypeMoq.It.isValue('testing2'), + activeInteractiveWindow.setup(h => h.addCode(TypeMoq.It.isValue('#%%\ntesting2'), TypeMoq.It.isValue(fileName), TypeMoq.It.isValue(2), TypeMoq.It.is((ed: TextEditor) => { @@ -646,7 +639,7 @@ testing3`; testing1 #%% testing2`; - const document = createDocument(inputText, fileName, version, TypeMoq.Times.atLeastOnce()); + const document = createDocument(inputText, fileName, version, TypeMoq.Times.atLeastOnce(), true); codeWatcher.setDocument(document.object); helper.setup(h => h.getSelectedTextToExecute(TypeMoq.It.is((ed: TextEditor) => { @@ -683,16 +676,13 @@ testing2`; `#%% testing1 #%% -testing2`; // Command tests override getText, so just need the ranges here - const document = createDocument(inputText, fileName, version, TypeMoq.Times.atLeastOnce()); - const testRange = new Range(0, 0, 1, 8); - const testString = 'testing1'; - document.setup(d => d.getText(testRange)).returns(() => testString).verifiable(TypeMoq.Times.atLeastOnce()); +testing2`; + const document = createDocument(inputText, fileName, version, TypeMoq.Times.atLeastOnce(), true); codeWatcher.setDocument(document.object); // Set up our expected calls to add code - activeInteractiveWindow.setup(h => h.addCode(TypeMoq.It.isValue(testString), + activeInteractiveWindow.setup(h => h.addCode(TypeMoq.It.isValue('#%%\ntesting1'), TypeMoq.It.isValue(fileName), TypeMoq.It.isValue(0), TypeMoq.It.is((ed: TextEditor) => { @@ -736,13 +726,14 @@ testing2`; // Command tests override getText, so just need the ranges here const version = 1; const inputText = '#%% foobar'; const document = createDocument(inputText, fileName, version, TypeMoq.Times.atLeastOnce()); + document.setup(doc => doc.getText()).returns(() => inputText); documentManager.setup(d => d.textDocuments).returns(() => [document.object]); const codeLensProvider = new DataScienceCodeLensProvider(serviceContainer.object, debugLocationTracker.object, documentManager.object, configService.object, commandManager.object, disposables, debugService.object, fileSystem.object); let result = codeLensProvider.provideCodeLenses(document.object, tokenSource.token); expect(result, 'result not okay').to.be.ok; let codeLens = result as CodeLens[]; - expect(codeLens.length).to.equal(3, 'Code lens wrong length'); + expect(codeLens.length).to.equal(3, 'Code lens wrong length - initial'); expect(contexts.get(EditorContexts.HasCodeCells)).to.be.equal(true, 'Code cells context not set'); @@ -760,7 +751,8 @@ testing2`; // Command tests override getText, so just need the ranges here result = codeLensProvider.provideCodeLenses(document.object, tokenSource.token); expect(result, 'result not okay').to.be.ok; codeLens = result as CodeLens[]; - expect(codeLens.length).to.equal(3, 'Code lens wrong length'); + expect(codeLens.length).to.equal(3, 'Code lens wrong length - final'); + }); test('Test the RunAllCellsAbove command with an error', async () => { @@ -815,27 +807,19 @@ testing2`; testing1 #%% testing2`; // Command tests override getText, so just need the ranges here - const document = createDocument(inputText, fileName, version, TypeMoq.Times.atLeastOnce()); - - // Specify our range and text here - const testRange1 = new Range(0, 0, 1, 8); - const testString1 = 'testing1'; - document.setup(doc => doc.getText(testRange1)).returns(() => testString1).verifiable(TypeMoq.Times.once()); - const testRange2 = new Range(2, 0, 3, 8); - const testString2 = 'testing2'; - document.setup(doc => doc.getText(testRange2)).returns(() => testString2).verifiable(TypeMoq.Times.never()); + const document = createDocument(inputText, fileName, version, TypeMoq.Times.atLeastOnce(), true); codeWatcher.setDocument(document.object); // Set up our expected calls to add code - activeInteractiveWindow.setup(h => h.addCode(TypeMoq.It.isValue(testString1), + activeInteractiveWindow.setup(h => h.addCode(TypeMoq.It.isValue('#%%\ntesting1'), TypeMoq.It.isValue(fileName), TypeMoq.It.isValue(0), TypeMoq.It.isAny(), TypeMoq.It.isAny() )).returns(() => Promise.resolve(false)).verifiable(TypeMoq.Times.once()); - activeInteractiveWindow.setup(h => h.addCode(TypeMoq.It.isValue(testString2), + activeInteractiveWindow.setup(h => h.addCode(TypeMoq.It.isValue('#%%\ntesting2'), TypeMoq.It.isValue(fileName), TypeMoq.It.isValue(2), TypeMoq.It.isAny(), diff --git a/src/test/datascience/editor-integration/helpers.ts b/src/test/datascience/editor-integration/helpers.ts index bd363fb16ba2..e9b3fcebf546 100644 --- a/src/test/datascience/editor-integration/helpers.ts +++ b/src/test/datascience/editor-integration/helpers.ts @@ -22,7 +22,7 @@ export function createDocument(inputText: string, fileName: string, fileVersion: document.setup(d => d.version).returns(() => fileVersion).verifiable(times); // Next add the lines in - document.setup(d => d.lineCount).returns(() => inputLines.length).verifiable(times); + document.setup(d => d.lineCount).returns(() => inputLines.length); const textLines = inputLines.map((line, index) => { const textLine = TypeMoq.Mock.ofType(); diff --git a/src/test/datascience/execution.unit.test.ts b/src/test/datascience/execution.unit.test.ts index 65e7fe4497c7..826652af4cbc 100644 --- a/src/test/datascience/execution.unit.test.ts +++ b/src/test/datascience/execution.unit.test.ts @@ -44,6 +44,7 @@ import { IJupyterKernelSpec, INotebook, INotebookCompletion, + INotebookExecutionLogger, INotebookServer, INotebookServerLaunchInfo, InterruptResult @@ -103,6 +104,10 @@ class MockJupyterNotebook implements INotebook { noop(); } + public addLogger(_logger: INotebookExecutionLogger): void { + noop(); + } + public getSysInfo(): Promise { return Promise.resolve(undefined); } @@ -573,7 +578,7 @@ suite('Jupyter Execution', async () => { when(workspaceService.onDidChangeConfiguration).thenReturn(configChangeEvent.event); when(application.withProgress(anything(), anything())).thenCall((_, cb: (_: any, token: any) => Promise) => { return new Promise((resolve, reject) => { - cb({report: noop}, new CancellationTokenSource().token).then(resolve).catch(reject); + cb({ report: noop }, new CancellationTokenSource().token).then(resolve).catch(reject); }); }); @@ -751,7 +756,7 @@ suite('Jupyter Execution', async () => { reset(application); when(application.withProgress(anything(), anything())).thenCall((_, cb: (_: any, token: any) => Promise) => { return new Promise((resolve, reject) => { - cb({report: noop}, progressCancellation.token).then(resolve).catch(reject); + cb({ report: noop }, progressCancellation.token).then(resolve).catch(reject); }); }); @@ -770,7 +775,7 @@ suite('Jupyter Execution', async () => { reset(application); when(application.withProgress(anything(), anything())).thenCall((_, cb: (_: any, token: any) => Promise) => { return new Promise((resolve, reject) => { - cb({report: noop}, progressCancellation.token).then(resolve).catch(reject); + cb({ report: noop }, progressCancellation.token).then(resolve).catch(reject); }); }); diff --git a/src/test/datascience/gather/gather.unit.test.ts b/src/test/datascience/gather/gather.unit.test.ts index a2a395a95594..ff4e5eba5484 100644 --- a/src/test/datascience/gather/gather.unit.test.ts +++ b/src/test/datascience/gather/gather.unit.test.ts @@ -7,6 +7,7 @@ import * as TypeMoq from 'typemoq'; import { IApplicationShell, ICommandManager } from '../../../client/common/application/types'; import { IConfigurationService, IDataScienceSettings, IDisposableRegistry, IPythonSettings } from '../../../client/common/types'; import { GatherExecution } from '../../../client/datascience/gather/gather'; +import { GatherLogger } from '../../../client/datascience/gather/gatherLogger'; import { ICell as IVscCell } from '../../../client/datascience/types'; // tslint:disable-next-line: max-func-body-length @@ -125,13 +126,14 @@ suite('DataScience code gathering unit tests', () => { configurationService.setup(c => c.getSettings(TypeMoq.It.isAny())).returns(() => pythonSettings.object); appShell.setup(a => a.showInformationMessage(TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => Promise.resolve('')); const gatherExecution = new GatherExecution(configurationService.object, appShell.object, disposableRegistry.object, commandManager.object); + const gatherLogger = new GatherLogger(gatherExecution, configurationService.object); test('Logs a cell execution', async () => { let count = 0; for (const c of codeCells) { - await gatherExecution.postExecute(c, false); + await gatherLogger.postExecute(c, false); count += 1; - assert.equal(gatherExecution.executionSlicer._executionLog.length, count); + assert.equal(gatherExecution.executionSlicer.executionLog.length, count); } }); @@ -139,7 +141,7 @@ suite('DataScience code gathering unit tests', () => { const defaultCellMarker = '# %%'; const cell: IVscCell = codeCells[codeCells.length - 1]; const program = gatherExecution.gatherCode(cell); - const expectedProgram = `# This file contains the minimal amount of code required to produce the code cell you gathered.\n${defaultCellMarker}\nfrom bokeh.plotting import show, figure, output_notebook\n\n${defaultCellMarker}\nx = [1,2,3,4,5]\ny = [21,9,15,17,4]\n\n${defaultCellMarker}\np=figure(title='demo',x_axis_label='x',y_axis_label='y')\n\n${defaultCellMarker}\np.line(x,y,line_width=2)\n\n${defaultCellMarker}\nshow(p)\n`; + const expectedProgram = `# This file contains only the code required to produce the results of the gathered cell.\n${defaultCellMarker}\nfrom bokeh.plotting import show, figure, output_notebook\n\n${defaultCellMarker}\nx = [1,2,3,4,5]\ny = [21,9,15,17,4]\n\n${defaultCellMarker}\np=figure(title='demo',x_axis_label='x',y_axis_label='y')\n\n${defaultCellMarker}\np.line(x,y,line_width=2)\n\n${defaultCellMarker}\nshow(p)\n`; assert.equal(program.trim(), expectedProgram.trim()); }); }); diff --git a/src/test/datascience/interactiveWindow.functional.test.tsx b/src/test/datascience/interactiveWindow.functional.test.tsx index e8e375a45de6..83186959a72f 100644 --- a/src/test/datascience/interactiveWindow.functional.test.tsx +++ b/src/test/datascience/interactiveWindow.functional.test.tsx @@ -577,6 +577,7 @@ for _ in range(50): runMountedTest('Gather code run from text editor', async (wrapper) => { ioc.getSettings().datascience.enableGather = true; + ioc.getSettings().datascience.gatherToScript = true; // Enter some code. const code = `${defaultCellMarker}\na=1\na`; await addCode(ioc, wrapper, code); @@ -590,12 +591,13 @@ for _ in range(50): const docManager = ioc.get(IDocumentManager) as MockDocumentManager; assert.notEqual(docManager.activeTextEditor, undefined); if (docManager.activeTextEditor) { - assert.equal(docManager.activeTextEditor.document.getText(), `# This file contains the minimal amount of code required to produce the code cell you gathered.\n${defaultCellMarker}\na=1\na\n\n`); + assert.equal(docManager.activeTextEditor.document.getText(), `# This file contains only the code required to produce the results of the gathered cell.\n${defaultCellMarker}\na=1\na\n\n`); } }, () => { return ioc; }); runMountedTest('Gather code run from input box', async (wrapper) => { ioc.getSettings().datascience.enableGather = true; + ioc.getSettings().datascience.gatherToScript = true; // Create an interactive window so that it listens to the results. const interactiveWindow = await getOrCreateInteractiveWindow(ioc); await interactiveWindow.show(); @@ -612,7 +614,7 @@ for _ in range(50): const docManager = ioc.get(IDocumentManager) as MockDocumentManager; assert.notEqual(docManager.activeTextEditor, undefined); if (docManager.activeTextEditor) { - assert.equal(docManager.activeTextEditor.document.getText(), `# This file contains the minimal amount of code required to produce the code cell you gathered.\n${defaultCellMarker}\na=1\na\n\n`); + assert.equal(docManager.activeTextEditor.document.getText(), `# This file contains only the code required to produce the results of the gathered cell.\n${defaultCellMarker}\na=1\na\n\n`); } }, () => { return ioc; }); diff --git a/src/test/datascience/nativeEditor.functional.test.tsx b/src/test/datascience/nativeEditor.functional.test.tsx index 76d531e75879..c81140967889 100644 --- a/src/test/datascience/nativeEditor.functional.test.tsx +++ b/src/test/datascience/nativeEditor.functional.test.tsx @@ -202,7 +202,7 @@ for _ in range(50): // find the buttons on the cell itself let cell = getLastOutputCell(wrapper, 'NativeCell'); let ImageButtons = cell.find(ImageButton); - assert.equal(ImageButtons.length, 7, 'Cell buttons not found'); + assert.equal(ImageButtons.length, 8, 'Cell buttons not found'); let deleteButton = ImageButtons.at(6); // Make sure delete works @@ -216,7 +216,7 @@ for _ in range(50): // least one cell in the file. cell = getLastOutputCell(wrapper, 'NativeCell'); ImageButtons = cell.find(ImageButton); - assert.equal(ImageButtons.length, 7, 'Cell buttons not found'); + assert.equal(ImageButtons.length, 8, 'Cell buttons not found'); deleteButton = ImageButtons.at(6); afterDelete = await getNativeCellResults(wrapper, 1, async () => { @@ -344,7 +344,7 @@ for _ in range(50): const cell = getOutputCell(wrapper, 'NativeCell', 1); assert.ok(cell, 'Cannot find the first cell'); const imageButtons = cell!.find(ImageButton); - assert.equal(imageButtons.length, 7, 'Cell buttons not found'); + assert.equal(imageButtons.length, 8, 'Cell buttons not found'); const runButton = imageButtons.findWhere(w => w.props().tooltip === 'Run cell'); assert.equal(runButton.length, 1, 'No run button found'); const update = waitForMessage(ioc, InteractiveWindowMessages.RenderComplete);