Add an event listener to create an API to tell whether a view is cloned or not

オープン
#127 コメント 8 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python
領域
tooling

調査の方向性

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:

  1. 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:

  1. 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分
マージ済み PR(30日)
4

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

SublimeText/sublime_lib のほかの issue

SublimeText/sublime_lib の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。