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

New idea for handling intellisense #11

Merged
merged 4 commits into from
Sep 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vscode/jupyter-lsp-middleware",
"version": "0.2.9",
"version": "0.2.10",
"description": "VS Code Python Language Server Middleware for Jupyter Notebook",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
6 changes: 5 additions & 1 deletion scripts/prepareTest.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
const fs = require('fs');

if (!fs.existsSync('./out')) {
fs.mkdirSync('./out');
fs.mkdirSync('./out/test');
}
fs.copyFile('./src/test/package.json', './out/test/package.json', (err) => {
if (err) throw err;
console.log('src/test/package.json was copied to out/test/package.json');
});
});
19 changes: 2 additions & 17 deletions src/common/utils.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,11 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

import { TextDocument, Uri } from 'vscode';
export const NotebookCellScheme = 'vscode-notebook-cell';
export const InteractiveInputScheme = 'vscode-interactive-input';
export const InteractiveScheme = 'vscode-interactive';
export const PYTHON_LANGUAGE = 'python';


function isUri(resource?: Uri | any): resource is Uri {
if (!resource) {
return false;
}
const uri = resource as Uri;
return typeof uri.path === 'string' && typeof uri.scheme === 'string';
}

export function isNotebookCell(documentOrUri: TextDocument | Uri): boolean {
const uri = isUri(documentOrUri) ? documentOrUri : documentOrUri.uri;
return uri.scheme.includes(NotebookCellScheme) || uri.scheme.includes(InteractiveInputScheme);
}

export function isThenable<T>(v: any): v is Thenable<T> {
return typeof v?.then === 'function';
}
Expand All @@ -41,7 +26,7 @@ export function isEqual(a: string[], b: string[]): boolean {

export function splitLines(
str: string,
splitOptions: { trim?: boolean; removeEmptyEntries?: boolean } = { removeEmptyEntries: true, trim: true },
splitOptions: { trim?: boolean; removeEmptyEntries?: boolean } = { removeEmptyEntries: true, trim: true }
): string[] {
let lines = str.split(/\r?\n/g);
if (splitOptions && splitOptions.trim) {
Expand All @@ -51,4 +36,4 @@ export function splitLines(
lines = lines.filter((line) => line.length > 0);
}
return lines;
};
}
Loading