@codingame/monaco-vscode-api 33.0.3 → 33.0.5
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/package.json +9 -9
- package/services.js +3 -3
- package/vscode/src/vs/platform/product/common/product.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.d.ts +0 -26
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOperations.js +0 -746
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +0 -300
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +0 -55
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.d.ts +0 -273
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +0 -1963
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.d.ts +0 -50
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +0 -314
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.d.ts +0 -258
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +0 -886
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.d.ts +0 -41
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +0 -118
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/editorHeightCalculator.d.ts +0 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/editorHeightCalculator.js +0 -71
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.d.ts +0 -27
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +0 -40
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookCellDiffDecorator.d.ts +0 -23
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookCellDiffDecorator.js +0 -313
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookDeletedCellDecorator.d.ts +0 -51
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookDeletedCellDecorator.js +0 -265
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiff.d.ts +0 -24
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiff.js +0 -185
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiffWidget.d.ts +0 -28
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInlineDiffWidget.js +0 -104
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInsertedCellDecorator.d.ts +0 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookInsertedCellDecorator.js +0 -43
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory.d.ts +0 -21
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalCellModelFactory.js +0 -41
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalModelRefFactory.d.ts +0 -25
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookOriginalModelRefFactory.js +0 -69
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css +0 -469
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.d.ts +0 -149
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +0 -933
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.d.ts +0 -180
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +0 -32
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.d.ts +0 -102
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +0 -643
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.d.ts +0 -30
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +0 -197
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel.d.ts +0 -75
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffViewModel.js +0 -539
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/unchangedEditorRegions.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/unchangedEditorRegions.js +0 -39
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookMetadataTextModel.d.ts +0 -19
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookMetadataTextModel.js +0 -90
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiff.d.ts +0 -26
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiff.js +0 -92
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { toFormattedString } from '../../../../../base/common/jsonFormatter.js';
|
|
3
|
-
import { NotebookMetadataUri, NotebookCellsChangeType } from '../notebookCommon.js';
|
|
4
|
-
import { StringSHA1 } from '../../../../../base/common/hash.js';
|
|
5
|
-
import { Disposable } from '../../../../../base/common/lifecycle.js';
|
|
6
|
-
import { DefaultEndOfLine, EndOfLinePreference } from '../../../../../editor/common/model.js';
|
|
7
|
-
import { Emitter } from '../../../../../base/common/event.js';
|
|
8
|
-
import { Range } from '../../../../../editor/common/core/range.js';
|
|
9
|
-
import { createTextBuffer } from '../../../../../editor/common/model/textModel.js';
|
|
10
|
-
|
|
11
|
-
function getFormattedNotebookMetadataJSON(transientMetadata, metadata) {
|
|
12
|
-
let filteredMetadata = {};
|
|
13
|
-
if (transientMetadata) {
|
|
14
|
-
const keys = ( new Set([...( Object.keys(metadata))]));
|
|
15
|
-
for (const key of keys) {
|
|
16
|
-
if (!(transientMetadata[key])) {
|
|
17
|
-
filteredMetadata[key] = metadata[key];
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
} else {
|
|
21
|
-
filteredMetadata = metadata;
|
|
22
|
-
}
|
|
23
|
-
const metadataSource = toFormattedString(filteredMetadata, {});
|
|
24
|
-
return metadataSource;
|
|
25
|
-
}
|
|
26
|
-
class NotebookDocumentMetadataTextModel extends Disposable {
|
|
27
|
-
get metadata() {
|
|
28
|
-
return this.notebookModel.metadata;
|
|
29
|
-
}
|
|
30
|
-
get textBuffer() {
|
|
31
|
-
if (this._textBuffer) {
|
|
32
|
-
return this._textBuffer;
|
|
33
|
-
}
|
|
34
|
-
const source = getFormattedNotebookMetadataJSON(
|
|
35
|
-
this.notebookModel.transientOptions.transientDocumentMetadata,
|
|
36
|
-
this.metadata
|
|
37
|
-
);
|
|
38
|
-
this._textBuffer = this._register(createTextBuffer(source, DefaultEndOfLine.LF).textBuffer);
|
|
39
|
-
this._register(this._textBuffer.onDidChangeContent(() => {
|
|
40
|
-
this._onDidChange.fire();
|
|
41
|
-
}));
|
|
42
|
-
return this._textBuffer;
|
|
43
|
-
}
|
|
44
|
-
constructor(notebookModel) {
|
|
45
|
-
super();
|
|
46
|
-
this.notebookModel = notebookModel;
|
|
47
|
-
this._onDidChange = this._register(( new Emitter()));
|
|
48
|
-
this.onDidChange = this._onDidChange.event;
|
|
49
|
-
this._textBufferHash = null;
|
|
50
|
-
this.uri = NotebookMetadataUri.generate(this.notebookModel.uri);
|
|
51
|
-
this._register(this.notebookModel.onDidChangeContent(e => {
|
|
52
|
-
if (( e.rawEvents.some(
|
|
53
|
-
event => event.kind === NotebookCellsChangeType.ChangeDocumentMetadata || event.kind === NotebookCellsChangeType.ModelChange
|
|
54
|
-
))) {
|
|
55
|
-
this._textBuffer?.dispose();
|
|
56
|
-
this._textBuffer = undefined;
|
|
57
|
-
this._textBufferHash = null;
|
|
58
|
-
this._onDidChange.fire();
|
|
59
|
-
}
|
|
60
|
-
}));
|
|
61
|
-
}
|
|
62
|
-
getHash() {
|
|
63
|
-
if (this._textBufferHash !== null) {
|
|
64
|
-
return this._textBufferHash;
|
|
65
|
-
}
|
|
66
|
-
const shaComputer = ( new StringSHA1());
|
|
67
|
-
const snapshot = this.textBuffer.createSnapshot(false);
|
|
68
|
-
let text;
|
|
69
|
-
while ((text = snapshot.read())) {
|
|
70
|
-
shaComputer.update(text);
|
|
71
|
-
}
|
|
72
|
-
this._textBufferHash = shaComputer.digest();
|
|
73
|
-
return this._textBufferHash;
|
|
74
|
-
}
|
|
75
|
-
getValue() {
|
|
76
|
-
const fullRange = this.getFullModelRange();
|
|
77
|
-
const eol = this.textBuffer.getEOL();
|
|
78
|
-
if (eol === "\n") {
|
|
79
|
-
return this.textBuffer.getValueInRange(fullRange, EndOfLinePreference.LF);
|
|
80
|
-
} else {
|
|
81
|
-
return this.textBuffer.getValueInRange(fullRange, EndOfLinePreference.CRLF);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
getFullModelRange() {
|
|
85
|
-
const lineCount = this.textBuffer.getLineCount();
|
|
86
|
-
return ( new Range(1, 1, lineCount, this.textBuffer.getLineLength(lineCount) + 1));
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export { NotebookDocumentMetadataTextModel, getFormattedNotebookMetadataJSON };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { CellKind, INotebookDiffResult } from "./notebookCommon.js";
|
|
2
|
-
export type CellDiffInfo = {
|
|
3
|
-
originalCellIndex: number;
|
|
4
|
-
modifiedCellIndex: number;
|
|
5
|
-
type: "unchanged" | "modified";
|
|
6
|
-
} | {
|
|
7
|
-
originalCellIndex: number;
|
|
8
|
-
type: "delete";
|
|
9
|
-
} | {
|
|
10
|
-
modifiedCellIndex: number;
|
|
11
|
-
type: "insert";
|
|
12
|
-
};
|
|
13
|
-
interface ICell {
|
|
14
|
-
cellKind: CellKind;
|
|
15
|
-
getHashValue(): number;
|
|
16
|
-
equal(cell: ICell): boolean;
|
|
17
|
-
}
|
|
18
|
-
export declare function computeDiff(originalModel: {
|
|
19
|
-
readonly cells: readonly ICell[];
|
|
20
|
-
}, modifiedModel: {
|
|
21
|
-
readonly cells: readonly ICell[];
|
|
22
|
-
}, diffResult: INotebookDiffResult): {
|
|
23
|
-
cellDiffInfo: CellDiffInfo[];
|
|
24
|
-
firstChangeIndex: number;
|
|
25
|
-
};
|
|
26
|
-
export {};
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function computeDiff(originalModel, modifiedModel, diffResult) {
|
|
4
|
-
const cellChanges = diffResult.cellsDiff.changes;
|
|
5
|
-
const cellDiffInfo = [];
|
|
6
|
-
let originalCellIndex = 0;
|
|
7
|
-
let modifiedCellIndex = 0;
|
|
8
|
-
let firstChangeIndex = -1;
|
|
9
|
-
for (let i = 0; i < cellChanges.length; i++) {
|
|
10
|
-
const change = cellChanges[i];
|
|
11
|
-
for (let j = 0; j < change.originalStart - originalCellIndex; j++) {
|
|
12
|
-
const originalCell = originalModel.cells[originalCellIndex + j];
|
|
13
|
-
const modifiedCell = modifiedModel.cells[modifiedCellIndex + j];
|
|
14
|
-
if (originalCell.getHashValue() === modifiedCell.getHashValue()) {
|
|
15
|
-
cellDiffInfo.push({
|
|
16
|
-
originalCellIndex: originalCellIndex + j,
|
|
17
|
-
modifiedCellIndex: modifiedCellIndex + j,
|
|
18
|
-
type: 'unchanged'
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
if (firstChangeIndex === -1) {
|
|
23
|
-
firstChangeIndex = cellDiffInfo.length;
|
|
24
|
-
}
|
|
25
|
-
cellDiffInfo.push({
|
|
26
|
-
originalCellIndex: originalCellIndex + j,
|
|
27
|
-
modifiedCellIndex: modifiedCellIndex + j,
|
|
28
|
-
type: 'modified'
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
const modifiedLCS = computeModifiedLCS(change, originalModel, modifiedModel);
|
|
33
|
-
if (modifiedLCS.length && firstChangeIndex === -1) {
|
|
34
|
-
firstChangeIndex = cellDiffInfo.length;
|
|
35
|
-
}
|
|
36
|
-
cellDiffInfo.push(...modifiedLCS);
|
|
37
|
-
originalCellIndex = change.originalStart + change.originalLength;
|
|
38
|
-
modifiedCellIndex = change.modifiedStart + change.modifiedLength;
|
|
39
|
-
}
|
|
40
|
-
for (let i = originalCellIndex; i < originalModel.cells.length; i++) {
|
|
41
|
-
cellDiffInfo.push({
|
|
42
|
-
originalCellIndex: i,
|
|
43
|
-
modifiedCellIndex: i - originalCellIndex + modifiedCellIndex,
|
|
44
|
-
type: 'unchanged'
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
return {
|
|
48
|
-
cellDiffInfo,
|
|
49
|
-
firstChangeIndex
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
function computeModifiedLCS(change, originalModel, modifiedModel) {
|
|
53
|
-
const result = [];
|
|
54
|
-
const modifiedLen = Math.min(change.originalLength, change.modifiedLength);
|
|
55
|
-
for (let j = 0; j < modifiedLen; j++) {
|
|
56
|
-
const originalCell = originalModel.cells[change.originalStart + j];
|
|
57
|
-
const modifiedCell = modifiedModel.cells[change.modifiedStart + j];
|
|
58
|
-
if (originalCell.cellKind !== modifiedCell.cellKind) {
|
|
59
|
-
result.push({
|
|
60
|
-
originalCellIndex: change.originalStart + j,
|
|
61
|
-
type: 'delete'
|
|
62
|
-
});
|
|
63
|
-
result.push({
|
|
64
|
-
modifiedCellIndex: change.modifiedStart + j,
|
|
65
|
-
type: 'insert'
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
const isTheSame = originalCell.equal(modifiedCell);
|
|
70
|
-
result.push({
|
|
71
|
-
originalCellIndex: change.originalStart + j,
|
|
72
|
-
modifiedCellIndex: change.modifiedStart + j,
|
|
73
|
-
type: isTheSame ? 'unchanged' : 'modified'
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
for (let j = modifiedLen; j < change.originalLength; j++) {
|
|
78
|
-
result.push({
|
|
79
|
-
originalCellIndex: change.originalStart + j,
|
|
80
|
-
type: 'delete'
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
for (let j = modifiedLen; j < change.modifiedLength; j++) {
|
|
84
|
-
result.push({
|
|
85
|
-
modifiedCellIndex: change.modifiedStart + j,
|
|
86
|
-
type: 'insert'
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
return result;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export { computeDiff };
|