@@ -16,13 +16,15 @@ import utils = require("./utils");
1616import {
1717 CloseAction , DocumentSelector , ErrorAction , LanguageClientOptions ,
1818 Middleware , NotificationType , RequestType0 ,
19- ResolveCodeLensSignature , RevealOutputChannelOn } from "vscode-languageclient" ;
19+ ResolveCodeLensSignature , RevealOutputChannelOn
20+ } from "vscode-languageclient" ;
2021import { LanguageClient , StreamInfo } from "vscode-languageclient/node" ;
2122
2223import { GitHubReleaseInformation , InvokePowerShellUpdateCheck } from "./features/UpdatePowerShell" ;
2324import {
2425 getPlatformDetails , IPlatformDetails , IPowerShellExeDetails ,
25- OperatingSystem , PowerShellExeFinder } from "./platform" ;
26+ OperatingSystem , PowerShellExeFinder
27+ } from "./platform" ;
2628import { LanguageClientConsumer } from "./languageClientConsumer" ;
2729
2830export enum SessionStatus {
@@ -287,20 +289,6 @@ export class SessionManager implements Middleware {
287289 return vscode . Uri . joinPath ( this . sessionsFolder , "PSES-VSCode-" + process . env . VSCODE_PID + "-" + uniqueId + ".json" ) ;
288290 }
289291
290- public static readSessionFile ( sessionFilePath : vscode . Uri ) : IEditorServicesSessionDetails {
291- // TODO: Use vscode.workspace.fs.readFile instead of fs.readFileSync.
292- const fileContents = fs . readFileSync ( sessionFilePath . fsPath , "utf-8" ) ;
293- return JSON . parse ( fileContents ) ;
294- }
295-
296- public static async deleteSessionFile ( sessionFilePath : vscode . Uri ) {
297- try {
298- await vscode . workspace . fs . delete ( sessionFilePath ) ;
299- } catch ( e ) {
300- // TODO: Be more specific about what we're catching
301- }
302- }
303-
304292 public createDebugSessionProcess ( sessionSettings : Settings . ISettings ) : PowerShellProcess {
305293
306294 // NOTE: We only support one temporary integrated console at a time. To
@@ -337,7 +325,7 @@ export class SessionManager implements Middleware {
337325 }
338326
339327 public async waitUntilStarted ( ) : Promise < void > {
340- while ( ! this . started ) {
328+ while ( ! this . started ) {
341329 await utils . sleep ( 300 ) ;
342330 }
343331 }
@@ -348,43 +336,43 @@ export class SessionManager implements Middleware {
348336 codeLens : vscode . CodeLens ,
349337 token : vscode . CancellationToken ,
350338 next : ResolveCodeLensSignature ) : vscode . ProviderResult < vscode . CodeLens > {
351- const resolvedCodeLens = next ( codeLens , token ) ;
352- const resolveFunc =
353- ( codeLensToFix : vscode . CodeLens ) : vscode . CodeLens => {
354- if ( codeLensToFix . command ?. command === "editor.action.showReferences" ) {
355- const oldArgs = codeLensToFix . command . arguments ;
356-
357- // Our JSON objects don't get handled correctly by
358- // VS Code's built in editor.action.showReferences
359- // command so we need to convert them into the
360- // appropriate types to send them as command
361- // arguments.
362-
363- codeLensToFix . command . arguments = [
364- vscode . Uri . parse ( oldArgs [ 0 ] ) ,
365- new vscode . Position ( oldArgs [ 1 ] . line , oldArgs [ 1 ] . character ) ,
366- oldArgs [ 2 ] . map ( ( position ) => {
367- return new vscode . Location (
368- vscode . Uri . parse ( position . uri ) ,
369- new vscode . Range (
370- position . range . start . line ,
371- position . range . start . character ,
372- position . range . end . line ,
373- position . range . end . character ) ) ;
374- } ) ,
375- ] ;
376- }
339+ const resolvedCodeLens = next ( codeLens , token ) ;
340+ const resolveFunc =
341+ ( codeLensToFix : vscode . CodeLens ) : vscode . CodeLens => {
342+ if ( codeLensToFix . command ?. command === "editor.action.showReferences" ) {
343+ const oldArgs = codeLensToFix . command . arguments ;
344+
345+ // Our JSON objects don't get handled correctly by
346+ // VS Code's built in editor.action.showReferences
347+ // command so we need to convert them into the
348+ // appropriate types to send them as command
349+ // arguments.
350+
351+ codeLensToFix . command . arguments = [
352+ vscode . Uri . parse ( oldArgs [ 0 ] ) ,
353+ new vscode . Position ( oldArgs [ 1 ] . line , oldArgs [ 1 ] . character ) ,
354+ oldArgs [ 2 ] . map ( ( position ) => {
355+ return new vscode . Location (
356+ vscode . Uri . parse ( position . uri ) ,
357+ new vscode . Range (
358+ position . range . start . line ,
359+ position . range . start . character ,
360+ position . range . end . line ,
361+ position . range . end . character ) ) ;
362+ } ) ,
363+ ] ;
364+ }
377365
378- return codeLensToFix ;
379- } ;
366+ return codeLensToFix ;
367+ } ;
380368
381- if ( ( resolvedCodeLens as Thenable < vscode . CodeLens > ) . then ) {
382- return ( resolvedCodeLens as Thenable < vscode . CodeLens > ) . then ( resolveFunc ) ;
383- } else if ( resolvedCodeLens as vscode . CodeLens ) {
384- return resolveFunc ( resolvedCodeLens as vscode . CodeLens ) ;
385- }
369+ if ( ( resolvedCodeLens as Thenable < vscode . CodeLens > ) . then ) {
370+ return ( resolvedCodeLens as Thenable < vscode . CodeLens > ) . then ( resolveFunc ) ;
371+ } else if ( resolvedCodeLens as vscode . CodeLens ) {
372+ return resolveFunc ( resolvedCodeLens as vscode . CodeLens ) ;
373+ }
386374
387- return resolvedCodeLens ;
375+ return resolvedCodeLens ;
388376 }
389377
390378 // Move old setting codeFormatting.whitespaceAroundPipe to new setting codeFormatting.addWhitespaceAroundPipe
@@ -440,9 +428,9 @@ export class SessionManager implements Middleware {
440428 this . sessionSettings . cwd . toLowerCase ( ) ||
441429 settings . powerShellDefaultVersion . toLowerCase ( ) !==
442430 this . sessionSettings . powerShellDefaultVersion . toLowerCase ( ) ||
443- settings . developer . editorServicesLogLevel . toLowerCase ( ) !==
431+ settings . developer . editorServicesLogLevel . toLowerCase ( ) !==
444432 this . sessionSettings . developer . editorServicesLogLevel . toLowerCase ( ) ||
445- settings . developer . bundledModulesPath . toLowerCase ( ) !==
433+ settings . developer . bundledModulesPath . toLowerCase ( ) !==
446434 this . sessionSettings . developer . bundledModulesPath . toLowerCase ( ) ||
447435 settings . integratedConsole . useLegacyReadLine !==
448436 this . sessionSettings . integratedConsole . useLegacyReadLine ) ) {
@@ -451,9 +439,9 @@ export class SessionManager implements Middleware {
451439 "The PowerShell runtime configuration has changed, would you like to start a new session?" ,
452440 "Yes" , "No" ) ;
453441
454- if ( response === "Yes" ) {
455- await this . restartSession ( ) ;
456- }
442+ if ( response === "Yes" ) {
443+ await this . restartSession ( ) ;
444+ }
457445 }
458446 }
459447
@@ -567,7 +555,7 @@ export class SessionManager implements Middleware {
567555 "connect" ,
568556 ( ) => {
569557 this . log . write ( "Language service connected." ) ;
570- resolve ( { writer : socket , reader : socket } ) ;
558+ resolve ( { writer : socket , reader : socket } ) ;
571559 } ) ;
572560 } ) ;
573561 } ;
@@ -576,7 +564,7 @@ export class SessionManager implements Middleware {
576564 documentSelector : this . documentSelector ,
577565 synchronize : {
578566 // backend uses "files" and "search" to ignore references.
579- configurationSection : [ utils . PowerShellLanguageId , "files" , "search" ] ,
567+ configurationSection : [ utils . PowerShellLanguageId , "files" , "search" ] ,
580568 // fileEvents: vscode.workspace.createFileSystemWatcher('**/.eslintrc')
581569 } ,
582570 // NOTE: Some settings are only applicable on startup, so we send them during initialization.
@@ -819,8 +807,8 @@ export class SessionManager implements Middleware {
819807 case SessionStatus . NeverStarted :
820808 case SessionStatus . Stopping :
821809 const currentPowerShellExe =
822- availablePowerShellExes
823- . find ( ( item ) => item . displayName . toLowerCase ( ) === this . PowerShellExeDetails . displayName . toLowerCase ( ) ) ;
810+ availablePowerShellExes
811+ . find ( ( item ) => item . displayName . toLowerCase ( ) === this . PowerShellExeDetails . displayName . toLowerCase ( ) ) ;
824812
825813 const powerShellSessionName =
826814 currentPowerShellExe ?
@@ -887,7 +875,7 @@ class SessionMenuItem implements vscode.QuickPickItem {
887875 constructor (
888876 public readonly label : string ,
889877 // tslint:disable-next-line:no-empty
890- public readonly callback : ( ) => void = ( ) => { } ) {
878+ public readonly callback : ( ) => void = ( ) => { } ) {
891879 }
892880}
893881
0 commit comments