2017-08-04 96 views

回答

1

文件對話框。見window.showOpenDialogwindow.showSaveDialog

他們似乎沒有選擇一個沒有文件的文件夾,但他們確實允許多選,當然你可以只選取任何選定文件的路徑名。

const options: vscode.OpenDialogOptions = { 
     canSelectMany: false, 
     openLabel: 'Open', 
     filters: { 
      'Text files': ['txt'], 
      'All files': ['*'] 
     } 
    }; 

    vscode.window.showOpenDialog(options).then(fileUri => { 
     if (fileUri && fileUri[0]) { 
      console.log('Selected file: ' + fileUri[0].fsPath); 
     } 
    }); 

請注意,您可能需要更新您的package.json文件才能訪問此新API。

"engines": { 
    "vscode": "^1.17.0" 
}, 
1

沒有,但有這個開放的功能要求:在VSCode 1.17加#13807

+1

謝謝,雖然這不是我預期的答案;)。 – rkrahl

相關問題