From 74a7ba886d143bf77ef9ac275c87854c6b990482 Mon Sep 17 00:00:00 2001 From: Michael Lyons Date: Tue, 11 Nov 2025 15:54:19 -0500 Subject: [PATCH 1/3] Test Sublime Merge pages All the ones we have indexing for --- test/test_docset.py | 58 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/test/test_docset.py b/test/test_docset.py index beff2bb..653e825 100644 --- a/test/test_docset.py +++ b/test/test_docset.py @@ -84,6 +84,64 @@ def _test_a_doc_page_index( class SublimeMergeDocsetTestCase(DocsetTestCaseBase): NAME = 'sublime-merge.docset' + def test_home(self): + contains = [ + ('Guide', 'Documentation'), + ('Section', 'General'), + ('Section', 'Features'), + ('Section', 'Customization'), + ('Section', 'Miscellaneous'), + ('Section', 'Package Development'), + ] + self._test_a_doc_page_index('docs/index.html', contains) + + def test_key_bindings(self): + contains = [ + ('Guide', 'Key Bindings'), + ('Setting', '"keys" Key'), + ('Section', 'Bindings'), + ('Filter', '"search_mode"'), + ] + self._test_a_doc_page_index('docs/key_bindings.html', contains) + + def test_themes(self): + contains = [ + ('Guide', 'Themes'), + ('Property', 'layer#.opacity'), + ('Section', 'Settings'), + ('Setting', 'overlay_scroll_bars'), + ('Element', 'root_tabs'), + ('Property', 'puck_color'), + ] + self._test_a_doc_page_index('docs/themes.html', contains) + + def test_menus(self): + contains = [ + ('Guide', 'Menus'), + ('Section', 'Entries'), + ('File', 'Action.sublime-menu'), + ('Setting', '"mnemonic"'), + ('Variable', '$git_dir'), + ] + self._test_a_doc_page_index('docs/menus.html', contains) + + def test_packages(self): + contains = [ + ('Guide', 'Packages'), + ('Section', 'Package Directories'), + ('File', '%APPDATA%\\Sublime Merge\\Installed Packages\\'), + ('File', '~/Library/Application Support/Sublime Merge/Installed Packages/'), + ] + self._test_a_doc_page_index('docs/packages.html', contains) + + def test_minihtml(self): + contains = [ + ('Guide', 'minihtml Reference'), + ('Section', 'CSS'), + ('Variable', 'var(--greenish)'), + ] + self._test_a_doc_page_index('docs/minihtml.html', contains) + class SublimeTextDocsetTestCase(DocsetTestCaseBase): NAME = 'sublime-text.docset' From fc51fd925e1573f4ac5afd9539249622ccb6b3f8 Mon Sep 17 00:00:00 2001 From: Michael Lyons Date: Tue, 11 Nov 2025 15:55:29 -0500 Subject: [PATCH 2/3] Test half the Sublime Text pages. Fix some. --- sublime-text-dashing.yml | 43 +++++++------- test/test_docset.py | 125 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 148 insertions(+), 20 deletions(-) diff --git a/sublime-text-dashing.yml b/sublime-text-dashing.yml index b4ece23..ff2673a 100644 --- a/sublime-text-dashing.yml +++ b/sublime-text-dashing.yml @@ -47,13 +47,13 @@ selectors: ###[ INCREMENTAL DIFF ]######################################################## - # Commands and menus + # Scopes as Tags '#styling li p': - type: Style + type: Tag matchpath: '/incremental_diff\.html$' # Settings - 'dl.setting > dt[id]': + 'dl.setting > dt[id] ': attr: id type: Setting matchpath: '/incremental_diff\.html$' @@ -61,7 +61,7 @@ selectors: ###[ INDEXING ]################################################################ # Settings - 'dl.setting > dt[id]': + 'dl.setting > dt[id] ': attr: id type: Setting matchpath: '/indexing\.html$' @@ -72,12 +72,12 @@ selectors: # Completion kinds '#kind-info table.kinds td:not(:has(span))': - type: Enum + type: Value matchpath: '/completions\.html$' # Completion kinds again - 'dl.setting ul.simple:first-child > li': - type: Enum + '#rich-format dl.setting:has(#kind) ul.simple > li': + type: Value matchpath: '/completions\.html$' # Completion fields @@ -91,13 +91,13 @@ selectors: matchpath: '/completions\.html$' # Variables - '#variables table code': + '#variables table span.pre': type: Variable requiretext: '\$' matchpath: '/completions\.html$' # Settings - 'dl.setting > dt[id]': + 'dl.setting > dt[id] ': attr: id type: Setting matchpath: '/completions\.html$' @@ -118,7 +118,8 @@ selectors: ###[ PROJECTS ]################################################################ # Settings - 'dl.setting > dt[id]': + 'dl.setting > dt[id] ': + attr: id type: Setting matchpath: '/projects\.html$' @@ -146,26 +147,28 @@ selectors: ###[ INDENTATION SETTINGS ]#################################################### # Settings - 'dl.setting > dt[id]': + 'dl.setting > dt[id] ': + attr: id type: Setting matchpath: '/indentation\.html$' ###[ SPELL CHECKING ]########################################################## # Settings - 'dl.setting > dt[id]': + 'dl.setting > dt[id] ': + attr: id type: Setting matchpath: '/spell_checking\.html$' # Commands - '#commands code': + '#commands code:first-child': type: Command matchpath: '/spell_checking\.html$' ###[ BUILD SYSTEMS ]########################################################### # Options - 'dl.setting > dt[id]': + 'dl.setting > dt[id] ': attr: id type: Option matchpath: '/build_systems\.html$' @@ -179,7 +182,7 @@ selectors: ###[ PACKAGES ]################################################################ # Files - 'li span.file': + 'li span.file ': type: File matchpath: '/packages\.html$' @@ -238,7 +241,7 @@ selectors: matchpath: '/color_schemes\.html$' # Settings - 'dl.setting > dt[id]': + 'dl.setting > dt[id] ': type: Setting matchpath: '/color_schemes\.html$' @@ -255,7 +258,7 @@ selectors: ###[ THEMES ]################################################################## # Settings - 'dl.setting > dt[id]': + 'dl.setting > dt[id] ': type: Setting matchpath: '/themes\.html$' @@ -278,7 +281,7 @@ selectors: ###[ MENUS ]################################################################### # Settings - 'dl.setting > dt[id]': + 'dl.setting > dt[id] ': type: Setting matchpath: '/menus\.html$' @@ -346,9 +349,9 @@ selectors: ###[ SCOPE NAMING ]############################################################ - # Scope names as Values + # Scope names as Tags 'ul.simple li code': - type: Value + type: Tag matchpath: '/scope_naming\.html$' ###[ MINIHTML REFERENCE ]###################################################### diff --git a/test/test_docset.py b/test/test_docset.py index 653e825..a24eb66 100644 --- a/test/test_docset.py +++ b/test/test_docset.py @@ -57,6 +57,7 @@ def _test_a_doc_page_index( self, path: str, contains_strict: list[tuple[str,str]], contains_lenient: list[tuple[str,str]] | None = None, + not_contains: list[tuple[str,str]] | None = None, ): sql = f''' SELECT type, name @@ -80,6 +81,9 @@ def _test_a_doc_page_index( lookup_result = lookup[ds_term][:] self.assertFalse(lookup_result.remove(ds_type)) + for pair in not_contains or []: + self.assertNotIn(pair, items) + class SublimeMergeDocsetTestCase(DocsetTestCaseBase): NAME = 'sublime-merge.docset' @@ -146,6 +150,16 @@ def test_minihtml(self): class SublimeTextDocsetTestCase(DocsetTestCaseBase): NAME = 'sublime-text.docset' + def test_home(self): + contains = [ + ('Guide', 'Documentation'), + ('Section', 'Usage'), + ('Section', 'Customization'), + ('Section', 'Miscellaneous'), + ('Section', 'Package Development'), + ] + self._test_a_doc_page_index('docs/index.html', contains) + def test_git_integration(self): contains = [ ('Guide', 'Git Integration'), @@ -153,9 +167,120 @@ def test_git_integration(self): ('Section', 'Diff Markers'), ('Command', 'Open Git Repository…'), ('Command', 'Sublime Merge: Folder History'), + ('Setting', 'show_git_status'), ] self._test_a_doc_page_index('docs/git_integration.html', contains) + def test_incremental_diff(self): + contains = [ + ('Guide', 'Incremental Diff'), + ('Section', 'Diff Markers'), + ('Tag', 'diff.inserted'), + ('Setting', 'mini_diff'), + ] + self._test_a_doc_page_index('docs/incremental_diff.html', contains) + + def test_indexing(self): + contains = [ + ('Guide', 'Indexing'), + ('Section', 'Status'), + ('Setting', 'index_exclude_patterns'), + ] + self._test_a_doc_page_index('docs/indexing.html', contains) + + def test_completions(self): + contains = [ + ('Guide', 'Completions'), + ('Section', 'Completion Metadata'), + ('Setting', 'auto_complete_delay'), + ('Field', 'tabTrigger'), + ('Value', 'Navigation'), + ('Value', '"navigation"'), + ('Variable', '$TM_FILEPATH'), + ] + self._test_a_doc_page_index('docs/completions.html', contains) + + def test_distraction_free_mode(self): + contains = [ + ('Guide', 'Distraction Free Mode'), + ('Section', 'Customization'), + ('Setting', '"gutter"'), + ('File', 'Packages/User/Distraction Free.sublime-settings'), + ] + self._test_a_doc_page_index('docs/distraction_free.html', contains) + + def test_projects(self): + contains = [ + ('Guide', 'Projects'), + ('Section', 'Project Format'), + ('Setting', 'follow_symlinks'), + ] + self._test_a_doc_page_index('docs/projects.html', contains) + + def test_settings(self): + contains = [ + ('Guide', 'Settings'), + ('Section', 'Categories'), + ('File', 'Packages/Default/Preferences.sublime-settings'), + ] + self._test_a_doc_page_index('docs/settings.html', contains) + + def test_key_bindings(self): + contains = [ + ('Guide', 'Key Bindings'), + ('Section', 'User Bindings'), + ('Filter', '"has_prev_field"'), + ('Setting', '"args" Key'), + ] + self._test_a_doc_page_index('docs/key_bindings.html', contains) + + def test_indentation_settings(self): + contains = [ + ('Guide', 'Indentation Settings'), + ('Section', 'Converting Between Tabs and Spaces'), + ('Setting', 'indent_to_bracket'), + ('Setting', 'use_tab_stops'), + ] + self._test_a_doc_page_index('docs/indentation.html', contains) + + def test_spell_checking(self): + contains = [ + ('Guide', 'Spell Checking'), + ('Section', 'Dictionaries'), + ('Setting', 'spell_check'), + ('Command', 'next_misspelling'), + ] + not_contains = [ + ('Command', 'word'), + ] + self._test_a_doc_page_index('docs/spell_checking.html', contains, + not_contains=not_contains) + + def test_build_systems(self): + contains = [ + ('Guide', 'Build Systems'), + ('Section', 'Custom Options'), + ('Option', 'quiet'), + ('Variable', '$project_path'), + ] + self._test_a_doc_page_index('docs/build_systems.html', contains) + + def test_packages(self): + contains = [ + ('Guide', 'Packages'), + ('Section', 'Locations'), + ('File', '/Installed Packages/'), + ] + self._test_a_doc_page_index('docs/packages.html', contains) + + def test_file_patterns(self): + contains = [ + ('Guide', 'File Patterns'), + ('Section', 'Uses'), + ('Setting', '"binary_file_patterns"'), + ] + self._test_a_doc_page_index('docs/file_patterns.html', contains) + def test_api_reference(self): contains = [ ('Guide', 'API Reference'), From cc579aca85f486fbff74be770fcecc0864ffd768 Mon Sep 17 00:00:00 2001 From: Michael Lyons Date: Tue, 11 Nov 2025 17:14:31 -0500 Subject: [PATCH 3/3] Test the other Sublime Text pages --- fix_index.py | 3 + sublime-text-dashing.yml | 38 ++++++++++--- test/test_docset.py | 120 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 153 insertions(+), 8 deletions(-) diff --git a/fix_index.py b/fix_index.py index c2de483..637c563 100644 --- a/fix_index.py +++ b/fix_index.py @@ -18,6 +18,9 @@ ('docs/syntax.html', ' SYNTAX\nTEST ""', ' SYNTAX TEST ""', ), + ('docs/safe_mode.html', + 'subl--safe-mode', + 'subl --safe-mode', ), ], 'sublime-merge.docset': [] } diff --git a/sublime-text-dashing.yml b/sublime-text-dashing.yml index ff2673a..535e19c 100644 --- a/sublime-text-dashing.yml +++ b/sublime-text-dashing.yml @@ -212,7 +212,7 @@ selectors: ###[ REVERTING TO A FRESHLY INSTALLED STATE ]################################## # Files - '#reverting-to-a-freshly-installed-state > ul li span.file': + 'li span.file ': type: File matchpath: '/revert\.html$' @@ -230,8 +230,7 @@ selectors: # Files 'li span.file': type: File - requiretext: 'license' - matchpath: '/packages\.html$' + matchpath: '/portable_license_keys\.html$' ###[ COLOR SCHEMES ]########################################################### @@ -242,6 +241,7 @@ selectors: # Settings 'dl.setting > dt[id] ': + attr: id type: Setting matchpath: '/color_schemes\.html$' @@ -251,7 +251,7 @@ selectors: matchpath: '/color_schemes\.html$' # CSS Colors - '#appendix-css-colors li span:not(.color-block)': + '#appendix-css-colors span:not(.color-block)': type: Value matchpath: '/color_schemes\.html$' @@ -259,6 +259,7 @@ selectors: # Settings 'dl.setting > dt[id] ': + attr: id type: Setting matchpath: '/themes\.html$' @@ -282,6 +283,7 @@ selectors: # Settings 'dl.setting > dt[id] ': + attr: id type: Setting matchpath: '/menus\.html$' @@ -337,8 +339,13 @@ selectors: ###[ SYNTAX DEFINITIONS ]###################################################### - # Syntax - 'dl.setting span.pre': + # Syntax header + '#header dl.setting > dt > span.sig-name': + type: Trait + matchpath: '/syntax\.html$' + + # Syntax body + '#contexts dl.setting > dt > span.sig-name': type: Instruction matchpath: '/syntax\.html$' @@ -357,14 +364,29 @@ selectors: ###[ MINIHTML REFERENCE ]###################################################### # Elements - '#tags li > code': + '#tags li code': type: Element requiretext: '<.+>' matchpath: '/minihtml\.html$' + # Attributes + '#attributes li code': + type: Attribute + matchpath: '/minihtml\.html$' + # CSS styles - '#css li code:first-child': + '#css > ul li code:first-child': type: Style matchpath: '/minihtml\.html$' + # Color functions + '#color-mod-function-proprietary > ul li code': + type: Function + matchpath: '/minihtml\.html$' + + # Variables + '#predefined-variables > ul li code': + type: Variable + matchpath: '/minihtml\.html$' + ###[ PLUGIN PORTING GUIDE ]#################################################### diff --git a/test/test_docset.py b/test/test_docset.py index a24eb66..c19ee26 100644 --- a/test/test_docset.py +++ b/test/test_docset.py @@ -281,6 +281,70 @@ def test_file_patterns(self): ] self._test_a_doc_page_index('docs/file_patterns.html', contains) + def test_safe_mode(self): + contains = [ + ('Guide', 'Safe Mode'), + ('Section', 'Behavior'), + ('File', '~/.config/sublime-text-safe-mode/'), + ('Command', 'subl --safe-mode'), + ] + self._test_a_doc_page_index('docs/safe_mode.html', contains) + + def test_reverting_install(self): + contains = [ + ('Guide', 'Reverting to a Freshly Installed State'), + ('Section', 'Cache'), + ('File', '~/Library/Application Support/Sublime Text'), + ('File', '~/.cache/sublime-text'), + ] + self._test_a_doc_page_index('docs/revert.html', contains) + + def test_ligatures(self): + contains = [ + ('Guide', 'Ligatures'), + ('Section', 'Troubleshooting'), + ('Option', '"no_clig"'), + ] + self._test_a_doc_page_index('docs/ligatures.html', contains) + + def test_portable_license(self): + contains = [ + ('Guide', 'Portable License Keys'), + ('Section', 'Steps'), + ('File', '~/Library/Application Support/Sublime Text/Local'), + ] + self._test_a_doc_page_index('docs/portable_license_keys.html', contains) + + def test_color_schemes(self): + contains = [ + ('Guide', 'Color Schemes'), + ('Section', 'Scope Rules'), + ('Setting', 'minimap_border'), + ('Function', 'blenda() adjuster'), + ('Value', 'aliceblue'), + ] + self._test_a_doc_page_index('docs/color_schemes.html', contains) + + def test_themes(self): + contains = [ + ('Guide', 'Themes'), + ('Section', 'Inheritance'), + ('Property', 'indent_top_level'), + ('Property', 'fg'), + ('Element', 'disclosure_button_control'), + ('Setting', 'overlay_scroll_bars'), + ] + self._test_a_doc_page_index('docs/themes.html', contains) + + def test_menus(self): + contains = [ + ('Guide', 'Menus'), + ('Section', 'Entries'), + ('File', 'Side Bar Mount Point.sublime-menu'), + ('Setting', 'mnemonic'), + ] + self._test_a_doc_page_index('docs/menus.html', contains) + def test_api_reference(self): contains = [ ('Guide', 'API Reference'), @@ -297,6 +361,62 @@ def test_api_reference(self): ] self._test_a_doc_page_index('docs/api_reference.html', contains) + def test_syntax_definitions(self): + contains = [ + ('Guide', 'Syntax Definitions'), + ('Section', 'Including Other Files'), + ('Trait', 'first_line_match'), + ('Instruction', 'pop'), + ('Instruction', 'meta_content_scope'), + ('Test', '^'), + ('Test', '<-'), + ('Test', 'local-definition'), + ] + not_contains = [ + ('Trait', '.'), + ('Trait', '0'), + ('Trait', '1'), + ('Trait', '2'), + ('Instruction', '.'), + ('Instruction', '0'), + ('Instruction', '1'), + ('Instruction', '2'), + ('Instruction', '#'), + ('Instruction', ':'), + ('Instruction', '['), + ('Instruction', '{'), + ('Instruction', 'true'), + ] + self._test_a_doc_page_index('docs/syntax.html', contains, + not_contains=not_contains) + + def test_scope_naming(self): + contains = [ + ('Guide', 'Scope Naming'), + ('Section', 'Syntax Definitions'), + ('Tag', 'constant.numeric.integer.hexadecimal'), + ] + self._test_a_doc_page_index('docs/scope_naming.html', contains) + + def test_minihtml(self): + contains = [ + ('Guide', 'minihtml Reference'), + ('Section', 'CSS'), + ('Element', '

'), + ('Element', '

'), + ('Element', '
    '), + ('Attribute', 'href'), + ('Variable', 'var(--greenish)'), + ('Style', 'padding-top'), + ('Function', 'lightness()'), + ('Function', 'l()'), + ] + not_contains = [ + ('Element', 'file://'), + ] + self._test_a_doc_page_index('docs/minihtml.html', contains, + not_contains=not_contains) + # Don't test the base class directly del DocsetTestCaseBase