@codingame/monaco-vscode-notebook-service-override 3.2.3 → 4.1.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.
- package/notebook.js +13 -13
- package/package.json +2 -2
- package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
- package/external/tslib/tslib.es6.js +0 -11
- package/override/vs/platform/dialogs/common/dialogs.js +0 -8
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +0 -389
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +0 -608
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +0 -109
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +0 -173
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +0 -488
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +0 -106
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +0 -67
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +0 -165
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +0 -67
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +0 -320
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +0 -72
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/media/notebookFind.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +0 -168
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +0 -209
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +0 -84
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +0 -82
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +0 -67
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +0 -91
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +0 -393
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.js +0 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +0 -97
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +0 -118
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +0 -59
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +0 -148
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +0 -383
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +0 -77
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +0 -511
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +0 -159
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +0 -56
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +0 -94
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +0 -51
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +0 -565
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.js +0 -31
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatController.js +0 -744
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +0 -707
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +0 -351
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +0 -267
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +0 -45
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +0 -1297
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +0 -284
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +0 -563
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +0 -108
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +0 -39
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +0 -313
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +0 -890
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +0 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +0 -393
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +0 -175
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +0 -1174
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibility.js +0 -159
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +0 -451
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +0 -192
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +0 -106
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +0 -509
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +0 -130
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +0 -341
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +0 -111
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +0 -28
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +0 -65
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +0 -641
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +0 -200
- package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +0 -80
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +0 -1003
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +0 -103
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +0 -202
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +0 -80
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookProvider.js +0 -98
- package/vscode/src/vs/workbench/contrib/search/browser/notebookSearch/notebookSearchService.js +0 -237
- package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +0 -89
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +0 -376
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +0 -408
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +0 -144
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js +0 -129
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { Throttler } from 'vscode/vscode/vs/base/common/async';
|
|
3
|
-
import { CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellation';
|
|
4
|
-
import { Disposable, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
5
|
-
import { NotebookVisibleCellObserver } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/notebookVisibleCellObserver';
|
|
6
|
-
import { registerNotebookContribution } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookEditorExtensions';
|
|
7
|
-
import { INotebookCellStatusBarService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCellStatusBarService';
|
|
8
|
-
|
|
9
|
-
let ContributedStatusBarItemController = class ContributedStatusBarItemController extends Disposable {
|
|
10
|
-
static { this.id = 'workbench.notebook.statusBar.contributed'; }
|
|
11
|
-
constructor(_notebookEditor, _notebookCellStatusBarService) {
|
|
12
|
-
super();
|
|
13
|
-
this._notebookEditor = _notebookEditor;
|
|
14
|
-
this._notebookCellStatusBarService = _notebookCellStatusBarService;
|
|
15
|
-
this._visibleCells = ( new Map());
|
|
16
|
-
this._observer = this._register(( new NotebookVisibleCellObserver(this._notebookEditor)));
|
|
17
|
-
this._register(this._observer.onDidChangeVisibleCells(this._updateVisibleCells, this));
|
|
18
|
-
this._updateEverything();
|
|
19
|
-
this._register(this._notebookCellStatusBarService.onDidChangeProviders(this._updateEverything, this));
|
|
20
|
-
this._register(this._notebookCellStatusBarService.onDidChangeItems(this._updateEverything, this));
|
|
21
|
-
}
|
|
22
|
-
_updateEverything() {
|
|
23
|
-
const newCells = this._observer.visibleCells.filter(cell => !( this._visibleCells.has(cell.handle)));
|
|
24
|
-
const visibleCellHandles = ( new Set(( this._observer.visibleCells.map(item => item.handle))));
|
|
25
|
-
const currentCellHandles = Array.from(( this._visibleCells.keys()));
|
|
26
|
-
const removedCells = currentCellHandles.filter(handle => !( visibleCellHandles.has(handle)));
|
|
27
|
-
const itemsToUpdate = currentCellHandles.filter(handle => ( visibleCellHandles.has(handle)));
|
|
28
|
-
this._updateVisibleCells({ added: newCells, removed: ( removedCells.map(handle => ({ handle }))) });
|
|
29
|
-
itemsToUpdate.forEach(handle => this._visibleCells.get(handle)?.update());
|
|
30
|
-
}
|
|
31
|
-
_updateVisibleCells(e) {
|
|
32
|
-
const vm = this._notebookEditor.getViewModel();
|
|
33
|
-
if (!vm) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
for (const newCell of e.added) {
|
|
37
|
-
const helper = ( new CellStatusBarHelper(vm, newCell, this._notebookCellStatusBarService));
|
|
38
|
-
this._visibleCells.set(newCell.handle, helper);
|
|
39
|
-
}
|
|
40
|
-
for (const oldCell of e.removed) {
|
|
41
|
-
this._visibleCells.get(oldCell.handle)?.dispose();
|
|
42
|
-
this._visibleCells.delete(oldCell.handle);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
dispose() {
|
|
46
|
-
super.dispose();
|
|
47
|
-
this._visibleCells.forEach(cell => cell.dispose());
|
|
48
|
-
this._visibleCells.clear();
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
ContributedStatusBarItemController = ( __decorate([
|
|
52
|
-
( __param(1, INotebookCellStatusBarService))
|
|
53
|
-
], ContributedStatusBarItemController));
|
|
54
|
-
class CellStatusBarHelper extends Disposable {
|
|
55
|
-
constructor(_notebookViewModel, _cell, _notebookCellStatusBarService) {
|
|
56
|
-
super();
|
|
57
|
-
this._notebookViewModel = _notebookViewModel;
|
|
58
|
-
this._cell = _cell;
|
|
59
|
-
this._notebookCellStatusBarService = _notebookCellStatusBarService;
|
|
60
|
-
this._currentItemIds = [];
|
|
61
|
-
this._currentItemLists = [];
|
|
62
|
-
this._isDisposed = false;
|
|
63
|
-
this._updateThrottler = this._register(( new Throttler()));
|
|
64
|
-
this._register(toDisposable(() => this._activeToken?.dispose(true)));
|
|
65
|
-
this._updateSoon();
|
|
66
|
-
this._register(this._cell.model.onDidChangeContent(() => this._updateSoon()));
|
|
67
|
-
this._register(this._cell.model.onDidChangeLanguage(() => this._updateSoon()));
|
|
68
|
-
this._register(this._cell.model.onDidChangeMetadata(() => this._updateSoon()));
|
|
69
|
-
this._register(this._cell.model.onDidChangeInternalMetadata(() => this._updateSoon()));
|
|
70
|
-
this._register(this._cell.model.onDidChangeOutputs(() => this._updateSoon()));
|
|
71
|
-
}
|
|
72
|
-
update() {
|
|
73
|
-
this._updateSoon();
|
|
74
|
-
}
|
|
75
|
-
_updateSoon() {
|
|
76
|
-
setTimeout(() => {
|
|
77
|
-
if (!this._isDisposed) {
|
|
78
|
-
this._updateThrottler.queue(() => this._update());
|
|
79
|
-
}
|
|
80
|
-
}, 0);
|
|
81
|
-
}
|
|
82
|
-
async _update() {
|
|
83
|
-
const cellIndex = this._notebookViewModel.getCellIndex(this._cell);
|
|
84
|
-
const docUri = this._notebookViewModel.notebookDocument.uri;
|
|
85
|
-
const viewType = this._notebookViewModel.notebookDocument.viewType;
|
|
86
|
-
this._activeToken?.dispose(true);
|
|
87
|
-
const tokenSource = this._activeToken = ( new CancellationTokenSource());
|
|
88
|
-
const itemLists = await this._notebookCellStatusBarService.getStatusBarItemsForCell(docUri, cellIndex, viewType, tokenSource.token);
|
|
89
|
-
if (tokenSource.token.isCancellationRequested) {
|
|
90
|
-
itemLists.forEach(itemList => itemList.dispose && itemList.dispose());
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
const items = ( itemLists.map(itemList => itemList.items)).flat();
|
|
94
|
-
const newIds = this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds, [{ handle: this._cell.handle, items }]);
|
|
95
|
-
this._currentItemLists.forEach(itemList => itemList.dispose && itemList.dispose());
|
|
96
|
-
this._currentItemLists = itemLists;
|
|
97
|
-
this._currentItemIds = newIds;
|
|
98
|
-
}
|
|
99
|
-
dispose() {
|
|
100
|
-
super.dispose();
|
|
101
|
-
this._isDisposed = true;
|
|
102
|
-
this._activeToken?.dispose(true);
|
|
103
|
-
this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds, [{ handle: this._cell.handle, items: [] }]);
|
|
104
|
-
this._currentItemLists.forEach(itemList => itemList.dispose && itemList.dispose());
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
registerNotebookContribution(ContributedStatusBarItemController.id, ContributedStatusBarItemController);
|
|
108
|
-
|
|
109
|
-
export { ContributedStatusBarItemController };
|
package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
3
|
-
import { ResourceMap } from 'vscode/vscode/vs/base/common/map';
|
|
4
|
-
import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/language';
|
|
5
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
6
|
-
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
7
|
-
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
8
|
-
import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
|
|
9
|
-
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
10
|
-
import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
11
|
-
import { CHANGE_CELL_LANGUAGE, DETECT_CELL_LANGUAGE } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
|
|
12
|
-
import { INotebookCellStatusBarService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCellStatusBarService';
|
|
13
|
-
import { CellKind } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
14
|
-
import { INotebookKernelService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookKernelService';
|
|
15
|
-
import { INotebookService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookService';
|
|
16
|
-
import { ILanguageDetectionService } from 'vscode/vscode/vs/workbench/services/languageDetection/common/languageDetectionWorkerService';
|
|
17
|
-
|
|
18
|
-
let CellStatusBarLanguagePickerProvider = class CellStatusBarLanguagePickerProvider {
|
|
19
|
-
constructor(_notebookService, _languageService) {
|
|
20
|
-
this._notebookService = _notebookService;
|
|
21
|
-
this._languageService = _languageService;
|
|
22
|
-
this.viewType = '*';
|
|
23
|
-
}
|
|
24
|
-
async provideCellStatusBarItems(uri, index, _token) {
|
|
25
|
-
const doc = this._notebookService.getNotebookTextModel(uri);
|
|
26
|
-
const cell = doc?.cells[index];
|
|
27
|
-
if (!cell) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
const statusBarItems = [];
|
|
31
|
-
let displayLanguage = cell.language;
|
|
32
|
-
if (cell.cellKind === CellKind.Markup) {
|
|
33
|
-
displayLanguage = 'markdown';
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
const registeredId = this._languageService.getLanguageIdByLanguageName(cell.language);
|
|
37
|
-
if (registeredId) {
|
|
38
|
-
displayLanguage = this._languageService.getLanguageName(displayLanguage) ?? displayLanguage;
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
const searchTooltip = ( localizeWithPath(
|
|
42
|
-
'vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders',
|
|
43
|
-
'notebook.cell.status.searchLanguageExtensions',
|
|
44
|
-
"Unknown cell language. Click to search for '{0}' extensions",
|
|
45
|
-
cell.language
|
|
46
|
-
));
|
|
47
|
-
statusBarItems.push({
|
|
48
|
-
text: `$(dialog-warning)`,
|
|
49
|
-
command: { id: 'workbench.extensions.search', arguments: [`@tag:${cell.language}`], title: 'Search Extensions' },
|
|
50
|
-
tooltip: searchTooltip,
|
|
51
|
-
alignment: 2 ,
|
|
52
|
-
priority: -Number.MAX_SAFE_INTEGER + 1
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
statusBarItems.push({
|
|
57
|
-
text: displayLanguage,
|
|
58
|
-
command: CHANGE_CELL_LANGUAGE,
|
|
59
|
-
tooltip: ( localizeWithPath(
|
|
60
|
-
'vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders',
|
|
61
|
-
'notebook.cell.status.language',
|
|
62
|
-
"Select Cell Language Mode"
|
|
63
|
-
)),
|
|
64
|
-
alignment: 2 ,
|
|
65
|
-
priority: -Number.MAX_SAFE_INTEGER
|
|
66
|
-
});
|
|
67
|
-
return {
|
|
68
|
-
items: statusBarItems
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
CellStatusBarLanguagePickerProvider = ( __decorate([
|
|
73
|
-
( __param(0, INotebookService)),
|
|
74
|
-
( __param(1, ILanguageService))
|
|
75
|
-
], CellStatusBarLanguagePickerProvider));
|
|
76
|
-
let CellStatusBarLanguageDetectionProvider = class CellStatusBarLanguageDetectionProvider {
|
|
77
|
-
constructor(_notebookService, _notebookKernelService, _languageService, _configurationService, _languageDetectionService, _keybindingService) {
|
|
78
|
-
this._notebookService = _notebookService;
|
|
79
|
-
this._notebookKernelService = _notebookKernelService;
|
|
80
|
-
this._languageService = _languageService;
|
|
81
|
-
this._configurationService = _configurationService;
|
|
82
|
-
this._languageDetectionService = _languageDetectionService;
|
|
83
|
-
this._keybindingService = _keybindingService;
|
|
84
|
-
this.viewType = '*';
|
|
85
|
-
this.cache = ( new ResourceMap());
|
|
86
|
-
}
|
|
87
|
-
async provideCellStatusBarItems(uri, index, token) {
|
|
88
|
-
const doc = this._notebookService.getNotebookTextModel(uri);
|
|
89
|
-
const cell = doc?.cells[index];
|
|
90
|
-
if (!cell) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
const enablementConfig = this._configurationService.getValue('workbench.editor.languageDetectionHints');
|
|
94
|
-
const enabled = typeof enablementConfig === 'object' && enablementConfig?.notebookEditors;
|
|
95
|
-
if (!enabled) {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
const cellUri = cell.uri;
|
|
99
|
-
const contentVersion = cell.textModel?.getVersionId();
|
|
100
|
-
if (!contentVersion) {
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
const currentLanguageId = cell.cellKind === CellKind.Markup ?
|
|
104
|
-
'markdown' :
|
|
105
|
-
(this._languageService.getLanguageIdByLanguageName(cell.language) || cell.language);
|
|
106
|
-
if (!( this.cache.has(cellUri))) {
|
|
107
|
-
this.cache.set(cellUri, {
|
|
108
|
-
cellLanguage: currentLanguageId,
|
|
109
|
-
updateTimestamp: 0,
|
|
110
|
-
contentVersion: 1,
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
const cached = this.cache.get(cellUri);
|
|
114
|
-
if (cached.cellLanguage !== currentLanguageId || (cached.updateTimestamp < Date.now() - 1000 && cached.contentVersion !== contentVersion)) {
|
|
115
|
-
cached.updateTimestamp = Date.now();
|
|
116
|
-
cached.cellLanguage = currentLanguageId;
|
|
117
|
-
cached.contentVersion = contentVersion;
|
|
118
|
-
const kernel = this._notebookKernelService.getSelectedOrSuggestedKernel(doc);
|
|
119
|
-
if (kernel) {
|
|
120
|
-
const supportedLangs = [...kernel.supportedLanguages, 'markdown'];
|
|
121
|
-
cached.guess = await this._languageDetectionService.detectLanguage(cell.uri, supportedLangs);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
const items = [];
|
|
125
|
-
if (cached.guess && currentLanguageId !== cached.guess) {
|
|
126
|
-
const detectedName = this._languageService.getLanguageName(cached.guess) || cached.guess;
|
|
127
|
-
let tooltip = ( localizeWithPath(
|
|
128
|
-
'vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders',
|
|
129
|
-
'notebook.cell.status.autoDetectLanguage',
|
|
130
|
-
"Accept Detected Language: {0}",
|
|
131
|
-
detectedName
|
|
132
|
-
));
|
|
133
|
-
const keybinding = this._keybindingService.lookupKeybinding(DETECT_CELL_LANGUAGE);
|
|
134
|
-
const label = keybinding?.getLabel();
|
|
135
|
-
if (label) {
|
|
136
|
-
tooltip += ` (${label})`;
|
|
137
|
-
}
|
|
138
|
-
items.push({
|
|
139
|
-
text: '$(lightbulb-autofix)',
|
|
140
|
-
command: DETECT_CELL_LANGUAGE,
|
|
141
|
-
tooltip,
|
|
142
|
-
alignment: 2 ,
|
|
143
|
-
priority: -Number.MAX_SAFE_INTEGER + 1
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
return { items };
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
CellStatusBarLanguageDetectionProvider = ( __decorate([
|
|
150
|
-
( __param(0, INotebookService)),
|
|
151
|
-
( __param(1, INotebookKernelService)),
|
|
152
|
-
( __param(2, ILanguageService)),
|
|
153
|
-
( __param(3, IConfigurationService)),
|
|
154
|
-
( __param(4, ILanguageDetectionService)),
|
|
155
|
-
( __param(5, IKeybindingService))
|
|
156
|
-
], CellStatusBarLanguageDetectionProvider));
|
|
157
|
-
let BuiltinCellStatusBarProviders = class BuiltinCellStatusBarProviders extends Disposable {
|
|
158
|
-
constructor(instantiationService, notebookCellStatusBarService) {
|
|
159
|
-
super();
|
|
160
|
-
const builtinProviders = [
|
|
161
|
-
CellStatusBarLanguagePickerProvider,
|
|
162
|
-
CellStatusBarLanguageDetectionProvider,
|
|
163
|
-
];
|
|
164
|
-
builtinProviders.forEach(p => {
|
|
165
|
-
this._register(notebookCellStatusBarService.registerCellStatusBarItemProvider(instantiationService.createInstance(p)));
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
BuiltinCellStatusBarProviders = ( __decorate([
|
|
170
|
-
( __param(0, IInstantiationService)),
|
|
171
|
-
( __param(1, INotebookCellStatusBarService))
|
|
172
|
-
], BuiltinCellStatusBarProviders));
|
|
173
|
-
( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(BuiltinCellStatusBarProviders, 3 );
|