Skip to content

Add LinkEditorServices task for developers #3623

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 1 commit into from
Oct 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ This will compile the TypeScript files in the project to JavaScript files.
Invoke-Build Build
```

As a developer, you may want to use `Invoke-Build LinkEditorServices` to setup a symbolic
link to its modules instead of copying the files. This will mean the built extension will
always have the latest version of your PowerShell Editor Services build, but this cannot
be used to package the extension into a VSIX. So it is a manual step.

### Launching the extension

#### From Visual Studio Code
Expand Down
8 changes: 0 additions & 8 deletions modules/README.md

This file was deleted.

18 changes: 13 additions & 5 deletions vscode-powershell.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ task Restore -If { !(Test-Path "$PSScriptRoot/node_modules") } {

task Clean {
Write-Host "`n### Cleaning vscode-powershell`n" -ForegroundColor Green
Remove-Item ./modules -Exclude "README.md" -Recurse -Force -ErrorAction Ignore
Remove-Item ./modules -Recurse -Force -ErrorAction Ignore
Remove-Item ./out -Recurse -Force -ErrorAction Ignore
Remove-Item ./node_modules -Recurse -Force -ErrorAction Ignore
}
Expand All @@ -57,9 +57,15 @@ task BuildEditorServices -If (Get-EditorServicesPath) {
Invoke-Build Build (Get-EditorServicesPath)
}

task CopyEditorServices -If { !(Test-Path ./modules/PowerShellEditorServices) -and (Get-EditorServicesPath) } BuildEditorServices, {
Write-Host "`n### Copying PowerShellEditorServices module files" -ForegroundColor Green
Copy-Item -Recurse -Force "$(Split-Path (Get-EditorServicesPath))/module/*" ./modules
task LinkEditorServices -If (Get-EditorServicesPath) BuildEditorServices, {
Write-Host "`n### For developer use only! Creating symbolic link to PSES" -ForegroundColor Green
Remove-Item ./modules -Recurse -Force -ErrorAction Ignore
New-Item -ItemType SymbolicLink -Path ./modules -Target "$(Split-Path (Get-EditorServicesPath))/module"
}

task CopyEditorServices -If { !(Test-Path ./modules) -and (Get-EditorServicesPath) } BuildEditorServices, {
Write-Host "`n### Copying PSES" -ForegroundColor Green
Copy-Item -Recurse -Force "$(Split-Path (Get-EditorServicesPath))/module" ./modules
}

task Build CopyEditorServices, Restore, {
Expand Down Expand Up @@ -111,7 +117,9 @@ task UpdateReadme -If { $script:IsPreviewExtension } {
}

task Package UpdateReadme, Build, {
assert { Test-Path ./modules/PowerShellEditorServices }
assert (Test-Path ./modules/PowerShellEditorServices)
assert ((Get-Item ./modules).LinkType -ne "SymbolicLink") "Packaging requires a copy of PSES, not a symlink!"

Write-Host "`n### Packaging $($script:PackageJson.name)-$($script:PackageJson.version).vsix`n" -ForegroundColor Green
exec { & npm run package }
}
Expand Down