Open aeschli opened 6 years ago
I saw that it works right there are four times only that he used Uri and it's in its place.
private showToolbarForActiveDocumentIfNeeded(documentUri: vscode.Uri) { if (this.isMicropythonProject(documentUri))
'use strict'; import Base from '../base'; import as vscode from 'vscode'; import as fs from 'fs'; import as path from 'path'; import as _ from 'lodash';
// Escape path spaces for REPL: /my awesome/file/path => '/my\ awesome/file/path' const normalizePath = (path: string = ''): string => path.replace(/(\s+)/g, '\$1');
export default class Project extends Base {
/**
display main menu for project managerment */ public async actionShowMainMenu() { let menuItems: vscode.QuickPickItem[] = [];
menuItems.push({ label: "New project...", description: "", detail: "Generate new project included supported files" });
menuItems.push({ label: "Flash Firmware...", description: "", detail: "Flash Micropython firmware using esptool.py" });
menuItems.push({ label: "Download Firmware...", description: "", detail: "Enter Micropython download page" });
let selectedAction = await vscode.window.showQuickPick(menuItems); if (!selectedAction) { return; }
switch (selectedAction.label) { case 'New project...': this.actionNewProject(); break; case 'Flash Firmware...': this.actionFlashFirmware(); break; case 'Download Firmware...': vscode.commands.executeCommand('vscode.open', vscode.Uri.parse('http://www.micropython.org/download'));
await vscode.commands.executeCommand('vscode.openFolder', vscode.Uri.parse(workingFolder)); } catch (exception)
protected isMicropythonProject(documentPath: vscode.Uri) { let projectPath = vscode.workspace.getWorkspaceFolder(documentPath); if (!projectPath) { return false; } return fs.existsSync(path.join(projectPath.uri.fsPath, Base.CONSTANTS.APP.CONFIG_FILE_NAME)); }
In 1.26 we discovered that several extensions call the 'vscode.openFolder' command with invalid file URIs:
When creating a URI from a file path, always use
vscode.URI.file(path)
, e.gvscode.URI.file('c:\\test')
Usevscode.URI.parse(uriString)
when the input string is in the formscheme://authority/path
See https://github.com/Microsoft/vscode/issues/57267 for more information or for questions.