From 71598b3c9429ab240aa3cf327fc404e20168061e Mon Sep 17 00:00:00 2001 From: corbob Date: Thu, 18 Jul 2019 07:32:30 -0700 Subject: [PATCH 1/4] Add Download of Snippets. Remove line in downloadPSES.ps1 that doesn't actually do anything ($dir is never set) Add to ignore Snippets directory as we're pulling that from vscode-powershell. --- .gitignore | 1 + build.ps1 | 4 ++++ downloadPSES.ps1 | 2 -- downloadSnippets.ps1 | 25 +++++++++++++++++++++++++ 4 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 downloadSnippets.ps1 diff --git a/.gitignore b/.gitignore index 3728c2a..775858e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ *.zip PowerShellEditorServices/ +Snippets/ .pses node_modules out diff --git a/build.ps1 b/build.ps1 index 10006e7..e0862fd 100644 --- a/build.ps1 +++ b/build.ps1 @@ -19,6 +19,10 @@ if (!(Test-Path "$PSScriptRoot/PowerShellEditorServices")) { & "$PSScriptRoot/downloadPSES.ps1" } +if (!(Test-Path "$PSScriptRoot/Snippets")) { + & "$PSScriptRoot/downloadSnippets.ps1" +} + if (!(Get-Command npm)) { throw "You must install Node.js & npm." } diff --git a/downloadPSES.ps1 b/downloadPSES.ps1 index f73e10a..606a934 100644 --- a/downloadPSES.ps1 +++ b/downloadPSES.ps1 @@ -25,8 +25,6 @@ Write-Host Latest Release: $tag $download = "https://github.com/$repo/releases/download/$tag/$file" $zip = "pses.zip" - -$null = New-Item -Name $dir -ItemType Directory -Force Write-Host Downloading PowerShell Editor Services: $tag Invoke-WebRequest $download -OutFile $zip diff --git a/downloadSnippets.ps1 b/downloadSnippets.ps1 new file mode 100644 index 0000000..9fa54a4 --- /dev/null +++ b/downloadSnippets.ps1 @@ -0,0 +1,25 @@ +#!/usr/bin/env pwsh + +Write-Host Starting download of Snippets from vscode-powershell +if (!$IsCoreCLR) { + # We only need to do this in Windows PowerShell. + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +} + +# Fail on anything +$ErrorActionPreference = "Stop" +# Progress doesn't display properly in vim +$ProgressPreference = "SilentlyContinue" + +Push-Location $PSScriptRoot + +$download = "https://raw.githubusercontent.com/PowerShell/vscode-powershell/master/snippets/PowerShell.json" + +$dir = "$PSScriptRoot/Snippets/" + +$null = New-Item -Path $dir -ItemType Directory -Force +Invoke-WebRequest $download -OutFile "$dir\PowerShell.json" + +Pop-Location + +Write-Host Completed downloading Snippets. From 9871ba5d8fb16ffbd7c16572f73715eb4e81da4b Mon Sep 17 00:00:00 2001 From: corbob Date: Thu, 18 Jul 2019 21:26:13 -0700 Subject: [PATCH 2/4] Add Snippets to package.json --- package.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/package.json b/package.json index 23b7dd2..f513970 100644 --- a/package.json +++ b/package.json @@ -37,9 +37,16 @@ "src/downloadPSES.ps1", "README.md", "LICENSE", + "Snippets", "PowerShellEditorServices" ], "contributes": { + "snippets": [ + { + "language": "ps1", + "path": "Snippets/PowerShell.json" + } + ], "languages": [ { "id": "ps1", From 36490ba2cd810e428558f0317124c54fb4042b89 Mon Sep 17 00:00:00 2001 From: corbob Date: Thu, 25 Jul 2019 12:12:48 -0700 Subject: [PATCH 3/4] Some formatting changes? --- package.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index f513970..57ae307 100644 --- a/package.json +++ b/package.json @@ -37,16 +37,16 @@ "src/downloadPSES.ps1", "README.md", "LICENSE", - "Snippets", + "Snippets", "PowerShellEditorServices" ], "contributes": { - "snippets": [ - { - "language": "ps1", - "path": "Snippets/PowerShell.json" - } - ], + "snippets": [ + { + "language": "ps1", + "path": "Snippets/PowerShell.json" + } + ], "languages": [ { "id": "ps1", From aef8b67612ce518f2f1d3c32220dd4e92b410c41 Mon Sep 17 00:00:00 2001 From: corbob Date: Sat, 27 Jul 2019 10:46:01 -0700 Subject: [PATCH 4/4] Update README to mention snippets. --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 04c1c4a..cdbc350 100644 --- a/README.md +++ b/README.md @@ -38,4 +38,6 @@ let g:coc_global_extensions=[ 'coc-powershell', ... ] ## Recommended plugins -[vim-polyglot](https://github.com/sheerun/vim-polyglot) for syntax highlighting 🎨 +* [coc-snippets](https://github.com/neoclide/coc-snippets) Used to allow snippets [(requires neovim 0.4 or latest vim8)](https://github.com/neoclide/coc.nvim/wiki/F.A.Q#how-to-make-preview-window-shown-aside-with-pum). + * Can be installed with `:CocInstall coc-snippets` +* [vim-polyglot](https://github.com/sheerun/vim-polyglot) for syntax highlighting 🎨