Skip to content

Commit 326aef4

Browse files
Ryan P. C. McQuenfarcaller
Ryan P. C. McQuen
authored andcommitted
Add support to search anything. (#65)
Provides a `dash_doc_search` command that invokes dash with the query passed from the UI.
1 parent a336d65 commit 326aef4

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

DashDoc.py

+13
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,16 @@ def run(self, edit, flip_syntax_sensitive=False, run_in_background=False):
6868
else:
6969
subprocess.call(['/usr/bin/open', '-g',
7070
'dash-plugin://keys=%s&query=%s%s' % (','.join(keys), quote(query), background_string)])
71+
72+
class DashDocSearchCommand(sublime_plugin.WindowCommand):
73+
def run(self):
74+
self.window.show_input_panel('Topic?', '', self.on_done, self.on_change, self.on_cancel)
75+
76+
def on_change(self, name):
77+
pass
78+
79+
def on_cancel(self, name):
80+
pass
81+
82+
def on_done(self, topic):
83+
subprocess.call(["open", "dash-plugin://" + quote(topic)])

Default.sublime-commands

+4
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,9 @@
2828
"flip_syntax_sensitive": true,
2929
"run_in_background": true
3030
}
31+
},
32+
{
33+
"caption": "DashDoc: search any topic",
34+
"command": "dash_doc_search"
3135
}
3236
]

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ for the flipped case sensitive mode.
3838

3939
As usual, you will find the associated settings under the *Preferences / Package Settings / DashDoc* menu. Personal settings should be made in *Settings - User*.
4040

41+
### Search any topic
42+
43+
DashDoc also includes a command to search any topic right from Sublime's command palette.
44+
4145
### Syntax sensitivity
4246

4347
By default, DashDoc is sensitive to the syntax used in the current view. Dash will then consult the docset that matches the current syntax. Example: a lookup for `map` in a Haskell buffer will instruct Dash to search in its `haskell` docset, a search for the same word in a Python buffer will consult the `python` docset instead.

0 commit comments

Comments
 (0)