Skip to content

Commit

Permalink
Fix: Correct wiki link selectors
Browse files Browse the repository at this point in the history
Fixes #626

New Markdown.sublime-syntax comes along with new wiki-link scopes.
This commit adjusts selectors to make `mde_open_page` and
`mde_make_page_reference` visible again.
  • Loading branch information
deathaxe committed Sep 14, 2021
1 parent 801444f commit 2e49a2e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Default (Linux).sublime-keymap
Original file line number Diff line number Diff line change
Expand Up @@ -1168,13 +1168,13 @@
},
{ "keys": ["ctrl+alt+d"], "command": "mde_open_page", "context":
[
{ "key": "selector", "operator": "equal", "operand": "meta.link.wiki.markdown", "match_all": true },
{ "key": "selector", "operator": "equal", "operand": "meta.link.reference.wiki.markdown", "match_all": true },
{ "key": "setting.mde.keymap_disable.open_page", "operator": "not_equal", "operand": true }
]
},
{ "keys": ["ctrl+alt+d"], "command": "mde_make_page_reference", "context":
[
{ "key": "selector", "operator": "equal", "operand": "text.html.markdown - (meta.link.wiki | markup.underline.link)", "match_all": true },
{ "key": "selector", "operator": "equal", "operand": "text.html.markdown - (meta.link | markup.underline.link)", "match_all": true },
{ "key": "setting.mde.keymap_disable.make_page_reference", "operator": "not_equal", "operand": true }
]
},
Expand Down
4 changes: 2 additions & 2 deletions Default (OSX).sublime-keymap
Original file line number Diff line number Diff line change
Expand Up @@ -1168,13 +1168,13 @@
},
{ "keys": ["super+shift+d"], "command": "mde_open_page", "context":
[
{ "key": "selector", "operator": "equal", "operand": "meta.link.wiki.markdown", "match_all": true },
{ "key": "selector", "operator": "equal", "operand": "meta.link.reference.wiki.markdown", "match_all": true },
{ "key": "setting.mde.keymap_disable.open_page", "operator": "not_equal", "operand": true }
]
},
{ "keys": ["super+shift+d"], "command": "mde_make_page_reference", "context":
[
{ "key": "selector", "operator": "equal", "operand": "text.html.markdown - (meta.link.wiki | markup.underline.link)", "match_all": true },
{ "key": "selector", "operator": "equal", "operand": "text.html.markdown - (meta.link | markup.underline.link)", "match_all": true },
{ "key": "setting.mde.keymap_disable.make_page_reference", "operator": "not_equal", "operand": true }
]
},
Expand Down
4 changes: 2 additions & 2 deletions Default (Windows).sublime-keymap
Original file line number Diff line number Diff line change
Expand Up @@ -1168,13 +1168,13 @@
},
{ "keys": ["ctrl+alt+d"], "command": "mde_open_page", "context":
[
{ "key": "selector", "operator": "equal", "operand": "meta.link.wiki.markdown", "match_all": true },
{ "key": "selector", "operator": "equal", "operand": "meta.link.reference.wiki.markdown", "match_all": true },
{ "key": "setting.mde.keymap_disable.open_page", "operator": "not_equal", "operand": true }
]
},
{ "keys": ["ctrl+alt+d"], "command": "mde_make_page_reference", "context":
[
{ "key": "selector", "operator": "equal", "operand": "text.html.markdown - (meta.link.wiki | markup.underline.link)", "match_all": true },
{ "key": "selector", "operator": "equal", "operand": "text.html.markdown - (meta.link | markup.underline.link)", "match_all": true },
{ "key": "setting.mde.keymap_disable.make_page_reference", "operator": "not_equal", "operand": true }
]
},
Expand Down
8 changes: 4 additions & 4 deletions plugins/wiki_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class MdeMakePageReferenceCommand(MdeTextCommand):
def is_visible(self):
"""Return True if is on a wiki page reference."""
for sel in self.view.sel():
if not self.view.match_selector(sel.end(), "meta.link.wiki.markdown"):
if self.view.match_selector(sel.begin(), "meta.link.reference.wiki"):
return False
return True

Expand Down Expand Up @@ -66,9 +66,9 @@ class MdeOpenPageCommand(MdeTextCommand):
def is_visible(self):
"""Return True if caret is on a wiki page reference."""
for sel in self.view.sel():
if not self.view.match_selector(sel.end(), "meta.link.wiki.markdown"):
return False
return True
if self.view.match_selector(sel.begin(), "meta.link.reference.wiki"):
return True
return False

def run(self, edit):
wiki_page = WikiPage(self.view)
Expand Down

0 comments on commit 2e49a2e

Please sign in to comment.