Skip to content

Release v1.4.2 #1023

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 11 commits into from
Sep 6, 2017
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ vscode-powershell.zip
vscps-preview.zip
*.vsix
npm-debug.log
.vscode-test/
15 changes: 13 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"args": [ "--extensionDevelopmentPath=${workspaceRoot}" ],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": ["${workspaceRoot}/out"],
"outFiles": ["${workspaceRoot}/out/src/**/*.js"],
"preLaunchTask": "BuildAll"
},
{
Expand All @@ -20,7 +20,18 @@
"args": [ "--extensionDevelopmentPath=${workspaceRoot}" ],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": ["${workspaceRoot}/out"],
"outFiles": ["${workspaceRoot}/out/src/**/*.js"],
"preLaunchTask": "Build"
},
{
"name": "Launch Extension Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/out/test" ],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": ["${workspaceRoot}/out/test/**/*.js"],
"preLaunchTask": "Build"
},
{
Expand Down
36 changes: 30 additions & 6 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"version": "2.0.0",

"windows": {
"command": "${env:windir}\\sysnative\\WindowsPowerShell\\v1.0\\powershell.exe",
"command": "${env:windir}/System32/WindowsPowerShell/v1.0/powershell.exe",
"args": [ "-NoProfile", "-ExecutionPolicy", "Bypass" ]
},
"linux": {
Expand All @@ -20,28 +20,52 @@
{
"taskName": "Install",
"suppressTaskName": true,
"args": [ "Invoke-Build Restore" ]
"args": [
"Invoke-Build Restore"
]
},
{
"taskName": "CleanAll",
"suppressTaskName": true,
"args": [ "Invoke-Build CleanAll" ]
"args": [
"Invoke-Build CleanAll"
]
},
{
"taskName": "Clean",
"suppressTaskName": true,
"args": [ "Invoke-Build Clean" ]
"args": [
"Invoke-Build Clean"
]
},
{
"taskName": "BuildAll",
"suppressTaskName": true,
"isBuildCommand": true,
"args": [ "Invoke-Build BuildAll" ]
"args": [
"Invoke-Build BuildAll"
],
"problemMatcher": []
},
{
"taskName": "Build",
"suppressTaskName": true,
"args": [ "Invoke-Build Build" ]
"args": [
"Invoke-Build Build"
],
"problemMatcher": []
},
{
"taskName": "Test",
"suppressTaskName": true,
"args": [
"Invoke-Build Test"
],
"group": {
"kind": "test",
"isDefault": true
},
"problemMatcher": []
}
]
}
3 changes: 3 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.vscode/**
.vscode-test/**
vscode-powershell.build.ps1
typings/**
**/*.ts
Expand All @@ -10,5 +11,7 @@ bin/DebugAdapter.log
bin/*.vshost.*
bin/PowerShell/**
logs/**
out/test/**
test/**
sessions/**
scripts/Install-VSCode.ps1
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# vscode-powershell Release History

## 1.4.2
### Tuesday, September 5, 2017

- [#993](https://github.com/PowerShell/vscode-powershell/issues/993) -
`powershell.powerShellExePath` using Sysnative path should be automatically
corrected when using 64-bit Visual Studio Code
- [#1008](https://github.com/PowerShell/vscode-powershell/issues/1008) -
Windows PowerShell versions (x64 and x86) are not enumerated correctly
when using 64-bit Visual Studio Code
- [#1009](https://github.com/PowerShell/vscode-powershell/issues/1009) -
PowerShell version indicator in status bar is missing tooltip
- [#1020](https://github.com/PowerShell/vscode-powershell/issues/1020) -
"Show Session Menu", "Show Integrated Console", and "Restart Current Session"
commands should cause PowerShell extension to be activated

## 1.4.1
### Thursday, June 22, 2017
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '1.4.1-insiders-{build}'
version: '1.4.2-insiders-{build}'
image: Visual Studio 2017
clone_depth: 10
skip_tags: true
Expand Down
2 changes: 1 addition & 1 deletion examples/.vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

// Start PowerShell
"windows": {
"command": "${env:windir}\\sysnative\\WindowsPowerShell\\v1.0\\powershell.exe",
"command": "${env:windir}/System32/WindowsPowerShell/v1.0/powershell.exe",
"args": [ "-NoProfile", "-ExecutionPolicy", "Bypass" ]
},
"linux": {
Expand Down
17 changes: 11 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "PowerShell",
"displayName": "PowerShell",
"version": "1.4.1",
"version": "1.4.2",
"publisher": "ms-vscode",
"description": "Develop PowerShell scripts in Visual Studio Code!",
"engines": {
Expand All @@ -24,15 +24,17 @@
"type": "git",
"url": "https://github.com/PowerShell/vscode-powershell.git"
},
"main": "./out/main",
"main": "./out/src/main",
"activationEvents": [
"onLanguage:powershell",
"onCommand:PowerShell.NewProjectFromTemplate",
"onCommand:PowerShell.OpenExamplesFolder",
"onCommand:PowerShell.StartDebugSession",
"onCommand:PowerShell.PickPSHostProcess",
"onCommand:PowerShell.SpecifyScriptArgs",
"onCommand:PowerShell.ShowSessionConsole"
"onCommand:PowerShell.ShowSessionConsole",
"onCommand:PowerShell.ShowSessionMenu",
"onCommand:PowerShell.RestartSession"
],
"dependencies": {
"vscode-languageclient": "3.3.0-alpha.6"
Expand All @@ -41,15 +43,18 @@
"@types/node": "^6.0.40",
"typescript": "^2.0.3",
"vsce": "^1.18.0",
"vscode": "^1.1.0"
"vscode": "^1.1.0",
"mocha": "^2.3.3",
"@types/mocha": "^2.2.32"
},
"extensionDependencies": [
"vscode.powershell"
],
"scripts": {
"compile": "tsc -p ./",
"compile-watch": "tsc -watch -p ./",
"postinstall": "node ./node_modules/vscode/bin/install"
"postinstall": "node ./node_modules/vscode/bin/install",
"test": "node ./node_modules/vscode/bin/test"
},
"contributes": {
"keybindings": [
Expand Down Expand Up @@ -188,7 +193,7 @@
"powershell"
]
},
"program": "./out/debugAdapter.js",
"program": "./out/src/debugAdapter.js",
"runtime": "node",
"variables": {
"PickPSHostProcess": "PowerShell.PickPSHostProcess",
Expand Down
2 changes: 1 addition & 1 deletion src/debugAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Logger } from './logging';
// named pipes or a network protocol). It is purely a naive data
// relay between the two transports.

var logBasePath = path.resolve(__dirname, "../logs");
var logBasePath = path.resolve(__dirname, "../../logs");

var debugAdapterLogWriter =
fs.createWriteStream(
Expand Down
82 changes: 57 additions & 25 deletions src/features/DocumentFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
} from 'vscode-languageclient';
import { TextDocumentIdentifier } from "vscode-languageserver-types";
import Window = vscode.window;
import { Logger } from '../logging';
import { IFeature } from '../feature';
import * as Settings from '../settings';
import * as Utils from '../utils';
Expand Down Expand Up @@ -130,22 +131,60 @@ class PSDocumentFormattingEditProvider implements
return Promise.resolve(TextEdit[0]);
}

constructor() {
constructor(private logger: Logger) {
}

provideDocumentFormattingEdits(
document: TextDocument,
options: FormattingOptions,
token: CancellationToken): TextEdit[] | Thenable<TextEdit[]> {
return this.provideDocumentRangeFormattingEdits(document, null, options, token);
}

this.logger.writeVerbose(`Formatting entire document - ${document.uri}...`)
return this.sendDocumentFormatRequest(document, null, options, token);
}

provideDocumentRangeFormattingEdits(
document: TextDocument,
range: Range,
options: FormattingOptions,
token: CancellationToken): TextEdit[] | Thenable<TextEdit[]> {

this.logger.writeVerbose(`Formatting document range ${JSON.stringify(range)} - ${document.uri}...`)
return this.sendDocumentFormatRequest(document, range, options, token);
}

provideOnTypeFormattingEdits(
document: TextDocument,
position: Position,
ch: string,
options: FormattingOptions,
token: CancellationToken): TextEdit[] | Thenable<TextEdit[]> {

this.logger.writeVerbose(`Formatting on type at position ${JSON.stringify(position)} - ${document.uri}...`)

return this.getScriptRegion(document, position, ch).then(scriptRegion => {
if (scriptRegion === null) {
this.logger.writeVerbose("No formattable range returned.");
return this.emptyPromise;
}

return this.sendDocumentFormatRequest(
document,
toRange(scriptRegion),
options,
token);
},
(err) => {
this.logger.writeVerbose(`Error while requesting script region for formatting: ${err}`)
});
}

private sendDocumentFormatRequest(
document: TextDocument,
range: Range,
options: FormattingOptions,
token: CancellationToken): TextEdit[] | Thenable<TextEdit[]> {

let editor: TextEditor = this.getEditor(document);
if (editor === undefined) {
return this.emptyPromise;
Expand All @@ -157,7 +196,6 @@ class PSDocumentFormattingEditProvider implements
return this.emptyPromise;
}


// somehow range object gets serialized to an array of Position objects,
// so we need to use the object literal syntax to initialize it.
let rangeParam = null;
Expand All @@ -180,31 +218,25 @@ class PSDocumentFormattingEditProvider implements
options: this.getEditorSettings()
};

let formattingStartTime = new Date().valueOf();
function getFormattingDuration() {
return ((new Date().valueOf()) - formattingStartTime) / 1000;
}

let textEdits = this.languageClient.sendRequest(
DocumentRangeFormattingRequest.type,
requestParams);
this.lockDocument(document, textEdits);
PSDocumentFormattingEditProvider.showStatusBar(document, textEdits);
return textEdits;
}

provideOnTypeFormattingEdits(
document: TextDocument,
position: Position,
ch: string,
options: FormattingOptions,
token: CancellationToken): TextEdit[] | Thenable<TextEdit[]> {
return this.getScriptRegion(document, position, ch).then(scriptRegion => {
if (scriptRegion === null) {
return this.emptyPromise;
}

return this.provideDocumentRangeFormattingEdits(
document,
toRange(scriptRegion),
options,
token);
});
return textEdits.then(
(edits) => {
this.logger.writeVerbose(`Document formatting finished in ${getFormattingDuration()}s`);
return edits;
},
(err) => {
this.logger.writeVerbose(`Document formatting failed in ${getFormattingDuration()}: ${err}`);
});
}

setLanguageClient(languageClient: LanguageClient): void {
Expand Down Expand Up @@ -284,8 +316,8 @@ export class DocumentFormatterFeature implements IFeature {
private languageClient: LanguageClient;
private documentFormattingEditProvider: PSDocumentFormattingEditProvider;

constructor() {
this.documentFormattingEditProvider = new PSDocumentFormattingEditProvider();
constructor(private logger: Logger) {
this.documentFormattingEditProvider = new PSDocumentFormattingEditProvider(logger);
this.formattingEditProvider = vscode.languages.registerDocumentFormattingEditProvider(
"powershell",
this.documentFormattingEditProvider);
Expand Down
2 changes: 1 addition & 1 deletion src/features/Examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class ExamplesFeature implements IFeature {
private examplesPath: string;

constructor() {
this.examplesPath = path.resolve(__dirname, "../../examples");
this.examplesPath = path.resolve(__dirname, "../../../examples");
this.command = vscode.commands.registerCommand('PowerShell.OpenExamplesFolder', () => {
vscode.commands.executeCommand(
"vscode.openFolder",
Expand Down
Loading