@@ -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 {
@@ -285,20 +287,6 @@ export class SessionManager implements Middleware {
285
287
return vscode . Uri . joinPath ( this . sessionsFolder , "PSES-VSCode-" + process . env . VSCODE_PID + "-" + uniqueId + ".json" ) ;
286
288
}
287
289
288
- public static readSessionFile ( sessionFilePath : vscode . Uri ) : IEditorServicesSessionDetails {
289
- // TODO: Use vscode.workspace.fs.readFile instead of fs.readFileSync.
290
- const fileContents = fs . readFileSync ( sessionFilePath . fsPath , "utf-8" ) ;
291
- return JSON . parse ( fileContents ) ;
292
- }
293
-
294
- public static async deleteSessionFile ( sessionFilePath : vscode . Uri ) {
295
- try {
296
- await vscode . workspace . fs . delete ( sessionFilePath ) ;
297
- } catch ( e ) {
298
- // TODO: Be more specific about what we're catching
299
- }
300
- }
301
-
302
290
public createDebugSessionProcess ( sessionSettings : Settings . ISettings ) : PowerShellProcess {
303
291
304
292
// NOTE: We only support one temporary integrated console at a time. To
@@ -335,7 +323,7 @@ export class SessionManager implements Middleware {
335
323
}
336
324
337
325
public async waitUntilStarted ( ) : Promise < void > {
338
- while ( ! this . started ) {
326
+ while ( ! this . started ) {
339
327
await utils . sleep ( 300 ) ;
340
328
}
341
329
}
@@ -346,43 +334,43 @@ export class SessionManager implements Middleware {
346
334
codeLens : vscode . CodeLens ,
347
335
token : vscode . CancellationToken ,
348
336
next : ResolveCodeLensSignature ) : vscode . ProviderResult < vscode . CodeLens > {
349
- const resolvedCodeLens = next ( codeLens , token ) ;
350
- const resolveFunc =
351
- ( codeLensToFix : vscode . CodeLens ) : vscode . CodeLens => {
352
- if ( codeLensToFix . command ?. command === "editor.action.showReferences" ) {
353
- const oldArgs = codeLensToFix . command . arguments ;
354
-
355
- // Our JSON objects don't get handled correctly by
356
- // VS Code's built in editor.action.showReferences
357
- // command so we need to convert them into the
358
- // appropriate types to send them as command
359
- // arguments.
360
-
361
- codeLensToFix . command . arguments = [
362
- vscode . Uri . parse ( oldArgs [ 0 ] ) ,
363
- new vscode . Position ( oldArgs [ 1 ] . line , oldArgs [ 1 ] . character ) ,
364
- oldArgs [ 2 ] . map ( ( position ) => {
365
- return new vscode . Location (
366
- vscode . Uri . parse ( position . uri ) ,
367
- new vscode . Range (
368
- position . range . start . line ,
369
- position . range . start . character ,
370
- position . range . end . line ,
371
- position . range . end . character ) ) ;
372
- } ) ,
373
- ] ;
374
- }
337
+ const resolvedCodeLens = next ( codeLens , token ) ;
338
+ const resolveFunc =
339
+ ( codeLensToFix : vscode . CodeLens ) : vscode . CodeLens => {
340
+ if ( codeLensToFix . command ?. command === "editor.action.showReferences" ) {
341
+ const oldArgs = codeLensToFix . command . arguments ;
342
+
343
+ // Our JSON objects don't get handled correctly by
344
+ // VS Code's built in editor.action.showReferences
345
+ // command so we need to convert them into the
346
+ // appropriate types to send them as command
347
+ // arguments.
348
+
349
+ codeLensToFix . command . arguments = [
350
+ vscode . Uri . parse ( oldArgs [ 0 ] ) ,
351
+ new vscode . Position ( oldArgs [ 1 ] . line , oldArgs [ 1 ] . character ) ,
352
+ oldArgs [ 2 ] . map ( ( position ) => {
353
+ return new vscode . Location (
354
+ vscode . Uri . parse ( position . uri ) ,
355
+ new vscode . Range (
356
+ position . range . start . line ,
357
+ position . range . start . character ,
358
+ position . range . end . line ,
359
+ position . range . end . character ) ) ;
360
+ } ) ,
361
+ ] ;
362
+ }
375
363
376
- return codeLensToFix ;
377
- } ;
364
+ return codeLensToFix ;
365
+ } ;
378
366
379
- if ( ( resolvedCodeLens as Thenable < vscode . CodeLens > ) . then ) {
380
- return ( resolvedCodeLens as Thenable < vscode . CodeLens > ) . then ( resolveFunc ) ;
381
- } else if ( resolvedCodeLens as vscode . CodeLens ) {
382
- return resolveFunc ( resolvedCodeLens as vscode . CodeLens ) ;
383
- }
367
+ if ( ( resolvedCodeLens as Thenable < vscode . CodeLens > ) . then ) {
368
+ return ( resolvedCodeLens as Thenable < vscode . CodeLens > ) . then ( resolveFunc ) ;
369
+ } else if ( resolvedCodeLens as vscode . CodeLens ) {
370
+ return resolveFunc ( resolvedCodeLens as vscode . CodeLens ) ;
371
+ }
384
372
385
- return resolvedCodeLens ;
373
+ return resolvedCodeLens ;
386
374
}
387
375
388
376
// Move old setting codeFormatting.whitespaceAroundPipe to new setting codeFormatting.addWhitespaceAroundPipe
@@ -438,9 +426,9 @@ export class SessionManager implements Middleware {
438
426
this . sessionSettings . cwd . toLowerCase ( ) ||
439
427
settings . powerShellDefaultVersion . toLowerCase ( ) !==
440
428
this . sessionSettings . powerShellDefaultVersion . toLowerCase ( ) ||
441
- settings . developer . editorServicesLogLevel . toLowerCase ( ) !==
429
+ settings . developer . editorServicesLogLevel . toLowerCase ( ) !==
442
430
this . sessionSettings . developer . editorServicesLogLevel . toLowerCase ( ) ||
443
- settings . developer . bundledModulesPath . toLowerCase ( ) !==
431
+ settings . developer . bundledModulesPath . toLowerCase ( ) !==
444
432
this . sessionSettings . developer . bundledModulesPath . toLowerCase ( ) ||
445
433
settings . integratedConsole . useLegacyReadLine !==
446
434
this . sessionSettings . integratedConsole . useLegacyReadLine ) ) {
@@ -449,9 +437,9 @@ export class SessionManager implements Middleware {
449
437
"The PowerShell runtime configuration has changed, would you like to start a new session?" ,
450
438
"Yes" , "No" ) ;
451
439
452
- if ( response === "Yes" ) {
453
- await this . restartSession ( ) ;
454
- }
440
+ if ( response === "Yes" ) {
441
+ await this . restartSession ( ) ;
442
+ }
455
443
}
456
444
}
457
445
@@ -565,7 +553,7 @@ export class SessionManager implements Middleware {
565
553
"connect" ,
566
554
( ) => {
567
555
this . log . write ( "Language service connected." ) ;
568
- resolve ( { writer : socket , reader : socket } ) ;
556
+ resolve ( { writer : socket , reader : socket } ) ;
569
557
} ) ;
570
558
} ) ;
571
559
} ;
@@ -574,7 +562,7 @@ export class SessionManager implements Middleware {
574
562
documentSelector : this . documentSelector ,
575
563
synchronize : {
576
564
// backend uses "files" and "search" to ignore references.
577
- configurationSection : [ utils . PowerShellLanguageId , "files" , "search" ] ,
565
+ configurationSection : [ utils . PowerShellLanguageId , "files" , "search" ] ,
578
566
// fileEvents: vscode.workspace.createFileSystemWatcher('**/.eslintrc')
579
567
} ,
580
568
// NOTE: Some settings are only applicable on startup, so we send them during initialization.
@@ -817,8 +805,8 @@ export class SessionManager implements Middleware {
817
805
case SessionStatus . NeverStarted :
818
806
case SessionStatus . Stopping :
819
807
const currentPowerShellExe =
820
- availablePowerShellExes
821
- . find ( ( item ) => item . displayName . toLowerCase ( ) === this . PowerShellExeDetails . displayName . toLowerCase ( ) ) ;
808
+ availablePowerShellExes
809
+ . find ( ( item ) => item . displayName . toLowerCase ( ) === this . PowerShellExeDetails . displayName . toLowerCase ( ) ) ;
822
810
823
811
const powerShellSessionName =
824
812
currentPowerShellExe ?
@@ -885,7 +873,7 @@ class SessionMenuItem implements vscode.QuickPickItem {
885
873
constructor (
886
874
public readonly label : string ,
887
875
// tslint:disable-next-line:no-empty
888
- public readonly callback : ( ) => void = ( ) => { } ) {
876
+ public readonly callback : ( ) => void = ( ) => { } ) {
889
877
}
890
878
}
891
879
0 commit comments