1
- import { ReactWidget , Message } from "@theia/core/lib/browser" ;
1
+ import { ReactWidget , Message , Widget } from "@theia/core/lib/browser" ;
2
2
import { postConstruct , injectable , inject } from "inversify" ;
3
3
import * as React from 'react' ;
4
4
import Select , { components } from 'react-select' ;
@@ -116,6 +116,8 @@ export class MonitorWidget extends ReactWidget {
116
116
protected baudRate : number ;
117
117
protected _lineEnding : string ;
118
118
119
+ protected widgetHeight : number ;
120
+
119
121
constructor (
120
122
@inject ( MonitorServiceClientImpl ) protected readonly serviceClient : MonitorServiceClientImpl ,
121
123
@inject ( MonitorConnection ) protected readonly connection : MonitorConnection ,
@@ -135,6 +137,8 @@ export class MonitorWidget extends ReactWidget {
135
137
this . tempData = '' ;
136
138
this . _lineEnding = '\n' ;
137
139
140
+ this . scrollOptions = undefined ;
141
+
138
142
this . toDisposeOnDetach . push ( serviceClient . onRead ( ( { data, connectionId } ) => {
139
143
this . tempData += data ;
140
144
if ( this . tempData . endsWith ( '\n' ) ) {
@@ -170,7 +174,7 @@ export class MonitorWidget extends ReactWidget {
170
174
this . clear ( ) ;
171
175
this . connect ( ) ;
172
176
this . toDisposeOnDetach . push ( this . boardsServiceClient . onBoardsChanged ( async states => {
173
- const currentConnectionConfig = this . connection . connectionConfig ;
177
+ const currentConnectionConfig = this . connection . connectionConfig ;
174
178
const connectedBoard = states . newState . boards
175
179
. filter ( AttachedSerialBoard . is )
176
180
. find ( board => {
@@ -195,6 +199,12 @@ export class MonitorWidget extends ReactWidget {
195
199
this . connection . disconnect ( ) ;
196
200
}
197
201
202
+ protected onResize ( msg : Widget . ResizeMessage ) {
203
+ super . onResize ( msg ) ;
204
+ this . widgetHeight = msg . height ;
205
+ this . update ( ) ;
206
+ }
207
+
198
208
protected async connect ( ) {
199
209
const config = await this . getConnectionConfig ( ) ;
200
210
if ( config ) {
@@ -297,7 +307,8 @@ export class MonitorWidget extends ReactWidget {
297
307
const selectStyles : Styles = {
298
308
control : ( provided , state ) => ( {
299
309
...provided ,
300
- width : 200
310
+ width : 200 ,
311
+ border : 'none'
301
312
} ) ,
302
313
dropdownIndicator : ( p , s ) => ( {
303
314
...p ,
@@ -337,6 +348,7 @@ export class MonitorWidget extends ReactWidget {
337
348
components = { { DropdownIndicator } }
338
349
theme = { theme }
339
350
styles = { selectStyles }
351
+ maxMenuHeight = { this . widgetHeight - 40 }
340
352
classNamePrefix = 'sms'
341
353
className = 'serial-monitor-select'
342
354
id = { id }
0 commit comments