2017-05-22 1 views
0

동일한 작업의 일부로 확장 프로그램의 폴더 및 파일을 열려면 올바른 방법은 무엇입니까?VSCode : 동일한 루틴의 폴더 및 파일 열기

간단한 작업처럼 보이지만 꽤 오랜 시간을 보냈지 만 해결할 수 없습니다. 하나 또는 둘 다를 쉽게 수행 할 수 있지만 단일 작업으로 둘 다 할 수는 없습니다.

commands.executeCommand('vscode.openFolder', 
         Uri.parse('E:\\dev\\proj')) 
     .then(() => commands.executeCommand('vscode.open', 
              Uri.file('E:\\dev\\files\\file.json')); 

위 코드는 폴더는 있지만 파일은 열지 않습니다. 디버거에서 나는 vscode.open 명령이 시작되었지만 파일이 열리지 않았다는 것을 알았습니다. 그리고 'vscode.open`을 사용하면 파일이 예상대로 열리지 않습니다.

폴더를 연 후에 전체 실행 컨텍스트가 사라진 것처럼 보입니다.

나는이 잔인한 실험을했다 :

setTimeout(() => commands.executeCommand('vscode.open', 
              Uri.file('E:\\dev\\files\\file.json'), 3000); 
commands.executeCommand('vscode.openFolder', 
         Uri.parse('E:\\dev\\proj')) 

을 그리고 그것은 vscode.openFolder가 불려 갔을 경우의 setTimeout의 콜백이 호출되지 않습니다 것을 욕.

도움/힌트를 부탁드립니다.

답변

0

문제점의 원인을 찾았습니다. 그러나 해결책은 아닙니다.

열려있는 폴더가 완전히 실행 컨텍스트를 완전히 종료합니다. 이것은 VSCode 문서의 말씀입니다 :

Note that opening in the same window will shutdown the current extension host process and start a new one on the given folder unless the newWindow parameter is set to true.

따라서 현재 현재 창에서 열기 열고 활성 특정 파일이있는 폴더의 방법은없는 것 같다.

관련 문제