@@ -16,13 +16,15 @@ import utils = require("./utils");
16
16
import {
17
17
CloseAction , DocumentSelector , ErrorAction , LanguageClientOptions ,
18
18
Middleware , NotificationType , RequestType0 ,
19
- ResolveCodeLensSignature , RevealOutputChannelOn } from "vscode-languageclient" ;
19
+ ResolveCodeLensSignature , RevealOutputChannelOn
20
+ } from "vscode-languageclient" ;
20
21
import { LanguageClient , StreamInfo } from "vscode-languageclient/node" ;
21
22
22
23
import { GitHubReleaseInformation , InvokePowerShellUpdateCheck } from "./features/UpdatePowerShell" ;
23
24
import {
24
25
getPlatformDetails , IPlatformDetails , IPowerShellExeDetails ,
25
- OperatingSystem , PowerShellExeFinder } from "./platform" ;
26
+ OperatingSystem , PowerShellExeFinder
27
+ } from "./platform" ;
26
28
import { LanguageClientConsumer } from "./languageClientConsumer" ;
27
29
28
30
export enum SessionStatus {
@@ -287,20 +289,6 @@ export class SessionManager implements Middleware {
287
289
return vscode . Uri . joinPath ( this . sessionsFolder , "PSES-VSCode-" + process . env . VSCODE_PID + "-" + uniqueId + ".json" ) ;
288
290
}
289
291
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
-
304
292
public createDebugSessionProcess ( sessionSettings : Settings . ISettings ) : PowerShellProcess {
305
293
306
294
// NOTE: We only support one temporary integrated console at a time. To
@@ -337,7 +325,7 @@ export class SessionManager implements Middleware {
337
325
}
338
326
339
327
public async waitUntilStarted ( ) : Promise < void > {
340
- while ( ! this . started ) {
328
+ while ( ! this . started ) {
341
329
await utils . sleep ( 300 ) ;
342
330
}
343
331
}
@@ -348,43 +336,43 @@ export class SessionManager implements Middleware {
348
336
codeLens : vscode . CodeLens ,
349
337
token : vscode . CancellationToken ,
350
338
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
+ }
377
365
378
- return codeLensToFix ;
379
- } ;
366
+ return codeLensToFix ;
367
+ } ;
380
368
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
+ }
386
374
387
- return resolvedCodeLens ;
375
+ return resolvedCodeLens ;
388
376
}
389
377
390
378
// Move old setting codeFormatting.whitespaceAroundPipe to new setting codeFormatting.addWhitespaceAroundPipe
@@ -440,9 +428,9 @@ export class SessionManager implements Middleware {
440
428
this . sessionSettings . cwd . toLowerCase ( ) ||
441
429
settings . powerShellDefaultVersion . toLowerCase ( ) !==
442
430
this . sessionSettings . powerShellDefaultVersion . toLowerCase ( ) ||
443
- settings . developer . editorServicesLogLevel . toLowerCase ( ) !==
431
+ settings . developer . editorServicesLogLevel . toLowerCase ( ) !==
444
432
this . sessionSettings . developer . editorServicesLogLevel . toLowerCase ( ) ||
445
- settings . developer . bundledModulesPath . toLowerCase ( ) !==
433
+ settings . developer . bundledModulesPath . toLowerCase ( ) !==
446
434
this . sessionSettings . developer . bundledModulesPath . toLowerCase ( ) ||
447
435
settings . integratedConsole . useLegacyReadLine !==
448
436
this . sessionSettings . integratedConsole . useLegacyReadLine ) ) {
@@ -451,9 +439,9 @@ export class SessionManager implements Middleware {
451
439
"The PowerShell runtime configuration has changed, would you like to start a new session?" ,
452
440
"Yes" , "No" ) ;
453
441
454
- if ( response === "Yes" ) {
455
- await this . restartSession ( ) ;
456
- }
442
+ if ( response === "Yes" ) {
443
+ await this . restartSession ( ) ;
444
+ }
457
445
}
458
446
}
459
447
@@ -567,7 +555,7 @@ export class SessionManager implements Middleware {
567
555
"connect" ,
568
556
( ) => {
569
557
this . log . write ( "Language service connected." ) ;
570
- resolve ( { writer : socket , reader : socket } ) ;
558
+ resolve ( { writer : socket , reader : socket } ) ;
571
559
} ) ;
572
560
} ) ;
573
561
} ;
@@ -576,7 +564,7 @@ export class SessionManager implements Middleware {
576
564
documentSelector : this . documentSelector ,
577
565
synchronize : {
578
566
// backend uses "files" and "search" to ignore references.
579
- configurationSection : [ utils . PowerShellLanguageId , "files" , "search" ] ,
567
+ configurationSection : [ utils . PowerShellLanguageId , "files" , "search" ] ,
580
568
// fileEvents: vscode.workspace.createFileSystemWatcher('**/.eslintrc')
581
569
} ,
582
570
// NOTE: Some settings are only applicable on startup, so we send them during initialization.
@@ -819,8 +807,8 @@ export class SessionManager implements Middleware {
819
807
case SessionStatus . NeverStarted :
820
808
case SessionStatus . Stopping :
821
809
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 ( ) ) ;
824
812
825
813
const powerShellSessionName =
826
814
currentPowerShellExe ?
@@ -887,7 +875,7 @@ class SessionMenuItem implements vscode.QuickPickItem {
887
875
constructor (
888
876
public readonly label : string ,
889
877
// tslint:disable-next-line:no-empty
890
- public readonly callback : ( ) => void = ( ) => { } ) {
878
+ public readonly callback : ( ) => void = ( ) => { } ) {
891
879
}
892
880
}
893
881
0 commit comments