Skip to content

Commit 7526fbd

Browse files
committed
make transport not enumerable
1 parent 77ca997 commit 7526fbd

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/api/Base.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@ export class BaseApi {
2222
this.client = client
2323
} else {
2424
Object.defineProperty(this, 'client', {
25+
enumerable: false,
2526
value: this
2627
})
2728
}
2829
}
2930

3031
protected get transport(): Transport {
31-
return this.client._transport
32+
return this.client.transport
3233
}
3334

3435
public equals(other: BaseApi): boolean {

src/api/client.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,17 +136,23 @@ export class NeovimClient extends Neovim {
136136
private responses: Map<number, AsyncResponse> = new Map()
137137
private _channelId: number
138138
private attachedBuffers: Map<number, Map<string, Function[]>> = new Map()
139-
public _transport: Transport
139+
private _transport: Transport
140140

141141
constructor(private logger: ILogger, public readonly isVim: boolean) {
142142
// Neovim has no `data` or `metadata`
143143
super({})
144-
this._transport = isVim ? new VimTransport(logger) : new NvimTransport(logger)
144+
const transport = isVim ? new VimTransport(logger) : new NvimTransport(logger)
145+
Object.defineProperty(this, '_transport', {
146+
enumerable: false,
147+
get: () => {
148+
return transport
149+
}
150+
})
145151
this.handleRequest = this.handleRequest.bind(this)
146152
this.handleNotification = this.handleNotification.bind(this)
147153
}
148154

149-
protected get transport(): Transport {
155+
public get transport(): Transport {
150156
return this._transport
151157
}
152158

0 commit comments

Comments
 (0)