Found this thread: CodeMirror 6: Setting a minimum height but allow the editor to grow , that’s pretty much what I wanted. Perhaps without the line numbers, but it’s not that important.
This is the theme that worked for me:
const theme = EditorView.theme({
'.cm-activeLine': {
backgroundColor: 'var(--codemirror-active-line)',
},
'.cm-content': {
height: 'var(--codemirror-height)',
},
'.cm-scroller': {
overflow: 'hidden',
},
'.cm-wrap': {
height: 'var(--codemirror-height)',
border: '1px solid silver',
},
});