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

Commit d9bdf6a

Browse files
authored
Generate web output (#2)
* Generate web output * Update package number
1 parent 9208bdf commit d9bdf6a

7 files changed

+120
-125
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vscode/lsp-notebook-concat",
3-
"version": "0.1.2",
3+
"version": "0.1.3",
44
"description": "Notebook cell concatentation for language servers",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/common/utils.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ export function isInteractiveCell(cellUri: vscodeUri.URI): boolean {
4242
cellUri.scheme.includes(InteractiveScheme)
4343
);
4444
}
45+
export function isNotebookCell(uri: vscodeUri.URI): boolean {
46+
return uri.scheme.includes(NotebookCellScheme) || uri.scheme.includes(InteractiveInputScheme);
47+
}
4548

4649
export function splitLines(str: string): string[] {
4750
let lines = str.split(/\r?\n/g);

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
import * as vscodeUri from 'vscode-uri';
44
import { NotebookConverter } from './notebookConverter';
55

6-
export function createConverter(getNotebookHeader: (uri: vscodeUri.URI) => string): NotebookConverter {
7-
return new NotebookConverter(getNotebookHeader);
6+
export function createConverter(getNotebookHeader: (uri: vscodeUri.URI) => string, platformGetter: () => string): NotebookConverter {
7+
return new NotebookConverter(getNotebookHeader, platformGetter);
88
}

src/notebookConcatDocument.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ export class NotebookConcatDocument implements ITextDocument {
9393
private _lines: NotebookConcatLine[] = [];
9494
private _realLines: NotebookConcatLine[] = [];
9595

96+
public static getConcatDocRoot(cellUri: vscodeUri.URI) {
97+
return path.dirname(cellUri.fsPath);
98+
}
99+
96100
constructor(public key: string, private readonly getNotebookHeader: (uri: vscodeUri.URI) => string) {}
97101

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

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

0 commit comments

Comments
 (0)