當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。