Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

Commit

Permalink
Generate web output (#2)
Browse files Browse the repository at this point in the history
* Generate web output

* Update package number
  • Loading branch information
rchiodo authored Jan 3, 2022
1 parent 9208bdf commit d9bdf6a
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 125 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vscode/lsp-notebook-concat",
"version": "0.1.2",
"version": "0.1.3",
"description": "Notebook cell concatentation for language servers",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
3 changes: 3 additions & 0 deletions src/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ export function isInteractiveCell(cellUri: vscodeUri.URI): boolean {
cellUri.scheme.includes(InteractiveScheme)
);
}
export function isNotebookCell(uri: vscodeUri.URI): boolean {
return uri.scheme.includes(NotebookCellScheme) || uri.scheme.includes(InteractiveInputScheme);
}

export function splitLines(str: string): string[] {
let lines = str.split(/\r?\n/g);
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
import * as vscodeUri from 'vscode-uri';
import { NotebookConverter } from './notebookConverter';

export function createConverter(getNotebookHeader: (uri: vscodeUri.URI) => string): NotebookConverter {
return new NotebookConverter(getNotebookHeader);
export function createConverter(getNotebookHeader: (uri: vscodeUri.URI) => string, platformGetter: () => string): NotebookConverter {
return new NotebookConverter(getNotebookHeader, platformGetter);
}
6 changes: 5 additions & 1 deletion src/notebookConcatDocument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ export class NotebookConcatDocument implements ITextDocument {
private _lines: NotebookConcatLine[] = [];
private _realLines: NotebookConcatLine[] = [];

public static getConcatDocRoot(cellUri: vscodeUri.URI) {
return path.dirname(cellUri.fsPath);
}

constructor(public key: string, private readonly getNotebookHeader: (uri: vscodeUri.URI) => string) {}

// Handles changes in the real cells and maps them to changes in the concat document.
Expand Down Expand Up @@ -879,7 +883,7 @@ export class NotebookConcatDocument implements ITextDocument {
private initialize(cellUri: vscodeUri.URI) {
if (!this._concatUri?.fsPath) {
this._interactiveWindow = isInteractiveCell(cellUri);
const dir = path.dirname(cellUri.fsPath);
const dir = NotebookConcatDocument.getConcatDocRoot(cellUri);

// Path has to match no matter how many times we open it.
const concatFilePath = path.join(
Expand Down
Loading

0 comments on commit d9bdf6a

Please sign in to comment.