vscode
命名空间中是否有命令允许您获取当前打开文件的TextDocument
实例?我找到了vscode.workspace.onDidOpenTextDocument
,但它对于在启动时打开的文件不起作用
答案 0 :(得分:0)
根据您的需求选择一些选项:
// 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