Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8f1fd7b
refactored ICellRange definition to type.ts since it's now used acros…
Jun 19, 2020
fd5e865
add command insertCellBelowPosition
Jun 20, 2020
127e2df
add command insertCellBelow
Jun 20, 2020
38fad86
add command insertCellAbove
Jun 20, 2020
5afe4cc
add deleteCells command
Jun 21, 2020
dd846c1
add selectCell command
Jun 21, 2020
cfeccbb
add selectCellContents command
Jun 21, 2020
500fe5a
modify selectCell to maintain previous orientation of selection ancho…
Jun 21, 2020
cf5e404
fix detection of anchor and active position direction
Jun 21, 2020
aa39444
add extendSelectionByCellAbove
Jun 21, 2020
9a073aa
add extendSelectionByCellBelow
Jun 22, 2020
4a95409
add moveCellsUp
Jun 23, 2020
95fc70d
add moveCellsDown
Jun 23, 2020
cc37494
added news file for enhancement changes being added
Jun 24, 2020
1f73555
add changeCellToMarkdown
Jun 28, 2020
e62137a
add changeCellToCode
Jul 10, 2020
f624692
Remove cell edit commands from context menu
Jul 10, 2020
9a17d5f
Use the insertCell method to insert a cell when RunCellAndAdvance rea…
Jul 10, 2020
0ae48a6
Use the insertCell method to insert cell within addEmptyCellToBottom
Jul 10, 2020
8842cde
Add telemetry for cell edit commands in interactive python
Jul 10, 2020
8d1ae3f
Add codeLensFactory.getCodeLensCacheData and abstracted the cell rang…
Jul 10, 2020
db47d3a
clean up async and promises within codewatcher.ts
Jul 13, 2020
4fdd64c
clean up unnecessary Promise.resolve()
Jul 14, 2020
9876718
refactor unnecessary async functions to sync functions
Jul 31, 2020
0b83e38
added unit tests for move cells down
Jul 31, 2020
6ac5741
Merge branch 'master' into issue-12414-python-interactive-cell-shortcuts
Jul 31, 2020
716200b
change the when for commands to display when the python file has cells
Aug 1, 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
Next Next commit
refactored ICellRange definition to type.ts since it's now used acros…
…s multiple modules
  • Loading branch information
earthastronaut
earthastronaut committed Jun 24, 2020
commit 8f1fd7b865fb7f8c61ed416270a681c4c74180ad
9 changes: 1 addition & 8 deletions src/client/datascience/cellFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { IDataScienceSettings, Resource } from '../common/types';
import { noop } from '../common/utils/misc';
import { CellMatcher } from './cellMatcher';
import { Identifiers } from './constants';
import { CellState, ICell } from './types';
import { CellState, ICell, ICellRange } from './types';

function generateCodeCell(
code: string[],
Expand Down Expand Up @@ -109,13 +109,6 @@ export function hasCells(document: TextDocument, settings?: IDataScienceSettings
return false;
}

// CellRange is used as the basis for creating new ICells. We only use it in this file.
export interface ICellRange {
range: Range;
title: string;
cell_type: string;
}

export function generateCellsFromString(source: string, settings?: IDataScienceSettings): ICell[] {
const lines: string[] = source.splitLines({ trim: false, removeEmptyEntries: false });

Expand Down
7 changes: 6 additions & 1 deletion src/client/datascience/editor-integration/codeLensFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { IFileSystem } from '../../common/platform/types';
import { IConfigurationService, Resource } from '../../common/types';
import * as localize from '../../common/utils/localize';
import { noop } from '../../common/utils/misc';
import { generateCellRangesFromDocument, ICellRange } from '../cellFactory';
import { generateCellRangesFromDocument } from '../cellFactory';
import { CodeLensCommands, Commands, Identifiers } from '../constants';
import {
INotebookIdentity,
Expand All @@ -20,6 +20,7 @@ import {
import {
ICell,
ICellHashProvider,
ICellRange,
ICodeLensFactory,
IFileHashes,
IInteractiveWindowListener,
Expand All @@ -41,6 +42,7 @@ type CodeLensCacheData = {
*/
@injectable()
export class CodeLensFactory implements ICodeLensFactory, IInteractiveWindowListener {
public cells: ICellRange[];
private updateEvent: EventEmitter<void> = new EventEmitter<void>();
// tslint:disable-next-line: no-any
private postEmitter: EventEmitter<{ message: string; payload: any }> = new EventEmitter<{
Expand All @@ -60,6 +62,7 @@ export class CodeLensFactory implements ICodeLensFactory, IInteractiveWindowList
@inject(IFileSystem) private fileSystem: IFileSystem,
@inject(IDocumentManager) private documentManager: IDocumentManager
) {
this.cells = [];
this.documentManager.onDidCloseTextDocument(this.onClosedDocument.bind(this));
this.configService.getSettings(undefined).onDidChange(this.onChangedSettings.bind(this));
}
Expand Down Expand Up @@ -204,6 +207,8 @@ export class CodeLensFactory implements ICodeLensFactory, IInteractiveWindowList
});
}

this.cells = cache.cellRanges;
Comment thread
earthastronaut marked this conversation as resolved.
Resolved

return [...cache.documentLenses, ...cache.gotoCellLens];
}

Expand Down
13 changes: 13 additions & 0 deletions src/client/datascience/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,7 @@ export interface ICodeWatcher {

export const ICodeLensFactory = Symbol('ICodeLensFactory');
export interface ICodeLensFactory {
cells: ICellRange[];
updateRequired: Event<void>;
createCodeLenses(document: TextDocument): CodeLens[];
}
Expand All @@ -654,6 +655,18 @@ export interface ICell {
extraLines?: number[];
}

// CellRange is used as the basis for creating new ICells.
// Was only intended to aggregate together ranges to create an ICell
// However the "range" aspect is useful when working with plain text document
// Ultimately, it would probably be ideal to be ICell and change line to range.
// Specificially see how this is being used for the ICodeLensFactory to
// provide cells for the CodeWatcher to use.
export interface ICellRange {
range: Range;
title: string;
cell_type: string;
}

export interface IInteractiveWindowInfo {
cellCount: number;
undoCount: number;
Expand Down