visual-studio-code - 如何注入/跟踪编辑器/文档元数据?
问题描述
有没有办法将自定义属性注入文档/编辑器?
例如,我需要从 api 端点编辑文本。调用 api 并在编辑器中显示数据,然后编辑文本很容易。我似乎找不到放置有关文本的元数据的好方法,因此可以发布帖子来更新源。需要保存 api-end-point 和文档 ID 等信息,而不将其注入主编辑器文本。
我一直在研究从自定义文档/提供程序到自定义文件系统提供程序的所有内容,但这些选项对于我的需要似乎相当复杂。
Example:
api-endpoint: GET /docs
const resp = [{
name: /docs/note1.txt,
id: 12345,
content: 'some text document content'
}, {
name: /notes/othernote.txt
id: 54312,
content: 'special text in another note'
}];
// open a document/editor and display the content of one of the docs from the api reponse
await workspace.openTextDocument({ content: resp[0].content, language: 'text' })
.then( async (doc) => {
await window.showTextDocument( doc, { preview: false });
this.documents.push(doc);
});
现在我们有一个显示内容的编辑器,但无法将该内容链接回 api 端点(带有 doc id)。看来我需要查看文件系统提供程序,以便我可以在文件统计信息中注入更多详细信息。
https://code.visualstudio.com/api/references/vscode-api#FileSystemProvider
建议?
解决方案
推荐阅读
- oracle-apex - 如何在单独的窗口中调用 APEX 页面,同时从 EBS 调用它
- wso2 - 限制数据未发布到所有活动节点
- ffmpeg - 使用 ffmpeg 转换为 hls 格式时块大小的最小持续时间
- javascript - 用于查找两个高度之间的线的数据结构
- php - 使用三元运算符更改输入属性
- shell - 在 shell 脚本中使用 wget 测试连通性
- php - PHP递归函数生成树形结构菜单
- javascript - 如何检查 id IndexedDB 已经存在于 React 生命周期方法中
- c# - Unity 中的 NetNamedPipeBinding 支持
- android - 如何从 android 应用程序安装 .cap 小程序?