Add an event listener to create an API to tell whether a view is cloned or not
还没有人认领这个 Issue。
评估
调研方向
Start by comparing the linked BufferScroll and SkipCloseForClonedViews implementations with the related Sublime Text Core requests for View.clones(). Determine how sublime_lib could expose reusable cloned-view detection through an event listener without the package-specific caching concerns being repeated. Done means the library provides the requested shared API and its behavior distinguishes primary views from views sharing an underlying buffer.
由索引模型根据 Issue 内容生成。
描述
The View.is_primary() only tells if the view is the "primary". If the view is the "primary", it does not tell whether it has multiple views into the underlying buffer.
Some years ago, I wrote this code into my fork of BufferScroll:
https://github.com/evandrocoan/BufferScroll/blob/master/BufferScroll.py#L105-L117
And today, I need to write the same code for my new package:
https://github.com/evandrocoan/SkipCloseForClonedViews/blob/master/skip_close_for_cloned_views.py#L5-L70
Which implements this feature asked on Core:
- https://github.com/SublimeTextIssues/Core/issues/2903 Skip save (ask) when closing a cloned view
Nowadays, I am worried about performance, and I am running this is_cloned_view() very often. Then, for my new Package, I wrote a optimized version which caches whether a given buffer has several views into the same buffer.
How such peculiar API is_cloned(view) which requires to extend the sublime_plugin.EventListener be distributed and shared between several packages? Could it be added to sublime_lib?
Something very similar was already requested to be added into Sublime Text Core:
- https://github.com/SublimeTextIssues/Core/issues/11 "View.clones()" addition
Using that API, it would only require me to call len( view.clones() ) > 1 to know where some view is cloned, i.e., has clones, i.e., has several views into the same buffer. Then, optimally when integrating my implementation into sublime_lib, my original implementation could be extended to support this feature of returning all clones instead of only saying some view has clones or not.
- 主要语言
- Python
- 星标
- 56
- 派生
- 5
- 平均合并
- 19 分钟
- 30 天内合并 PR
- 4
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
SublimeText/sublime_lib 的其他 Issue
-
Conversion error未关闭
难度 2/5 1-3 小时 新手友好度 66/100
SublimeText/sublime_lib#210 · 1 条评论 ·
-
documentation
难度 3/5 1-2 天 新手友好度 35/100
SublimeText/sublime_lib#183 ·
-
documentation
难度 2/5 1-3 小时 新手友好度 38/100
SublimeText/sublime_lib#173 · 1 个 reaction ·
-
难度 5/5 一周以上 新手友好度 35/100
SublimeText/sublime_lib#164 · 1 条评论 ·
-
难度 5/5 一周以上 新手友好度 25/100
SublimeText/sublime_lib#141 · 2 条评论 ·
查看 SublimeText/sublime_lib 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
yt-project/yt#5624 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
NousResearch/hermes-agent#148376 ·
维护者通常 1 天内回复
-
Analysis
难度 2/5 1-3 小时 新手友好度 72/100
SACGF/variantgrid#2615 ·
维护者通常 1 天内回复