Skip to content

Commit 10c4761

Browse files
committed
refactor: rename internalState to instanceState
1 parent be5bf7f commit 10c4761

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

packages/cli-repl/src/cli-repl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ class CliRepl {
225225
input: this.input,
226226
vscodeDir: this.shellHomeDirectory.rcPath('.vscode'),
227227
tmpDir: this.shellHomeDirectory.roamingPath('editor'),
228-
internalState: this.mongoshRepl.runtimeState().internalState,
228+
instanceState: this.mongoshRepl.runtimeState().instanceState,
229229
makeMultilineJSIntoSingleLine: makeMultilineJSIntoSingleLine // TODO: move to its own package
230230
});
231231
editor.activate();

packages/editor/src/editor.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ import spawn from 'cross-spawn';
66
import { v4 as uuidv4 } from 'uuid';
77

88
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';
1010

1111
export interface EditorOptions {
1212
input: Readable;
1313
vscodeDir: string,
1414
tmpDir: string,
15-
internalState: ShellInternalState;
15+
instanceState: ShellInstanceState;
1616
makeMultilineJSIntoSingleLine: any;
1717
}
1818

@@ -22,22 +22,22 @@ export class Editor implements ShellPlugin {
2222
_tmpDir: string;
2323
_tmpDocName: string;
2424
_tmpDoc: string;
25-
_internalState: ShellInternalState;
25+
_instanceState: ShellInstanceState;
2626
_makeMultilineJSIntoSingleLine: any;
2727
load: (filename: string) => Promise<void>;
2828
require: any;
2929
config: { get<T extends keyof ShellUserConfig>(key: T): Promise<ShellUserConfig[T]> };
3030
print: (...args: any[]) => Promise<void>;
3131
npmArgv: string[];
3232

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;
3535
this._input = input;
3636
this._vscodeDir = vscodeDir;
3737
this._tmpDir = tmpDir;
3838
this._tmpDocName = `edit-${uuidv4()}`;
3939
this._tmpDoc = '';
40-
this._internalState = internalState;
40+
this._instanceState = instanceState;
4141
this._makeMultilineJSIntoSingleLine = makeMultilineJSIntoSingleLine;
4242
this.load = load;
4343
this.config = config;
@@ -53,7 +53,7 @@ export class Editor implements ShellPlugin {
5353
};
5454
wrapperFn.isDirectShellCommand = true;
5555
wrapperFn.returnsPromise = true;
56-
(internalState.shellApi as any).edit = internalState.context.edit = wrapperFn;
56+
(instanceState.shellApi as any).edit = instanceState.context.edit = wrapperFn;
5757
(signatures.ShellApi.attributes as any).edit = {
5858
type: 'function',
5959
returnsPromise: true,
@@ -62,7 +62,7 @@ export class Editor implements ShellPlugin {
6262
}
6363

6464
activate(): void {
65-
this._internalState.registerPlugin(this);
65+
this._instanceState.registerPlugin(this);
6666
}
6767

6868
// In the case of using VSCode as an external editor,
@@ -96,7 +96,7 @@ export class Editor implements ShellPlugin {
9696

9797
async getEditor(): Promise<string|null> {
9898
// 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');
100100

101101
// Check for an external editor in the environment variable.
102102
if (!editor && process.env.EDITOR) {
@@ -178,7 +178,7 @@ export class Editor implements ShellPlugin {
178178
}
179179

180180
get messageBus(): MongoshBus {
181-
return this._internalState.messageBus;
181+
return this._instanceState.messageBus;
182182
}
183183

184184
transformError(err: Error): Error {

0 commit comments

Comments
 (0)