Skip to content

Initial Notebook UI Mode in VS Code Insiders #2789

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 36 commits into from
Jul 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
20e37d0
initial changes
TylerLeonhardt Apr 10, 2020
899b406
add activation event
TylerLeonhardt Apr 15, 2020
09a1856
add block comment support
TylerLeonhardt Apr 26, 2020
0d1faa1
add saveMarkdownCellsAs setting
TylerLeonhardt Apr 27, 2020
21ff764
set metadata in new cells on save
TylerLeonhardt Apr 28, 2020
8f8d9aa
actually work across files
TylerLeonhardt Apr 28, 2020
92a56d8
updated API with metadata
TylerLeonhardt May 15, 2020
4de2e62
refactor based on option and new Kernel type
TylerLeonhardt Jun 30, 2020
79e67b5
add github action and proposed
TylerLeonhardt Jul 1, 2020
0d51a03
add pwsh
TylerLeonhardt Jul 1, 2020
e4dd761
remove old
TylerLeonhardt Jul 1, 2020
1e06c3a
trigger PR
TylerLeonhardt Jul 1, 2020
00d18e4
add log
TylerLeonhardt Jul 1, 2020
c2d5ee8
force cron to trigger
TylerLeonhardt Jul 1, 2020
20b4639
time
TylerLeonhardt Jul 1, 2020
3179eba
time
TylerLeonhardt Jul 1, 2020
1d177cd
time
TylerLeonhardt Jul 1, 2020
ba409a7
better titles
TylerLeonhardt Jul 1, 2020
679e0fc
powershell comments
TylerLeonhardt Jul 1, 2020
7ca3cca
remove not needed comments
TylerLeonhardt Jul 1, 2020
6314f6e
use githubrunnumber
TylerLeonhardt Jul 1, 2020
be22cf1
use run_id
TylerLeonhardt Jul 1, 2020
b832aa9
Update Notebook dts (#3)
github-actions[bot] Jul 1, 2020
f33ca03
better check for registering
TylerLeonhardt Jul 1, 2020
2bf0340
Update Notebook dts (#4)
github-actions[bot] Jul 9, 2020
4a0b2d7
rob's feedback
TylerLeonhardt Jul 10, 2020
b5d080f
Add a few tests
TylerLeonhardt Jul 10, 2020
ec109bd
added save test
TylerLeonhardt Jul 13, 2020
a0a1c2c
move to utils.sleep
TylerLeonhardt Jul 13, 2020
33cdaee
fix regex
TylerLeonhardt Jul 13, 2020
41aa71a
add logger
TylerLeonhardt Jul 13, 2020
85e6926
Codacy part 1
TylerLeonhardt Jul 13, 2020
ffe92d2
Codacy part 2
TylerLeonhardt Jul 13, 2020
41498dd
Update Notebook dts (#5)
github-actions[bot] Jul 13, 2020
ea67540
move GitHub Action to use master
TylerLeonhardt Jul 14, 2020
b2d179a
Merge branch 'notebook-ui-support' of github.com:TylerLeonhardt/vscod…
TylerLeonhardt Jul 14, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions .github/workflows/updateNotebookApi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: "Update Notebook API"

on:
push:
pull_request:
schedule:
- cron: 0 22 * * *

jobs:
Update-Notebook-Api:

runs-on: ubuntu-latest
defaults:
run:
shell: pwsh

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Setup Node.js environment
uses: actions/[email protected]

- name: Rename proposed dts to old
run: Move-Item ./vscode.proposed.d.ts ./old.vscode.proposed.d.ts

- name: npm install
run: npm install

- name: Get latest proposed dts
run: npm run download-api

- name: Generate new dts and compare it with the old one
run: |
# This will contain the content of our new file
$fullFile = [System.Collections.Generic.List[string]]@()
$dts = Get-Content ./vscode.proposed.d.ts

# First add everything up to the declare statement
$index = 0
while ($dts[$index] -notmatch "declare module 'vscode' {") {
$fullFile += $dts[$index]
$index++
}

# Add the declare statement
$fullFile += $dts[$index]

# Find the Notebook region start index
for ( $i = $index; $i -lt $dts.Length; $i++) {
if($dts[$i] -match '//#region @rebornix: Notebook') {
$index = $i
break
}
}

# Add everything until the endregion to the new file
while ($dts[$index] -notmatch "//#endregion") {
$fullFile += $dts[$index]
$index++
}

# Add the endregion line and ending brace line
$fullFile += $dts[$index]
$fullFile += '}'

# Overwrite the file with the new content
$fullFile | Set-Content ./vscode.proposed.d.ts

# Get the old and new files' raw text
$oldFile = Get-Content ./old.vscode.proposed.d.ts -Raw
$newFile = Get-Content ./vscode.proposed.d.ts -Raw

# Compare them and log if they are different
if($oldFile -ne $newFile) {
Write-Host "New changes detected!"
}

# Remove the old file so it doesn't get picked up by tsc
Remove-Item ./old.vscode.proposed.d.ts -Force

- name: Compile the TypeScript to check for errors
run: npm run compile

- name: Create Pull Request
if: github.event_name == 'schedule'
id: cpr
uses: peter-evans/create-pull-request@v2
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
commit-message: "Update Notebook dts"
committer: GitHub <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
title: "Update Notebook dts"
assignees: TylerLeonhardt
reviewers: TylerLeonhardt
base: master
draft: false
branch: powershell-notebook-patch-${{ github.run_id }}
labels: Created_by_Action
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ npm-debug.log
.vscode-test/
*.DS_Store
test-results.xml
vscode.d.ts
6 changes: 5 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--disable-extensions",
"--enable-proposed-api", "ms-vscode.powershell-preview",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/testRunner.js" ],
"--extensionTestsPath=${workspaceFolder}/out/test/testRunner.js",
"${workspaceFolder}/test"
],
"outFiles": ["${workspaceFolder}/out/**/*.js"],
"preLaunchTask": "Build"
}
Expand Down
76 changes: 70 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

70 changes: 64 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"publisher": "ms-vscode",
"description": "(Preview) Develop PowerShell scripts in Visual Studio Code!",
"engines": {
"vscode": "^1.43.0"
"vscode": "^1.44.0"
},
"license": "SEE LICENSE IN LICENSE.txt",
"homepage": "https://github.com/PowerShell/vscode-powershell/blob/master/README.md",
Expand All @@ -26,6 +26,7 @@
"url": "https://github.com/PowerShell/vscode-powershell.git"
},
"main": "./out/src/main",
"enableProposedApi": true,
"activationEvents": [
"onDebugInitialConfigurations",
"onDebugResolve:PowerShell",
Expand All @@ -43,7 +44,8 @@
"onCommand:PowerShell.RegisterExternalExtension",
"onCommand:PowerShell.UnregisterExternalExtension",
"onCommand:PowerShell.GetPowerShellVersionDetails",
"onView:PowerShellCommands"
"onView:PowerShellCommands",
"onNotebookEditor:PowerShellNotebookMode"
],
"dependencies": {
"node-fetch": "^2.6.0",
Expand All @@ -56,13 +58,13 @@
"@types/glob": "^7.1.2",
"@types/mocha": "~7.0.2",
"@types/mock-fs": "~4.10.0",
"@types/node": "~12.12.39",
"@types/node": "~14.0.22",
"@types/node-fetch": "~2.5.7",
"@types/rewire": "~2.5.28",
"@types/semver": "~7.2.0",
"@types/sinon": "~9.0.4",
"@types/uuid": "^8.0.0",
"@types/vscode": "1.43.0",
"@types/vscode": "1.44.0",
"mocha": "~5.2.0",
"mocha-junit-reporter": "~2.0.0",
"mocha-multi-reporters": "~1.1.7",
Expand All @@ -72,15 +74,17 @@
"tslint": "~6.1.2",
"typescript": "~3.9.3",
"vsce": "~1.77.0",
"vscode-test": "~1.4.0"
"vscode-test": "~1.4.0",
"vscode-dts": "~0.3.1"
},
"extensionDependencies": [
"vscode.powershell"
],
"scripts": {
"compile": "tsc -v && tsc -p ./ && tslint -p ./",
"compile-watch": "tsc -watch -p ./",
"test": "node ./out/test/runTests.js"
"test": "node ./out/test/runTests.js",
"download-api": "vscode-dts dev"
},
"contributes": {
"breakpoints": [
Expand All @@ -106,6 +110,18 @@
}
]
},
"notebookProvider": [
{
"viewType": "PowerShellNotebookMode",
"displayName": "Powershell Notebook",
"selector": [
{
"filenamePattern": "*.ps1"
}
],
"priority": "option"
}
],
"keybindings": [
{
"command": "PowerShell.ShowHelp",
Expand Down Expand Up @@ -201,6 +217,24 @@
"dark": "resources/dark/play.svg"
}
},
{
"command": "PowerShell.ShowNotebookMode",
"title": "(Preview) Show Notebook Mode",
"category": "PowerShell",
"icon": {
"light": "resources/light/book.svg",
"dark": "resources/dark/book.svg"
}
},
{
"command": "PowerShell.HideNotebookMode",
"title": "Show Text Editor",
"category": "PowerShell",
"icon": {
"light": "resources/light/file-code.svg",
"dark": "resources/dark/file-code.svg"
}
},
{
"command": "PowerShell.RestartSession",
"title": "Restart Current Session",
Expand Down Expand Up @@ -376,6 +410,16 @@
"when": "editorLangId == powershell && config.powershell.buttons.showRunButtons",
"command": "PowerShell.RunSelection",
"group": "navigation@101"
},
{
"when": "editorLangId == powershell && config.powershell.notebooks.showToggleButton",
"command": "PowerShell.ShowNotebookMode",
"group": "navigation@102"
},
{
"when": "resourceLangId == powershell && notebookEditorFocused",
"command": "PowerShell.HideNotebookMode",
"group": "navigation@102"
}
],
"editor/title/context": [
Expand Down Expand Up @@ -881,6 +925,20 @@
"type": "boolean",
"default": false,
"description": "Show buttons in the editor titlebar for moving the panel around."
},
"powershell.notebooks.showToggleButton": {
"type": "boolean",
"default": false,
"description": "Controls whether we show or hide the buttons to toggle Notebook mode in the top right."
},
"powershell.notebooks.saveMarkdownCellsAs": {
"type": "string",
"enum": [
"BlockComment",
"LineComment"
],
"default": "BlockComment",
"description": "Controls what new markdown cells in Notebook Mode get saved as in the PowerShell file."
}
}
},
Expand Down
3 changes: 3 additions & 0 deletions resources/dark/book.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions resources/dark/file-code.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions resources/light/book.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions resources/light/file-code.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading