@codingame/monaco-vscode-notebook-service-override 2.2.2 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/package.json +2 -2
  2. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +6 -1
  3. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +101 -161
  4. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +4 -5
  5. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +85 -3
  6. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +8 -11
  7. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +3 -5
  8. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +34 -12
  9. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.js +5 -0
  10. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +55 -17
  11. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +39 -3
  12. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +1 -41
  13. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +17 -26
  14. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +3 -4
  15. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +565 -0
  16. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.js +31 -0
  17. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatController.js +744 -0
  18. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +28 -23
  19. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +351 -0
  20. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +41 -42
  21. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +31 -13
  22. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +4 -4
  23. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +4 -4
  24. package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +25 -16
  25. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +118 -6
  26. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +6 -6
  27. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +6 -9
  28. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +2 -3
  29. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +3 -39
  30. package/vscode/src/vs/workbench/contrib/search/browser/notebookSearch/notebookSearchService.js +43 -11
  31. package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +5 -1
@@ -2,7 +2,6 @@ import { __decorate, __param } from '../../../../../../../../external/tslib/tsli
2
2
  import { localizeWithPath } from 'vscode/vscode/vs/nls';
3
3
  import { toAction } from 'vscode/vscode/vs/base/common/actions';
4
4
  import { createErrorWithActions } from 'vscode/vscode/vs/base/common/errorMessage';
5
- import { PixelRatio } from 'vscode/vscode/vs/base/browser/browser';
6
5
  import { Emitter } from 'vscode/vscode/vs/base/common/event';
7
6
  import { Iterable } from 'vscode/vscode/vs/base/common/iterator';
8
7
  import { Lazy } from 'vscode/vscode/vs/base/common/lazy';
@@ -12,8 +11,6 @@ import { Schemas } from 'vscode/vscode/vs/base/common/network';
12
11
  import { isEqual } from 'vscode/vscode/vs/base/common/resources';
13
12
  import { isDefined } from 'vscode/vscode/vs/base/common/types';
14
13
  import { URI } from 'vscode/vscode/vs/base/common/uri';
15
- import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/codeEditorService';
16
- import { BareFontInfo } from 'vscode/vscode/vs/editor/common/config/fontInfo';
17
14
  import { IAccessibilityService } from 'vscode/vscode/vs/platform/accessibility/common/accessibility';
18
15
  import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
19
16
  import { IFileService } from 'vscode/vscode/vs/platform/files/common/files';
@@ -26,7 +23,6 @@ import { NotebookTextModel } from '../../common/model/notebookTextModel.js';
26
23
  import { NotebookEditorPriority, NotebookSetting, RENDERER_NOT_AVAILABLE, RENDERER_EQUIVALENT_EXTENSIONS, MimeTypeDisplayOrder, ACCESSIBLE_NOTEBOOK_DISPLAY_ORDER, NOTEBOOK_DISPLAY_ORDER, CellUri } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
27
24
  import { NotebookEditorInput } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookEditorInput';
28
25
  import { INotebookEditorModelResolverService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookEditorModelResolverService';
29
- import { updateEditorTopPadding } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookOptions';
30
26
  import { NotebookOutputRendererInfo, NotebookStaticPreloadInfo } from '../../common/notebookOutputRenderer.js';
31
27
  import { NotebookProviderInfo } from '../../common/notebookProvider.js';
32
28
  import { SimpleNotebookProviderInfo } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookService';
@@ -352,14 +348,12 @@ let NotebookService = class NotebookService extends Disposable {
352
348
  }
353
349
  return this._notebookProviderInfoStore;
354
350
  }
355
- constructor(_extensionService, _configurationService, _accessibilityService, _instantiationService, _codeEditorService, configurationService, _storageService, _notebookDocumentService) {
351
+ constructor(_extensionService, _configurationService, _accessibilityService, _instantiationService, _storageService, _notebookDocumentService) {
356
352
  super();
357
353
  this._extensionService = _extensionService;
358
354
  this._configurationService = _configurationService;
359
355
  this._accessibilityService = _accessibilityService;
360
356
  this._instantiationService = _instantiationService;
361
- this._codeEditorService = _codeEditorService;
362
- this.configurationService = configurationService;
363
357
  this._storageService = _storageService;
364
358
  this._notebookDocumentService = _notebookDocumentService;
365
359
  this._notebookProviders = ( new Map());
@@ -453,34 +447,6 @@ let NotebookService = class NotebookService extends Disposable {
453
447
  this._register(this._accessibilityService.onDidChangeScreenReaderOptimized(() => {
454
448
  updateOrder();
455
449
  }));
456
- let decorationTriggeredAdjustment = false;
457
- const decorationCheckSet = ( new Set());
458
- const onDidAddDecorationType = (e) => {
459
- if (decorationTriggeredAdjustment) {
460
- return;
461
- }
462
- if (( decorationCheckSet.has(e))) {
463
- return;
464
- }
465
- const options = this._codeEditorService.resolveDecorationOptions(e, true);
466
- if (options.afterContentClassName || options.beforeContentClassName) {
467
- const cssRules = this._codeEditorService.resolveDecorationCSSRules(e);
468
- if (cssRules !== null) {
469
- for (let i = 0; i < cssRules.length; i++) {
470
- if ((cssRules[i].selectorText.endsWith('::after') || cssRules[i].selectorText.endsWith('::after'))
471
- && cssRules[i].cssText.indexOf('top:') > -1) {
472
- const editorOptions = this.configurationService.getValue('editor');
473
- updateEditorTopPadding(BareFontInfo.createFromRawSettings(editorOptions, PixelRatio.value).lineHeight + 2);
474
- decorationTriggeredAdjustment = true;
475
- break;
476
- }
477
- }
478
- }
479
- }
480
- decorationCheckSet.add(e);
481
- };
482
- this._register(this._codeEditorService.onDecorationTypeRegistered(onDidAddDecorationType));
483
- this._codeEditorService.listDecorationTypes().forEach(onDidAddDecorationType);
484
450
  this._memento = ( new Memento(NotebookService_1._storageNotebookViewTypeProvider, this._storageService));
485
451
  this._viewTypeCache = this._memento.getMemento(1 , 1 );
486
452
  }
@@ -668,10 +634,8 @@ NotebookService = NotebookService_1 = ( __decorate([
668
634
  ( __param(1, IConfigurationService)),
669
635
  ( __param(2, IAccessibilityService)),
670
636
  ( __param(3, IInstantiationService)),
671
- ( __param(4, ICodeEditorService)),
672
- ( __param(5, IConfigurationService)),
673
- ( __param(6, IStorageService)),
674
- ( __param(7, INotebookDocumentService))
637
+ ( __param(4, IStorageService)),
638
+ ( __param(5, INotebookDocumentService))
675
639
  ], NotebookService));
676
640
 
677
641
  export { NotebookOutputRendererInfoStore, NotebookProviderInfoStore, NotebookService };
@@ -6,20 +6,24 @@ import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
6
6
  import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity';
7
7
  import { INotebookService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookService';
8
8
  import { contentMatchesToTextSearchMatches, webviewMatchesToTextSearchMatches } from 'vscode/vscode/vs/workbench/contrib/search/browser/notebookSearch/searchNotebookHelpers';
9
- import { pathIncludedInQuery } from 'vscode/vscode/vs/workbench/services/search/common/search';
9
+ import { pathIncludedInQuery, ISearchService } from 'vscode/vscode/vs/workbench/services/search/common/search';
10
10
  import { coalesce } from 'vscode/vscode/vs/base/common/arrays';
11
11
  import { isNumber } from 'vscode/vscode/vs/base/common/types';
12
12
  import { IEditorResolverService } from 'vscode/vscode/vs/workbench/services/editor/common/editorResolverService';
13
13
  import { INotebookEditorService } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/services/notebookEditorService';
14
+ import { QueryBuilder } from 'vscode/vscode/vs/workbench/services/search/common/queryBuilder';
15
+ import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
14
16
 
15
17
  let NotebookSearchService = class NotebookSearchService {
16
- constructor(uriIdentityService, notebookEditorService, logService, notebookService, configurationService, editorResolverService) {
18
+ constructor(uriIdentityService, notebookEditorService, logService, notebookService, configurationService, editorResolverService, searchService, instantiationService) {
17
19
  this.uriIdentityService = uriIdentityService;
18
20
  this.notebookEditorService = notebookEditorService;
19
21
  this.logService = logService;
20
22
  this.notebookService = notebookService;
21
23
  this.configurationService = configurationService;
22
24
  this.editorResolverService = editorResolverService;
25
+ this.searchService = searchService;
26
+ this.queryBuilder = instantiationService.createInstance(QueryBuilder);
23
27
  }
24
28
  notebookSearch(query, token, searchInstanceID, onProgress) {
25
29
  if (query.type !== 2 ) {
@@ -80,6 +84,20 @@ let NotebookSearchService = class NotebookSearchService {
80
84
  allScannedFiles: promiseResults.allScannedFiles
81
85
  };
82
86
  }
87
+ async doesFileExist(includes, folderQueries, token) {
88
+ const promises = ( includes.map(async (includePattern) => {
89
+ const query = this.queryBuilder.file(( folderQueries.map(e => e.folder)), {
90
+ includePattern: includePattern.startsWith('/') ? includePattern : '**/' + includePattern,
91
+ exists: true
92
+ });
93
+ return this.searchService.fileSearch(query, token).then((ret) => {
94
+ if (!ret.limitHit) {
95
+ throw Error('File not found');
96
+ }
97
+ });
98
+ }));
99
+ return Promise.any(promises).then(() => true).catch(() => false);
100
+ }
83
101
  async getClosedNotebookResults(textQuery, scannedFiles, token) {
84
102
  const userAssociations = this.editorResolverService.getAllUserAssociations();
85
103
  const allPriorityInfo = ( new Map());
@@ -102,14 +120,26 @@ let NotebookSearchService = class NotebookSearchService {
102
120
  });
103
121
  const promises = [];
104
122
  contributedNotebookTypes.forEach((notebook) => {
105
- promises.push((async () => {
106
- const canResolve = await this.notebookService.canResolve(notebook.id);
107
- if (!canResolve) {
108
- return undefined;
109
- }
110
- const serializer = (await this.notebookService.withNotebookDataProvider(notebook.id)).serializer;
111
- return await serializer.searchInNotebooks(textQuery, token, allPriorityInfo);
112
- })());
123
+ if (notebook.selectors.length > 0) {
124
+ promises.push((async () => {
125
+ const includes = ( notebook.selectors.map((selector) => {
126
+ const globPattern = selector.include || selector;
127
+ return ( globPattern.toString());
128
+ }));
129
+ const isInWorkspace = await this.doesFileExist(includes, textQuery.folderQueries, token);
130
+ if (isInWorkspace) {
131
+ const canResolve = await this.notebookService.canResolve(notebook.id);
132
+ if (!canResolve) {
133
+ return undefined;
134
+ }
135
+ const serializer = (await this.notebookService.withNotebookDataProvider(notebook.id)).serializer;
136
+ return await serializer.searchInNotebooks(textQuery, token, allPriorityInfo);
137
+ }
138
+ else {
139
+ return undefined;
140
+ }
141
+ })());
142
+ }
113
143
  });
114
144
  const start = Date.now();
115
145
  const searchComplete = coalesce(await Promise.all(promises));
@@ -199,7 +229,9 @@ NotebookSearchService = ( __decorate([
199
229
  ( __param(2, ILogService)),
200
230
  ( __param(3, INotebookService)),
201
231
  ( __param(4, IConfigurationService)),
202
- ( __param(5, IEditorResolverService))
232
+ ( __param(5, IEditorResolverService)),
233
+ ( __param(6, ISearchService)),
234
+ ( __param(7, IInstantiationService))
203
235
  ], NotebookSearchService));
204
236
 
205
237
  export { NotebookSearchService };
@@ -246,7 +246,11 @@ let FileWorkingCopyManager = class FileWorkingCopyManager extends Disposable {
246
246
  source: targetFileExists ? FileWorkingCopyManager_1.FILE_WORKING_COPY_SAVE_REPLACE_SOURCE : FileWorkingCopyManager_1.FILE_WORKING_COPY_SAVE_CREATE_SOURCE
247
247
  };
248
248
  }
249
- const success = await targetStoredFileWorkingCopy.save({ ...options, force: true });
249
+ const success = await targetStoredFileWorkingCopy.save({
250
+ ...options,
251
+ from: source,
252
+ force: true
253
+ });
250
254
  if (!success) {
251
255
  return undefined;
252
256
  }