@@ -6,13 +6,13 @@ import spawn from 'cross-spawn';
6
6
import { v4 as uuidv4 } from 'uuid' ;
7
7
8
8
import type { ShellUserConfig , MongoshBus } from '@mongosh/types' ;
9
- import { signatures , ShellPlugin , ShellInternalState , TypeSignature } from '@mongosh/shell-api' ;
9
+ import { signatures , ShellPlugin , ShellInstanceState , TypeSignature } from '@mongosh/shell-api' ;
10
10
11
11
export interface EditorOptions {
12
12
input : Readable ;
13
13
vscodeDir : string ,
14
14
tmpDir : string ,
15
- internalState : ShellInternalState ;
15
+ instanceState : ShellInstanceState ;
16
16
makeMultilineJSIntoSingleLine : any ;
17
17
}
18
18
@@ -22,22 +22,22 @@ export class Editor implements ShellPlugin {
22
22
_tmpDir : string ;
23
23
_tmpDocName : string ;
24
24
_tmpDoc : string ;
25
- _internalState : ShellInternalState ;
25
+ _instanceState : ShellInstanceState ;
26
26
_makeMultilineJSIntoSingleLine : any ;
27
27
load : ( filename : string ) => Promise < void > ;
28
28
require : any ;
29
29
config : { get < T extends keyof ShellUserConfig > ( key : T ) : Promise < ShellUserConfig [ T ] > } ;
30
30
print : ( ...args : any [ ] ) => Promise < void > ;
31
31
npmArgv : string [ ] ;
32
32
33
- constructor ( { input, vscodeDir, tmpDir, internalState , makeMultilineJSIntoSingleLine } : EditorOptions ) {
34
- const { load, config, print, require } = internalState . context ;
33
+ constructor ( { input, vscodeDir, tmpDir, instanceState , makeMultilineJSIntoSingleLine } : EditorOptions ) {
34
+ const { load, config, print, require } = instanceState . context ;
35
35
this . _input = input ;
36
36
this . _vscodeDir = vscodeDir ;
37
37
this . _tmpDir = tmpDir ;
38
38
this . _tmpDocName = `edit-${ uuidv4 ( ) } ` ;
39
39
this . _tmpDoc = '' ;
40
- this . _internalState = internalState ;
40
+ this . _instanceState = instanceState ;
41
41
this . _makeMultilineJSIntoSingleLine = makeMultilineJSIntoSingleLine ;
42
42
this . load = load ;
43
43
this . config = config ;
@@ -53,7 +53,7 @@ export class Editor implements ShellPlugin {
53
53
} ;
54
54
wrapperFn . isDirectShellCommand = true ;
55
55
wrapperFn . returnsPromise = true ;
56
- ( internalState . shellApi as any ) . edit = internalState . context . edit = wrapperFn ;
56
+ ( instanceState . shellApi as any ) . edit = instanceState . context . edit = wrapperFn ;
57
57
( signatures . ShellApi . attributes as any ) . edit = {
58
58
type : 'function' ,
59
59
returnsPromise : true ,
@@ -62,7 +62,7 @@ export class Editor implements ShellPlugin {
62
62
}
63
63
64
64
activate ( ) : void {
65
- this . _internalState . registerPlugin ( this ) ;
65
+ this . _instanceState . registerPlugin ( this ) ;
66
66
}
67
67
68
68
// In the case of using VSCode as an external editor,
@@ -96,7 +96,7 @@ export class Editor implements ShellPlugin {
96
96
97
97
async getEditor ( ) : Promise < string | null > {
98
98
// Check for an external editor in the mongosh configuration.
99
- let editor : string | null = await this . _internalState . shellApi . config . get ( 'editor' ) ;
99
+ let editor : string | null = await this . _instanceState . shellApi . config . get ( 'editor' ) ;
100
100
101
101
// Check for an external editor in the environment variable.
102
102
if ( ! editor && process . env . EDITOR ) {
@@ -178,7 +178,7 @@ export class Editor implements ShellPlugin {
178
178
}
179
179
180
180
get messageBus ( ) : MongoshBus {
181
- return this . _internalState . messageBus ;
181
+ return this . _instanceState . messageBus ;
182
182
}
183
183
184
184
transformError ( err : Error ) : Error {
0 commit comments