[英]Getting the currently open file in VSCode
vscode
命名空間中是否有允許您獲取當前打開文件的TextDocument
實例的命令? 我找到了vscode.workspace.onDidOpenTextDocument
,但它不適用於啟動時打開的文件
根據您的需要提供一些選項:
// Single active editor. Editors have a `.document` property
vscode.window.activeTextEditor
// All showing text editors. For a split view, there are two active editors
vscode.window.visibleTextEditors
// All open documents that vscode knows about. Do not have to be showing
vscode.workspace.textDocuments
有關更多信息,請參閱 vscode API: https ://code.visualstudio.com/docs/extensionAPI/vscode-api
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.