@@ -21,7 +21,6 @@ import { Color, RGBA } from 'vs/base/common/color';
21
21
import { onUnexpectedError } from 'vs/base/common/errors' ;
22
22
import { Emitter , Event } from 'vs/base/common/event' ;
23
23
import { combinedDisposable , Disposable , DisposableStore , dispose , IDisposable , toDisposable } from 'vs/base/common/lifecycle' ;
24
- import { deepClone } from 'vs/base/common/objects' ;
25
24
import { setTimeout0 } from 'vs/base/common/platform' ;
26
25
import { extname , isEqual } from 'vs/base/common/resources' ;
27
26
import { URI } from 'vs/base/common/uri' ;
@@ -51,7 +50,7 @@ import { EDITOR_PANE_BACKGROUND, PANEL_BORDER, SIDE_BAR_BACKGROUND } from 'vs/wo
51
50
import { debugIconStartForeground } from 'vs/workbench/contrib/debug/browser/debugColors' ;
52
51
import { CellEditState , CellFindMatchWithIndex , CellFocusMode , CellLayoutContext , CellRevealType , IActiveNotebookEditorDelegate , IBaseCellEditorOptions , ICellOutputViewModel , ICellViewModel , ICommonCellInfo , IDisplayOutputLayoutUpdateRequest , IFocusNotebookCellOptions , IInsetRenderOutput , IModelDecorationsChangeAccessor , INotebookDeltaDecoration , INotebookEditor , INotebookEditorContribution , INotebookEditorContributionDescription , INotebookEditorCreationOptions , INotebookEditorDelegate , INotebookEditorMouseEvent , INotebookEditorOptions , INotebookEditorViewState , INotebookViewCellsUpdateEvent , INotebookWebviewMessage , RenderOutputType } from 'vs/workbench/contrib/notebook/browser/notebookBrowser' ;
53
52
import { NotebookEditorExtensionsRegistry } from 'vs/workbench/contrib/notebook/browser/notebookEditorExtensions' ;
54
- import { INotebookEditorService } from 'vs/workbench/contrib/notebook/browser/notebookEditorService' ;
53
+ import { INotebookEditorService } from 'vs/workbench/contrib/notebook/browser/services/ notebookEditorService' ;
55
54
import { notebookDebug } from 'vs/workbench/contrib/notebook/browser/notebookLogger' ;
56
55
import { NotebookCellStateChangedEvent , NotebookLayoutChangedEvent , NotebookLayoutInfo } from 'vs/workbench/contrib/notebook/browser/notebookViewEvents' ;
57
56
import { CellContextKeyManager } from 'vs/workbench/contrib/notebook/browser/view/cellParts/cellContextKeys' ;
@@ -85,102 +84,10 @@ import { IWebview } from 'vs/workbench/contrib/webview/browser/webview';
85
84
import { EditorExtensionsRegistry } from 'vs/editor/browser/editorExtensions' ;
86
85
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService' ;
87
86
import { NotebookPerfMarks } from 'vs/workbench/contrib/notebook/common/notebookPerformance' ;
87
+ import { BaseCellEditorOptions } from 'vs/workbench/contrib/notebook/browser/viewModel/cellEditorOptions' ;
88
88
89
89
const $ = DOM . $ ;
90
90
91
- export class BaseCellEditorOptions extends Disposable implements IBaseCellEditorOptions {
92
- private static fixedEditorOptions : IEditorOptions = {
93
- scrollBeyondLastLine : false ,
94
- scrollbar : {
95
- verticalScrollbarSize : 14 ,
96
- horizontal : 'auto' ,
97
- useShadows : true ,
98
- verticalHasArrows : false ,
99
- horizontalHasArrows : false ,
100
- alwaysConsumeMouseWheel : false
101
- } ,
102
- renderLineHighlightOnlyWhenFocus : true ,
103
- overviewRulerLanes : 0 ,
104
- lineNumbers : 'off' ,
105
- lineDecorationsWidth : 0 ,
106
- folding : true ,
107
- fixedOverflowWidgets : true ,
108
- minimap : { enabled : false } ,
109
- renderValidationDecorations : 'on' ,
110
- lineNumbersMinChars : 3
111
- } ;
112
-
113
- private _localDisposableStore = this . _register ( new DisposableStore ( ) ) ;
114
- private readonly _onDidChange = this . _register ( new Emitter < void > ( ) ) ;
115
- readonly onDidChange : Event < void > = this . _onDidChange . event ;
116
- private _value : IEditorOptions ;
117
-
118
- get value ( ) : Readonly < IEditorOptions > {
119
- return this . _value ;
120
- }
121
-
122
- constructor ( readonly notebookEditor : INotebookEditorDelegate , readonly notebookOptions : NotebookOptions , readonly configurationService : IConfigurationService , readonly language : string ) {
123
- super ( ) ;
124
- this . _register ( configurationService . onDidChangeConfiguration ( e => {
125
- if ( e . affectsConfiguration ( 'editor' ) || e . affectsConfiguration ( 'notebook' ) ) {
126
- this . _recomputeOptions ( ) ;
127
- }
128
- } ) ) ;
129
-
130
- this . _register ( notebookOptions . onDidChangeOptions ( e => {
131
- if ( e . cellStatusBarVisibility || e . editorTopPadding || e . editorOptionsCustomizations ) {
132
- this . _recomputeOptions ( ) ;
133
- }
134
- } ) ) ;
135
-
136
- this . _register ( this . notebookEditor . onDidChangeModel ( ( ) => {
137
- this . _localDisposableStore . clear ( ) ;
138
-
139
- if ( this . notebookEditor . hasModel ( ) ) {
140
- this . _localDisposableStore . add ( this . notebookEditor . onDidChangeOptions ( ( ) => {
141
- this . _recomputeOptions ( ) ;
142
- } ) ) ;
143
-
144
- this . _recomputeOptions ( ) ;
145
- }
146
- } ) ) ;
147
-
148
- if ( this . notebookEditor . hasModel ( ) ) {
149
- this . _localDisposableStore . add ( this . notebookEditor . onDidChangeOptions ( ( ) => {
150
- this . _recomputeOptions ( ) ;
151
- } ) ) ;
152
- }
153
-
154
- this . _value = this . _computeEditorOptions ( ) ;
155
- }
156
-
157
- private _recomputeOptions ( ) : void {
158
- this . _value = this . _computeEditorOptions ( ) ;
159
- this . _onDidChange . fire ( ) ;
160
- }
161
-
162
- private _computeEditorOptions ( ) {
163
- const editorOptions = deepClone ( this . configurationService . getValue < IEditorOptions > ( 'editor' , { overrideIdentifier : this . language } ) ) ;
164
- const layoutConfig = this . notebookOptions . getLayoutConfiguration ( ) ;
165
- const editorOptionsOverrideRaw = layoutConfig . editorOptionsCustomizations ?? { } ;
166
- const editorOptionsOverride : { [ key : string ] : any } = { } ;
167
- for ( const key in editorOptionsOverrideRaw ) {
168
- if ( key . indexOf ( 'editor.' ) === 0 ) {
169
- editorOptionsOverride [ key . substring ( 7 ) ] = editorOptionsOverrideRaw [ key ] ;
170
- }
171
- }
172
- const computed = Object . freeze ( {
173
- ...editorOptions ,
174
- ...BaseCellEditorOptions . fixedEditorOptions ,
175
- ...editorOptionsOverride ,
176
- ...{ padding : { top : 12 , bottom : 12 } } ,
177
- readOnly : this . notebookEditor . isReadOnly
178
- } ) ;
179
-
180
- return computed ;
181
- }
182
- }
183
-
184
91
export function getDefaultNotebookCreationOptions ( ) : INotebookEditorCreationOptions {
185
92
// We inlined the id to avoid loading comment contrib in tests
186
93
const skipContributions = [ 'editor.contrib.review' ] ;
@@ -2007,10 +1914,6 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
2007
1914
return this . _list . getAbsoluteTopOfElement ( cell ) ;
2008
1915
}
2009
1916
2010
- isScrolledToBottom ( ) {
2011
- return this . _listViewInfoAccessor . isScrolledToBottom ( ) ;
2012
- }
2013
-
2014
1917
scrollToBottom ( ) {
2015
1918
this . _listViewInfoAccessor . scrollToBottom ( ) ;
2016
1919
}
@@ -2111,10 +2014,6 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
2111
2014
return this . _listViewInfoAccessor . getVisibleRangesPlusViewportAboveAndBelow ( ) ;
2112
2015
}
2113
2016
2114
- setScrollTop ( scrollTop : number ) {
2115
- this . _listViewInfoAccessor . setScrollTop ( scrollTop ) ;
2116
- }
2117
-
2118
2017
//#endregion
2119
2018
2120
2019
//#region Decorations
0 commit comments