Skip to content
Closed
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
9,961 changes: 4,752 additions & 5,209 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@
"@types/react": "^16.9.25",
"@types/react-dom": "^16.9.5",
"@types/sinon": "^9.0.1",
"@types/vscode": "^1.41.0",
"@types/vscode": "^1.49.0",
"@types/ws": "^7.2.4",
"@typescript-eslint/eslint-plugin": "^2.19.2",
"@typescript-eslint/parser": "^2.19.2",
Expand Down Expand Up @@ -882,7 +882,7 @@
"ts-node": "^8.6.2",
"typescript": "^3.7.5",
"vsce": "^1.74.0",
"vscode-test": "^1.3.0",
"vscode-test": "^1.4.0",
"webpack": "^4.42.0",
"webpack-cli": "^3.3.11",
"xvfb-maybe": "^0.2.1"
Expand Down
6 changes: 3 additions & 3 deletions src/explorer/explorerTreeController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { sortTreeItemsByLabel } from './treeItemUtils';
const log = createLogger('explorer controller');

export default class ExplorerTreeController
implements vscode.TreeDataProvider<vscode.TreeItem> {
implements vscode.TreeDataProvider<vscode.TreeItem> {
private _connectionController: ConnectionController;
private _connectionTreeItems: { [key: string]: ConnectionTreeItem };
contextValue = 'explorerTreeController';
Expand Down Expand Up @@ -120,13 +120,13 @@ export default class ExplorerTreeController
readonly onDidChangeTreeData: vscode.Event<any>;

public refresh = (): Promise<boolean> => {
this._onDidChangeTreeData.fire();
this._onDidChangeTreeData.fire(null);

return Promise.resolve(true);
};

public onTreeItemUpdate(): void {
this._onDidChangeTreeData.fire();
this._onDidChangeTreeData.fire(null);
}

getTreeItem(element: vscode.TreeItem): vscode.TreeItem {
Expand Down
4 changes: 2 additions & 2 deletions src/explorer/playgroundsTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,13 @@ implements vscode.TreeDataProvider<vscode.TreeItem> {
.getConfiguration('mdb')
.get('excludeFromPlaygroundsSearch') || [];

this._onDidChangeTreeData.fire();
this._onDidChangeTreeData.fire(null);

return Promise.resolve(true);
};

public onTreeItemUpdate(): void {
this._onDidChangeTreeData.fire();
this._onDidChangeTreeData.fire(null);
}

public getTreeItem(element: PlaygroundsTreeHeader): vscode.TreeItem {
Expand Down
2 changes: 1 addition & 1 deletion src/language/mongoDBService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ export default class MongoDBService {
const shellSymbols = {};

Object.keys(signatures).map((symbol) => {
shellSymbols[symbol] = Object.keys(signatures[symbol].attributes).map(
shellSymbols[symbol] = Object.keys(signatures[symbol].attributes || {}).map(
(item) => ({
label: item,
kind: CompletionItemKind.Method
Expand Down
6 changes: 6 additions & 0 deletions src/test/suite/stubs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ class TestExtensionContext implements vscode.ExtensionContext {
_globalState = {};
extensionPath: string;
storagePath: string;
extensionUri;
environmentVariableCollection;
extensionMode;
storageUri;
globalStorageUri;
logUri;

asAbsolutePath(relativePath: string): string {
return relativePath;
Expand Down
33 changes: 23 additions & 10 deletions src/test/suite/views/webviewController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ suite('Connect Form View Test Suite', () => {
const stubOnDidRecieveMessage = sinon.stub();
const fakeWebview = {
html: '',
onDidReceiveMessage: stubOnDidRecieveMessage
onDidReceiveMessage: stubOnDidRecieveMessage,
asWebviewUri: sinon.fake.returns('')
};
const fakeVSCodeCreateWebviewPanel = sinon.fake.returns({
webview: fakeWebview
Expand Down Expand Up @@ -74,11 +75,16 @@ suite('Connect Form View Test Suite', () => {
});
}

const fakeWebview: any = {
asWebviewUri: (jsUri) => {
return jsUri;
}
};

const extensionPath = mdbTestExtension.testExtensionContext.extensionPath;
const appUri = getReactAppUri(extensionPath);
const appUri = getReactAppUri(extensionPath, fakeWebview);
const htmlString = getConnectWebviewContent(appUri);

assert(htmlString.includes('vscode-resource:/'));
assert(htmlString.includes('dist/webviewApp.js'));

const webviewAppFileName = (): string => 'dist/webviewApp.js';
Expand Down Expand Up @@ -121,7 +127,8 @@ suite('Connect Form View Test Suite', () => {
onDidReceiveMessage: (callback): void => {
messageRecieved = callback;
messageRecievedSet = true;
}
},
asWebviewUri: sinon.fake.returns('')
};
const fakeVSCodeCreateWebviewPanel = sinon.fake.returns({
webview: fakeWebview
Expand Down Expand Up @@ -193,7 +200,8 @@ suite('Connect Form View Test Suite', () => {
onDidReceiveMessage: (callback): void => {
messageRecieved = callback;
messageRecievedSet = true;
}
},
asWebviewUri: sinon.fake.returns('')
};
const fakeVSCodeCreateWebviewPanel = sinon.fake.returns({
webview: fakeWebview
Expand Down Expand Up @@ -259,7 +267,8 @@ suite('Connect Form View Test Suite', () => {
},
onDidReceiveMessage: (callback): void => {
messageRecieved = callback;
}
},
asWebviewUri: sinon.fake.returns('')
};
const fakeVSCodeCreateWebviewPanel = sinon.fake.returns({
webview: fakeWebview
Expand Down Expand Up @@ -318,7 +327,8 @@ suite('Connect Form View Test Suite', () => {
},
onDidReceiveMessage: (callback): void => {
messageRecieved = callback;
}
},
asWebviewUri: sinon.fake.returns('')
};
const fakeVSCodeCreateWebviewPanel = sinon.fake.returns({
webview: fakeWebview
Expand Down Expand Up @@ -388,7 +398,8 @@ suite('Connect Form View Test Suite', () => {
},
onDidReceiveMessage: (callback): void => {
messageRecieved = callback;
}
},
asWebviewUri: sinon.fake.returns('')
};

const fakeVSCodeCreateWebviewPanel = sinon.fake.returns({
Expand Down Expand Up @@ -442,7 +453,8 @@ suite('Connect Form View Test Suite', () => {
},
onDidReceiveMessage: (callback): void => {
messageRecieved = callback;
}
},
asWebviewUri: sinon.fake.returns('')
};
const fakeVSCodeCreateWebviewPanel = sinon.fake.returns({
webview: fakeWebview
Expand Down Expand Up @@ -494,7 +506,8 @@ suite('Connect Form View Test Suite', () => {
html: '',
onDidReceiveMessage: (callback): void => {
messageRecieved = callback;
}
},
asWebviewUri: sinon.fake.returns('')
};
const fakeVSCodeExecuteCommand = sinon.fake.resolves(false);

Expand Down
9 changes: 5 additions & 4 deletions src/views/webviewController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@ export const getConnectWebviewContent = (jsAppFileUrl: vscode.Uri): string => {
</html>`;
};

export const getReactAppUri = (extensionPath: string): vscode.Uri => {
const jsAppFilePath = vscode.Uri.file(
export const getReactAppUri = (extensionPath: string, webview: vscode.Webview): vscode.Uri => {
const localFilePathUri = vscode.Uri.file(
path.join(extensionPath, 'dist', 'webviewApp.js')
);
return jsAppFilePath.with({ scheme: 'vscode-resource' });
const jsAppFileWebviewUri = webview.asWebviewUri(localFilePathUri);
return jsAppFileWebviewUri;
};

export default class WebviewController {
Expand Down Expand Up @@ -177,7 +178,7 @@ export default class WebviewController {
path.join(extensionPath, 'images', 'leaf.svg')
);

const reactAppUri = getReactAppUri(extensionPath);
const reactAppUri = getReactAppUri(extensionPath, panel.webview);
panel.webview.html = getConnectWebviewContent(reactAppUri);

// Handle messages from the webview.
Expand Down