Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notebook exploration #86632

Merged
merged 319 commits into from
Mar 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
319 commits
Select commit Hold shift + click to select a range
55d2140
dirty state update
rebornix Jan 22, 2020
77b395f
Update notebook test extension for new API.
rebornix Jan 22, 2020
7d47821
default langauges
rebornix Jan 22, 2020
42b45bb
Delete cell
rebornix Jan 23, 2020
a0d8ac1
jpeg rendering
rebornix Jan 24, 2020
0385552
Update line breaks
rebornix Jan 24, 2020
7d2c56a
Editor resize with view line change
rebornix Jan 24, 2020
7100934
css update for markdown
rebornix Jan 26, 2020
3cfaf1b
Support markdown in output
rebornix Jan 26, 2020
ed12c87
Typing latency: avoid unncessary dirty change (leads to 80ms per typi…
rebornix Jan 26, 2020
f4938e3
destory notebook should clear both core and ext host.
rebornix Jan 27, 2020
dcc4ed5
Merge remote-tracking branch 'origin/master' into rebornix/notebook
rebornix Jan 27, 2020
38dfdc9
Edit cell with enter
rebornix Jan 28, 2020
9375c9a
Focus cell
rebornix Jan 30, 2020
eb43b41
Esacpe a markdown cell should exit preview mode
rebornix Jan 31, 2020
97fd062
Uri.file for cross os.
rebornix Feb 3, 2020
1d71d49
Merge remote-tracking branch 'origin/master' into rebornix/notebook
rebornix Feb 3, 2020
f2e0c33
Adopt content size event from monaco editor.
rebornix Feb 4, 2020
86fd51d
event listener for statefull markdown
rebornix Feb 6, 2020
ddb1795
move markdown cell renderer out
rebornix Feb 6, 2020
330f6f7
CellViewModel
rebornix Feb 6, 2020
3368403
Cell renderer with right disposals
rebornix Feb 6, 2020
7445e35
Code refactoring
rebornix Feb 6, 2020
1fea3ae
💄
rebornix Feb 7, 2020
8a77280
💄
rebornix Feb 7, 2020
700dfa7
setter/getter for dynamic height
rebornix Feb 7, 2020
f46d2fc
doc update for typings
rebornix Feb 7, 2020
c78a869
Merge remote-tracking branch 'origin/master' into rebornix/notebook
rebornix Feb 7, 2020
50751af
Remove initial dimension update
rebornix Feb 7, 2020
90ab42e
remove script tag check in webview
rebornix Feb 7, 2020
88fd5ab
update scroll handler
rebornix Feb 7, 2020
54a5a6e
application/javascript
rebornix Feb 7, 2020
6bbdfe0
svg
rebornix Feb 7, 2020
f53b0eb
json editor
rebornix Feb 7, 2020
2790c0b
Merge remote-tracking branch 'origin/master' into rebornix/notebook
rebornix Feb 10, 2020
aec1335
Refactoring and latex support.
rebornix Feb 12, 2020
df477bc
contributed output renderer first cut
rebornix Feb 12, 2020
64a3d6c
Nteract renderers.
rebornix Feb 13, 2020
612a935
Merge remote-tracking branch 'origin/master' into rebornix/notebook
rebornix Feb 13, 2020
7d12ce5
list view set row height option
rebornix Feb 13, 2020
298a5d0
Move typings to common.
rebornix Feb 13, 2020
20f4cbf
Update preload scripts for notebook renderer
rebornix Feb 14, 2020
2d99b7d
output chagne event
rebornix Feb 14, 2020
7faf159
nteract renderer
rebornix Feb 14, 2020
1adc63c
Refactoring: IoC.
rebornix Feb 15, 2020
7de343c
Move notebookActions to separate module.
rebornix Feb 15, 2020
6f8fd62
Errorless
rebornix Feb 15, 2020
81cfb89
public by default
rebornix Feb 15, 2020
55d34d7
No ambiguous naming.
rebornix Feb 15, 2020
7e74dc8
handler -> notebookEditor
rebornix Feb 15, 2020
059527f
add ICellDto, use UriComponents
jrieken Feb 17, 2020
6395ca1
use registerAction2-todo
jrieken Feb 17, 2020
ebb2e25
add CellContentProvider, more injection
jrieken Feb 17, 2020
ae304b3
authority is not case sensitive.
rebornix Feb 17, 2020
ac800b7
Update notebook cells
rebornix Feb 17, 2020
1417090
extract code cell updates
rebornix Feb 17, 2020
49ebc84
No latex handler in core.
rebornix Feb 17, 2020
7f28579
💄
rebornix Feb 17, 2020
a88978b
Display Order first cut.
rebornix Feb 18, 2020
18cadef
check for scheme when parsing cell-uri
jrieken Feb 18, 2020
fc46070
towards code navigation...
jrieken Feb 18, 2020
6db3625
add ICell#uri and expose INotebook#viewType
jrieken Feb 18, 2020
25fc954
add IEditorNavigation, remove custom ICodeEditorService because that …
jrieken Feb 18, 2020
796c2ba
Diff for cells and outputs in exthost.
rebornix Feb 19, 2020
4bced15
notebook cell update with renderer updates.
rebornix Feb 19, 2020
c46f92e
Cell insertion/deletion in notebook editor list view.
rebornix Feb 19, 2020
e485c82
No unused args.
rebornix Feb 19, 2020
a4e9073
registerAction2
rebornix Feb 19, 2020
de5e408
🌩static height code cell with relayout.
rebornix Feb 19, 2020
2db9e68
unused import
jrieken Feb 19, 2020
1541d57
Merge branch 'master' into rebornix/notebook
jrieken Feb 19, 2020
6bc2ba7
adopt workbench changes
jrieken Feb 19, 2020
315b240
use ICompositeCodeEditor instead IEditorNavigation
jrieken Feb 19, 2020
594dd0b
command handler honor composite code editor
jrieken Feb 19, 2020
a8d8035
forward list events as editor change events
jrieken Feb 19, 2020
bc4b343
don't check for composite code editor in commands handler
jrieken Feb 19, 2020
5c32f22
forward active (nested) editor event from composite code editors, mak…
jrieken Feb 19, 2020
673d983
Merge remote-tracking branch 'origin' into rebornix/notebook
rebornix Feb 19, 2020
604cee1
size/offset trackers for individual output
rebornix Feb 20, 2020
afd83b5
ignore empty splice events.
rebornix Feb 20, 2020
0c3e12a
remove webview change.
rebornix Feb 20, 2020
6f88d16
Merge remote-tracking branch 'origin/master' into rebornix/notebook
rebornix Feb 20, 2020
fc97748
No webview workarounds.
rebornix Feb 20, 2020
0fcff50
wire notebook editor restore logic but keep it disabled due to notebo…
jrieken Feb 20, 2020
24a5860
revert markdown change
rebornix Feb 20, 2020
fb12bf9
Merge branch 'master' into rebornix/notebook
rebornix Feb 20, 2020
f524bea
Merge remote-tracking branch 'origin/master' into rebornix/notebook
rebornix Feb 20, 2020
5a21f02
Merge branch 'master' into rebornix/notebook
rebornix Feb 20, 2020
33f008e
adopt scrollable element event
rebornix Feb 20, 2020
3d53af1
move more notebook list logic out
rebornix Feb 20, 2020
83a30d7
more list
rebornix Feb 20, 2020
6579aba
document why domFocus in notebook is different from normal list
rebornix Feb 20, 2020
61c5456
Merge branch 'master' into rebornix/notebook
rebornix Feb 20, 2020
679a008
empty line
rebornix Feb 20, 2020
cc14e23
typings for notebook settings.
rebornix Feb 20, 2020
88fe192
fix file saving
rebornix Feb 20, 2020
0ec2804
we still need input checkbox
rebornix Feb 20, 2020
7ff6e76
Fix enter keybinding for notebook list
rebornix Feb 20, 2020
b01035a
Focus still not working actually.
rebornix Feb 20, 2020
62f68fe
hide console log
rebornix Feb 20, 2020
ff5e746
activate extension by notebook view type
rebornix Feb 20, 2020
b5804fa
Updating cell state when destorying it is not good
rebornix Feb 21, 2020
33fe974
make sure view cells are disposed
jrieken Feb 21, 2020
ee7bb4f
Merge branch 'master' into rebornix/notebook
jrieken Feb 21, 2020
214e4df
remove commented type
jrieken Feb 21, 2020
d911177
Focus editor when creating new cells
rebornix Feb 21, 2020
09a8143
No additional event triggering for crud from core.
rebornix Feb 21, 2020
d00f117
Mimetype picker first cut.
rebornix Feb 21, 2020
bb8216b
some padding for output
rebornix Feb 21, 2020
01426ff
resizeobserver does not include padding.
rebornix Feb 21, 2020
ab1a981
Tokenization.
rebornix Feb 24, 2020
8e6f63b
regex obj is statefull ;(
rebornix Feb 24, 2020
22ffffb
disposables
rebornix Feb 24, 2020
c9789ee
spacing around the editor
rebornix Feb 24, 2020
f5ad712
fix transformed output rendering for nteract.
rebornix Feb 24, 2020
298461e
cell layout
rebornix Feb 25, 2020
cef3c06
find widget attempt
rebornix Feb 25, 2020
dc0ed1a
Update element height
rebornix Feb 26, 2020
b42d1d5
remove unused list hack
rebornix Feb 26, 2020
1ff083c
container dom node
rebornix Feb 26, 2020
3856d31
no scroll height update hack
rebornix Feb 26, 2020
352bbf2
list view update height refactoring
rebornix Feb 26, 2020
ae075e9
public is default
rebornix Feb 26, 2020
ad43402
we don't need dynamic height change anymore
rebornix Feb 26, 2020
fa0fef8
isRendering is not needed if we push everything to next frame
rebornix Feb 26, 2020
f3780d9
Merge remote-tracking branch 'origin' into rebornix/notebook
rebornix Feb 26, 2020
76e1c59
no isrendering
rebornix Feb 26, 2020
8dbf9b2
Find Widget typings
rebornix Feb 27, 2020
1dd89fc
Merge remote-tracking branch 'origin/rebornix/listview-item-heightcha…
rebornix Feb 27, 2020
9502753
update update element height callers
rebornix Feb 28, 2020
e0107f4
not test folder in core anymore
rebornix Feb 28, 2020
eed9a7b
Merge remote-tracking branch 'origin' into rebornix/notebook
rebornix Feb 28, 2020
285c61d
add renderer extension folder to webview allowed resource list
rebornix Feb 28, 2020
3f4fccc
Merge remote-tracking branch 'origin' into rebornix/notebook
rebornix Feb 28, 2020
572dd51
support picking renderers for the same mimetype
rebornix Feb 28, 2020
ee27322
Reduce scrolling position updates
rebornix Feb 29, 2020
e0b9c76
Fix markdown editing height update.
rebornix Mar 1, 2020
209c2e7
List Output resize flashing.
rebornix Mar 2, 2020
a11145e
update mimetype renderer
rebornix Mar 2, 2020
fe67100
Update code cell mimetype picker rendering
rebornix Mar 2, 2020
110c35e
update picked item in quick pick
rebornix Mar 2, 2020
66bdaba
TODO for display order
rebornix Mar 2, 2020
a03546f
scroll webview container instead of scrolling the content inside.
rebornix Mar 2, 2020
cddc990
Merge branch 'master' into rebornix/notebook
jrieken Mar 3, 2020
93ad98c
adopt API changes in notebook land
jrieken Mar 3, 2020
6cd184e
no composite code editor knowledge in EditorService (but still in Cod…
jrieken Mar 3, 2020
764b2ae
Add/Delete cell with right model update.
rebornix Mar 3, 2020
c5f0808
Fix folding issue.
rebornix Mar 3, 2020
9887d9b
NotebookViewModel and tests
rebornix Mar 3, 2020
882ae1e
no unverified commit
rebornix Mar 4, 2020
a3f5a85
fix cell editing
rebornix Mar 4, 2020
1a63d4d
more typings error after adopting const enum
rebornix Mar 4, 2020
eec843a
Merge branch 'master' into rebornix/notebook
jrieken Mar 4, 2020
fc10037
Merge branch 'master' into rebornix/notebook
jrieken Mar 4, 2020
1d4da40
adopt list API changes
jrieken Mar 4, 2020
76eb17e
layer check
rebornix Mar 4, 2020
93a642b
two more layer break
rebornix Mar 4, 2020
c4c3fdc
tests for mimetype ordering
rebornix Mar 4, 2020
e8c3f85
unit tests for diffing
rebornix Mar 4, 2020
8cc3a0d
fix glob pattern matching on windows
rebornix Mar 4, 2020
568a529
no glob pattern pre parsing
rebornix Mar 4, 2020
0192291
disposables
rebornix Mar 4, 2020
effab81
Fix finding active notebook editor
rebornix Mar 5, 2020
285d89e
Merge remote-tracking branch 'origin/master' into rebornix/notebook
rebornix Mar 5, 2020
2451b72
Update webview
rebornix Mar 5, 2020
a4a17ae
store view states for cells
rebornix Mar 5, 2020
ad22aa2
save & restore all editor view states
rebornix Mar 5, 2020
fda49c0
Merge remote-tracking branch 'origin/master' into rebornix/notebook
rebornix Mar 5, 2020
2af6cc1
npe
rebornix Mar 5, 2020
3c2ef65
Fix #91498.
rebornix Mar 5, 2020
c0b268b
EditorService#activeTextEditorControl knows about composite code editor
jrieken Mar 6, 2020
e5ebccc
better folder organization
rebornix Mar 6, 2020
8f081ef
lazy decoration for cells.
rebornix Mar 6, 2020
4de61f3
use uuid instead of handle as decoration prefix
rebornix Mar 7, 2020
b5473f5
reveal cell into view.
rebornix Mar 7, 2020
43ee60f
Test editor
rebornix Mar 7, 2020
7e7e5d9
fix css import
jrieken Mar 9, 2020
4adf8bf
fix double model issue
jrieken Mar 9, 2020
82ecf89
use `overrideOpenEditor` to open a cell-uri as notebook editor, use N…
jrieken Mar 9, 2020
e933381
fix cycling dependency, more rich cell-options
jrieken Mar 9, 2020
c402304
dispose view model properly
rebornix Mar 9, 2020
7457754
active find match
rebornix Mar 9, 2020
69d2a45
reveal function call
rebornix Mar 9, 2020
d8df542
track newly created view cell in notebookviewmodel
rebornix Mar 9, 2020
40b4199
reveal line into view center
rebornix Mar 9, 2020
2be2c20
:lipstick:
rebornix Mar 9, 2020
8aac73b
abstract notebook editor layout info
rebornix Mar 9, 2020
18b4045
remove unused typings
rebornix Mar 9, 2020
1387211
document INotebookEditor.
rebornix Mar 9, 2020
58140d3
scroll line into view
rebornix Mar 10, 2020
52ea4ff
Merge branch 'master' into rebornix/notebook
jrieken Mar 10, 2020
a8f61a8
remove ICompositeCodeEditor#activate
jrieken Mar 10, 2020
98c180c
add Iterable.filter and use it
jrieken Mar 10, 2020
6ed0201
first reveal a cell, then check for its editor
jrieken Mar 10, 2020
c1ec410
create cell uri on the extension host, expose as `NotebookCell#uri`
jrieken Mar 10, 2020
990cc85
add CellUri-util but don't use it yet
jrieken Mar 10, 2020
ae4a4f8
event once for cell editor opening
rebornix Mar 10, 2020
d1354bb
adopt CellUri
jrieken Mar 11, 2020
540fbab
fix resources#isEqual
jrieken Mar 11, 2020
0c1eb03
Revert "fix resources#isEqual"
jrieken Mar 11, 2020
922ff01
don't use isEqual for now
jrieken Mar 11, 2020
d4385d7
consolidate reveal range/line
rebornix Mar 10, 2020
c6c0385
reveal search result in center in markdown cell
rebornix Mar 11, 2020
e17815a
set selection for cell
rebornix Mar 12, 2020
4c58ef4
test notebook editor
rebornix Mar 12, 2020
a036618
Add ctrl+enter to execute cell and go to next
roblourens Mar 10, 2020
e814a19
Add option+enter and shift+enter commands
roblourens Mar 10, 2020
3f3dcf1
Add commands to convert cell to markdown/code
roblourens Mar 11, 2020
a9b5966
Merge pull request #92404 from microsoft/roblou/focusNextCellAfterExe…
roblourens Mar 12, 2020
e8dae6d
do not allow attach editor without model
rebornix Mar 12, 2020
4aa13a5
find in markdown content
rebornix Mar 12, 2020
35b5132
:lipstick:
rebornix Mar 13, 2020
a6af569
Add a toolbar with some basic actions
roblourens Mar 12, 2020
ce863ce
Add alt actions to some toolbar items
roblourens Mar 13, 2020
ecb6fc3
Fix merge mistake
roblourens Mar 13, 2020
f48e190
cursor movement first cut
rebornix Mar 13, 2020
24c6547
cell state instead of isEditing boolean
rebornix Mar 13, 2020
bc94d62
update state and editing mode when focus to the container
rebornix Mar 13, 2020
0faba33
ICellViewModel
rebornix Mar 13, 2020
befaab5
ICellViewModel only visible to contrib
rebornix Mar 13, 2020
6cc118c
Find & Replace Widget
rebornix Mar 14, 2020
508dead
list view resize: anchored element will keep its visual position
rebornix Mar 14, 2020
589b523
Scroll cell into view major update:
rebornix Mar 14, 2020
9675f47
NPE check find
rebornix Mar 16, 2020
e6fd2cf
move output height calculation internal
rebornix Mar 16, 2020
5798020
Merge branch 'rebornix/notebook' into roblou/addToolbar
rebornix Mar 16, 2020
635c2f2
toolbar height
rebornix Mar 16, 2020
4996dcd
Merge pull request #92593 from microsoft/roblou/addToolbar
rebornix Mar 16, 2020
c41d631
move cell padding height to constants
rebornix Mar 16, 2020
d256d56
replace first cut
rebornix Mar 16, 2020
cdfd6ec
Merge remote-tracking branch 'origin/master' into rebornix/notebook
rebornix Mar 16, 2020
e66dc83
Undo/Redo for cell manipulation
rebornix Mar 16, 2020
5f4f23f
Fix test errors
rebornix Mar 17, 2020
c7eff5b
progress bar for find and replace
rebornix Mar 17, 2020
9b235ba
scrollTop should never be negative
rebornix Mar 17, 2020
2c92a70
Use container height for markdown cell, consider separate MarkdownVie…
rebornix Mar 17, 2020
b8840e4
revert viewlines change..
rebornix Mar 17, 2020
d9b9cfe
Reveal range after editor is initialized.
rebornix Mar 17, 2020
8e72cca
Persist cell data when delete cell content.
rebornix Mar 17, 2020
9bb2c9d
TextModel and CellTextMode. Separate dirty state from text model.
rebornix Mar 18, 2020
8c81d9a
move ICompositeCodeEditor to editor-layer
jrieken Mar 18, 2020
542818b
Fix cursor movement not revealing cell into view
rebornix Mar 18, 2020
915d3da
create new cell should be stateless
rebornix Mar 18, 2020
bef8944
:lipstick:
rebornix Mar 18, 2020
58afb2b
:lipstick:
rebornix Mar 18, 2020
5194415
Merge remote-tracking branch 'origin/master' into rebornix/notebook
rebornix Mar 18, 2020
164c169
remove markdown sanity check change
rebornix Mar 18, 2020
fcf9d81
remove find controller reveal change
rebornix Mar 18, 2020
d5ef90d
revert simple find widget change
rebornix Mar 18, 2020
0054a89
Merge branch 'master' into rebornix/notebook
rebornix Mar 18, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions build/lib/i18n.resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@
"name": "vs/workbench/contrib/preferences",
"project": "vscode-workbench"
},
{
"name": "vs/workbench/contrib/notebook",
"project": "vscode-workbench"
},
{
"name": "vs/workbench/contrib/quickaccess",
"project": "vscode-workbench"
Expand Down
24 changes: 21 additions & 3 deletions src/vs/base/browser/ui/list/listView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,18 +279,32 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
this.scrollableElement.triggerScrollFromMouseWheelEvent(browserEvent);
}

updateElementHeight(index: number, size: number): void {
updateElementHeight(index: number, size: number, anchorIndex: number | null): void {
if (this.items[index].size === size) {
return;
}

const lastRenderRange = this.getRenderRange(this.lastRenderTop, this.lastRenderHeight);

const heightDiff = index < lastRenderRange.start ? size - this.items[index].size : 0;
let heightDiff = 0;

if (index < lastRenderRange.start) {
// do not scroll the viewport if resized element is out of viewport
heightDiff = size - this.items[index].size;
} else {
if (anchorIndex !== null && anchorIndex > index && anchorIndex <= lastRenderRange.end) {
// anchor in viewport
// resized elemnet in viewport and above the anchor
heightDiff = size - this.items[index].size;
} else {
heightDiff = 0;
}
}

this.rangeMap.splice(index, 1, [{ size: size }]);
this.items[index].size = size;

this.render(lastRenderRange, this.lastRenderTop + heightDiff, this.lastRenderHeight, undefined, undefined, true);
this.render(lastRenderRange, Math.max(0, this.lastRenderTop + heightDiff), this.lastRenderHeight, undefined, undefined, true);

this.eventuallyUpdateScrollDimensions();

Expand Down Expand Up @@ -1134,6 +1148,10 @@ export class ListView<T> implements ISpliceable<T>, IDisposable {
return 0;
}

if (!!this.virtualDelegate.hasDynamicHeight && !this.virtualDelegate.hasDynamicHeight(item.element)) {
return 0;
}

const size = item.size;

if (!this.setRowHeight && item.row && item.row.domNode) {
Expand Down
2 changes: 1 addition & 1 deletion src/vs/base/browser/ui/list/listWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1314,7 +1314,7 @@ export class List<T> implements ISpliceable<T>, IDisposable {
}

updateElementHeight(index: number, size: number): void {
this.view.updateElementHeight(index, size);
this.view.updateElementHeight(index, size, null);
}

rerender(): void {
Expand Down
10 changes: 9 additions & 1 deletion src/vs/base/common/iterator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,15 @@ export namespace Iterable {
return false;
}

export function* map<T, R>(iterable: Iterable<T>, fn: (t: T) => R): IterableIterator<R> {
export function* filter<T>(iterable: Iterable<T>, predicate: (t: T) => boolean): Iterable<T> {
for (const element of iterable) {
if (predicate(element)) {
return yield element;
}
}
}

export function* map<T, R>(iterable: Iterable<T>, fn: (t: T) => R): Iterable<R> {
for (const element of iterable) {
return yield fn(element);
}
Expand Down
10 changes: 10 additions & 0 deletions src/vs/editor/browser/editorBrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,16 @@ export function isDiffEditor(thing: any): thing is IDiffEditor {
}
}

/**
*@internal
*/
export function isCompositeEditor(thing: any): thing is editorCommon.ICompositeCodeEditor {
return thing
&& typeof thing === 'object'
&& typeof (<editorCommon.ICompositeCodeEditor>thing).onDidChangeActiveEditor === 'function';

}

/**
*@internal
*/
Expand Down
19 changes: 19 additions & 0 deletions src/vs/editor/common/editorCommon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import { IMarkdownString } from 'vs/base/common/htmlContent';
import { IDisposable } from 'vs/base/common/lifecycle';
import { Event } from 'vs/base/common/event';
import { URI, UriComponents } from 'vs/base/common/uri';
import { ConfigurationChangedEvent, IComputedEditorOptions, IEditorOptions } from 'vs/editor/common/config/editorOptions';
import { IPosition, Position } from 'vs/editor/common/core/position';
Expand Down Expand Up @@ -529,6 +530,24 @@ export interface IDiffEditor extends IEditor {
getModifiedEditor(): IEditor;
}

/**
* @internal
*/
export interface ICompositeCodeEditor {

/**
* An event that signals that the active editor has changed
*/
readonly onDidChangeActiveEditor: Event<ICompositeCodeEditor>;

/**
* The active code editor iff any
*/
readonly activeCodeEditor: IEditor | undefined;
// readonly editors: readonly ICodeEditor[] maybe supported with uris
}


/**
* An editor contribution that gets created every time a new editor gets created and gets disposed when the editor gets disposed.
*/
Expand Down
6 changes: 6 additions & 0 deletions src/vs/editor/common/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,12 @@ export interface ITextModel {
*/
equalsTextBuffer(other: ITextBuffer): boolean;

/**
* Get the underling text buffer.
* @internal
*/
getTextBuffer(): ITextBuffer;

/**
* Get the text in a certain range.
* @param range The range describing what text to get.
Expand Down
5 changes: 5 additions & 0 deletions src/vs/editor/common/model/textModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,11 @@ export class TextModel extends Disposable implements model.ITextModel {
return this._buffer.equals(other);
}

public getTextBuffer(): model.ITextBuffer {
this._assertNotDisposed();
return this._buffer;
}

private _emitContentChangedEvent(rawChange: ModelRawContentChangedEvent, change: IModelContentChangedEvent): void {
if (this._isDisposing) {
// Do not confuse listeners by emitting any event after disposing
Expand Down
6 changes: 3 additions & 3 deletions src/vs/editor/contrib/find/findDecorations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ export class FindDecorations implements IDisposable {
return result;
}

private static readonly _CURRENT_FIND_MATCH_DECORATION = ModelDecorationOptions.register({
public static readonly _CURRENT_FIND_MATCH_DECORATION = ModelDecorationOptions.register({
stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
zIndex: 13,
className: 'currentFindMatch',
Expand All @@ -276,7 +276,7 @@ export class FindDecorations implements IDisposable {
}
});

private static readonly _FIND_MATCH_DECORATION = ModelDecorationOptions.register({
public static readonly _FIND_MATCH_DECORATION = ModelDecorationOptions.register({
stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
className: 'findMatch',
showIfCollapsed: true,
Expand All @@ -290,7 +290,7 @@ export class FindDecorations implements IDisposable {
}
});

private static readonly _FIND_MATCH_NO_OVERVIEW_DECORATION = ModelDecorationOptions.register({
public static readonly _FIND_MATCH_NO_OVERVIEW_DECORATION = ModelDecorationOptions.register({
stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
className: 'findMatch',
showIfCollapsed: true
Expand Down
4 changes: 2 additions & 2 deletions src/vs/platform/actions/common/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -437,14 +437,14 @@ export function registerAction2(ctor: { new(): Action2 }): IDisposable {
KeybindingsRegistry.registerKeybindingRule({
...item,
id: command.id,
when: ContextKeyExpr.and(command.precondition, item.when)
when: command.precondition ? ContextKeyExpr.and(command.precondition, item.when) : item.when
});
}
} else if (keybinding) {
KeybindingsRegistry.registerKeybindingRule({
...keybinding,
id: command.id,
when: ContextKeyExpr.and(command.precondition, keybinding.when)
when: command.precondition ? ContextKeyExpr.and(command.precondition, keybinding.when) : keybinding.when
});
}

Expand Down
119 changes: 119 additions & 0 deletions src/vs/vscode.proposed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1540,6 +1540,125 @@ declare module 'vscode' {

//#endregion

//#region Peng: Notebook

export enum CellKind {
Markdown = 1,
Code = 2
}

export enum CellOutputKind {
Text = 1,
Error = 2,
Rich = 3
}

export interface CellStreamOutput {
outputKind: CellOutputKind.Text;
text: string;
}

export interface CellErrorOutput {
outputKind: CellOutputKind.Error;
/**
* Exception Name
*/
ename: string;
/**
* Exception Value
*/
evalue: string;
/**
* Exception call stack
*/
traceback: string[];
}

export interface CellDisplayOutput {
outputKind: CellOutputKind.Rich;
/**
* { mime_type: value }
*
* Example:
* ```json
* {
* "outputKind": vscode.CellOutputKind.Rich,
* "data": {
* "text/html": [
* "<h1>Hello</h1>"
* ],
* "text/plain": [
* "<IPython.lib.display.IFrame at 0x11dee3e80>"
* ]
* }
* }
*/
data: { [key: string]: any };
}

export type CellOutput = CellStreamOutput | CellErrorOutput | CellDisplayOutput;

export interface NotebookCell {
readonly uri: Uri;
handle: number;
language: string;
cellKind: CellKind;
outputs: CellOutput[];
getContent(): string;
}

export interface NotebookDocument {
readonly uri: Uri;
readonly fileName: string;
readonly isDirty: boolean;
languages: string[];
cells: NotebookCell[];
displayOrder?: GlobPattern[];
}

export interface NotebookEditor {
readonly document: NotebookDocument;
viewColumn?: ViewColumn;
/**
* Create a notebook cell. The cell is not inserted into current document when created. Extensions should insert the cell into the document by [TextDocument.cells](#TextDocument.cells)
*/
createCell(content: string, language: string, type: CellKind, outputs: CellOutput[]): NotebookCell;
}

export interface NotebookProvider {
resolveNotebook(editor: NotebookEditor): Promise<void>;
executeCell(document: NotebookDocument, cell: NotebookCell | undefined): Promise<void>;
save(document: NotebookDocument): Promise<boolean>;
}

export interface NotebookOutputSelector {
type: string;
subTypes?: string[];
}

export interface NotebookOutputRenderer {
/**
*
* @returns HTML fragment. We can probably return `CellOutput` instead of string ?
*
*/
render(document: NotebookDocument, cell: NotebookCell, output: CellOutput, mimeType: string): string;
preloads?: Uri[];
}

namespace window {
export function registerNotebookProvider(
notebookType: string,
provider: NotebookProvider
): Disposable;

export function registerNotebookOutputRenderer(type: string, outputSelector: NotebookOutputSelector, renderer: NotebookOutputRenderer): Disposable;

export let activeNotebookDocument: NotebookDocument | undefined;
}

//#endregion

//#region color theme access

/**
Expand Down
1 change: 1 addition & 0 deletions src/vs/workbench/api/browser/extensionHost.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import './mainThreadWindow';
import './mainThreadWebview';
import './mainThreadWorkspace';
import './mainThreadComments';
import './mainThreadNotebook';
import './mainThreadTask';
import './mainThreadLabelService';
import './mainThreadTunnelService';
Expand Down
Loading