Settings listener classes
まだ誰も着手していません。
評価
調査の方向性
Start by locating SettingsDict.subscribe and the existing Sublime listener classes referenced in the issue. Review how clear_on_change, add_on_change, and listener lifetime currently work. Done should provide the proposed GlobalSettingsListener and ViewSettingsListener conveniences, including value-change handling and automatic subscription cleanup, with behavior matching the examples.
索引モデルが issue の本文から書いたものです。
説明
As seen on Discord. Motivating examples:
from sublime_lib import GlobalSettingsListener, ViewSettingsListener, on_setting_changed
class TabSizeListener(ViewSettingsListener):
@classmethod
def is_applicable(cls, settings: sublime.Settings) -> bool:
return settings.get('translate_tabs_to_spaces', False)
@classmethod
def applies_to_primary_view_only(cls) -> bool:
return True
@on_setting_changed('tab_size')
def tab_size_changed(self, new_value: object, old_value: object) -> None:
self.view.run_command('resize_existing_tabs', {
'new_size': new_value,
'old_size': old_value,
})
class JsCustomConfigurationsListener(GlobalSettingsListener)
SETTINGS_NAME = 'JS Custom.sublime-settings'
@on_setting_changed(get_configurations)
def configurations_changed(self, new_configurations, old_configurations):
if not self.settings.get('auto_build', False):
return
changed = [
name for name in set(old_configurations) | set(new_configurations)
if old_configurations.get(name, None) != new_configurations.get(name, None)
]
if changed:
print('JS Custom: Configuration changed. Rebuilding some syntaxes.')
sublime.active_window().run_command('build_js_custom_syntaxes', {'versions': changed})
This would provide the same convenience features as SettingsDict.subscribe: selecting the desired value from the settings, detecting whether that value has changed, and keeping track of the previous value. What is also provides beyond that is automatic management of the subscription lifetime. Manually calling clear_on_change is annoying, easy to forget, prone to mistakes, and when done right kind of boilerplate-y. A SettingsListener class can handle this automatically by simply inheriting from the existing listener classes (that Sublime already manages), calling clear_on_change in __del__, and using a weakref in add_on_change.
- 主要言語
- Python
- スター
- 56
- フォーク
- 5
- 平均マージ
- 25分
- マージ済み PR(30日)
- 3
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
SublimeText/sublime_lib のほかの issue
-
documentation
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
SublimeText/sublime_lib#183 ·
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 38/100
SublimeText/sublime_lib#173 · リアクション 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
SublimeText/sublime_lib#141 · コメント 2 件 ·
-
Since 4075, settings are iterable対応中かも @FichteFoll が 249 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
SublimeText/sublime_lib#139 · コメント 4 件 ·
-
Include type hints in documentation再び着手できるかも @Thom1729 が 2348 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンdocumentation
SublimeText/sublime_lib#137 · コメント 3 件 · 担当者 1 名 ·
SublimeText/sublime_lib の issue をすべて見る
似ている issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
glossyio/traffic-monitor#264 ·
メンテナーはふだん 1 日以内に返信
-
Add self-hostオープン
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
Atarity/deploy-your-own-saas#102 ·
-
[Bug]: RDFlex silently drops the covariate adjustment when the outcome or treatment column is integer-typed対応中かも @vrjdev が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
DoubleML/doubleml-for-py#424 ·
メンテナーはふだん 1 日以内に返信
-
agentic-dmx docs enhancement
難易度 1/5 1〜3時間 初心者へのやさしさ 86/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
521xueweihan/HelloGitHub#4150 ·