当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript workspace.updateWorkspaceFolders方法代码示例

本文整理汇总了TypeScript中vscode.workspace.updateWorkspaceFolders方法的典型用法代码示例。如果您正苦于以下问题:TypeScript workspace.updateWorkspaceFolders方法的具体用法?TypeScript workspace.updateWorkspaceFolders怎么用?TypeScript workspace.updateWorkspaceFolders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vscode.workspace的用法示例。


在下文中一共展示了workspace.updateWorkspaceFolders方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: isDirectory

 isDirectory(newPath).then(isDir => {
     if (isDir) {
         if (selectedLabel === ".") {
             const action = vscode.workspace.getConfiguration( "vscode-quick-browser" ).get( 'openCurrentFolderAction' );
             if( action === "open in same window" ) {
                 vscode.commands.executeCommand( 'vscode.openFolder', new vscode.Uri( { scheme: 'file', path: qp.placeholder } ), false );
             }
             else if( action === "open in new window" ) {
                 vscode.commands.executeCommand( 'vscode.openFolder', new vscode.Uri( { scheme: 'file', path: qp.placeholder } ), true );
             }
             else if( action === "open new folder in same window" ) {
                 const { workspaceFolders } = vscode.workspace
                 vscode.workspace.updateWorkspaceFolders(
                     workspaceFolders ? workspaceFolders.length : 0,
                     null,
                     {
                         uri: vscode.Uri.file(newPath),
                         name: path.basename(newPath)
                     }
                 )
             }
         }
         else {
             updateQuickPick(qp, newPath)
         }
     }
     else {
         const openPath = vscode.Uri.file(newPath)
         qp.hide()
         vscode.workspace.openTextDocument(openPath).then(doc => {
             return vscode.window.showTextDocument(doc)
         })
     }
 }).catch(err => {
开发者ID:Gruntfuggly,项目名称:vscode-quick-browser,代码行数:34,代码来源:extension.ts

示例2: activate

export async function activate (context: ExtensionContext): Promise<void> {
    // Misc.
    Utils.ExtensionPath = context.extensionPath;

    // Connect sockets
    Sockets.Connect();

    // Workspace
    // context.subscriptions.push(workspace.registerFileSystemProvider('babylonjs-editor', new CustomFileSystem(), { isCaseSensitive: true, isReadonly: false }));
    // workspace.updateWorkspaceFolders(0, 0, { uri: Uri.parse('babylonjs-editor:/'), name: "BabylonJSEditor" });

    // Workspace
    const fs = new TempFileSystem();
    await fs.init();
    workspace.updateWorkspaceFolders(0, 0, { uri: Uri.parse('file:/' + Utils.TempFolder), name: 'BabylonJSEditor' });

    // Plugin
    context.subscriptions.push(window.createTreeView('babylonjsEditorPlugin', { treeDataProvider: new BabylonJSEditorPlugin() }));

    // Dispose
    context.subscriptions.push({
        dispose: async () => {
            Watcher.Dispose();
            await fs.clear();
        }
    });
}
开发者ID:BabylonJS,项目名称:Editor,代码行数:27,代码来源:extension.ts

示例3: createProject

async function createProject(projectPath: string, truffleBoxName: string): Promise<void> {
  await fs.ensureDir(projectPath);

  const arrayFiles =  await fs.readdir(projectPath);
  const path = (arrayFiles.length) ? createTemporaryDir(projectPath) : projectPath;

  try {
    window.showInformationMessage(Constants.informationMessage.newProjectCreationStarted);
    Output.show();
    await outputCommandHelper.executeCommand(path, 'npx', 'truffle', 'unbox', truffleBoxName);
    if (arrayFiles.length) {
      fs.moveSync(path, projectPath);
    }
    workspace.updateWorkspaceFolders(
      0,
      workspace.workspaceFolders ? workspace.workspaceFolders.length : null,
      {uri: Uri.file(projectPath)});
    window.showInformationMessage(Constants.informationMessage.newProjectCreationFinished);
  } catch (error) {
    // TODO: cleanup files after failed truffle unbox
    throw Error(error);
  }
}
开发者ID:chrisseg,项目名称:vscode-azure-blockchain-ethereum,代码行数:23,代码来源:ProjectCommands.ts

示例4: connectAdtServer

export async function connectAdtServer(selector: any) {
  const connectionID = selector && selector.connection
  const remote = await selectRemote(connectionID)
  if (!remote) return
  const client = createClient(remote)

  log(`Connecting to server ${remote.name}`)

  try {
    await client.login() // if connection raises an exception don't mount any folder

    workspace.updateWorkspaceFolders(0, 0, {
      uri: Uri.parse("adt://" + remote.name),
      name: remote.name + "(ABAP)"
    })

    log(`Connected to server ${remote.name}`)
  } catch (e) {
    window.showErrorMessage(
      `Failed to connect to ${remote.name}:${e.toString()}`
    )
  }
}
开发者ID:valdirmendesgt,项目名称:vscode_abap_remote_fs,代码行数:23,代码来源:commands.ts

示例5:

 ).then((value: String | undefined) => {
   if (value === 'Yes') {
     vscode.workspace.updateWorkspaceFolders(0, null, { uri: vscode.Uri.file(workspaceRoot) })
   }
 })
开发者ID:dotty-staging,项目名称:dotty,代码行数:5,代码来源:extension.ts

示例6:

 context.subscriptions.push(vscode.commands.registerCommand('memfs.workspaceInit', _ => {
     vscode.workspace.updateWorkspaceFolders(0, 0, { uri: vscode.Uri.parse('memfs:/'), name: "MemFS - Sample" });
 }));
开发者ID:voodoos,项目名称:vscode-extension-samples,代码行数:3,代码来源:extension.ts

示例7: setWorkspaceAndReload

/**
 * Find and set a workspace root if no folders are open in the workspace. If there are already
 * folders open in the workspace, do nothing.
 *
 * Adding a first folder to the workspace completely reloads the extension.
 */
function setWorkspaceAndReload(document: vscode.TextDocument) {
  const documentPath = path.parse(document.uri.fsPath).dir
  const workspaceRoot = findWorkspaceRoot(documentPath) || documentPath
  vscode.workspace.updateWorkspaceFolders(0, null, { uri: vscode.Uri.file(workspaceRoot) })
}
开发者ID:xeno-by,项目名称:dotty,代码行数:11,代码来源:extension.ts


注:本文中的vscode.workspace.updateWorkspaceFolders方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。