forked from guillermooo/dart-sublime-bundle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmds_search.py
39 lines (30 loc) · 1.14 KB
/
cmds_search.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Copyright (c) 2014, Guillermo López-Anglada. Please see the AUTHORS file for details.
# All rights reserved. Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.)
'''Search commands.
'''
import sublime
import sublime_plugin
from Dart.sublime_plugin_lib import PluginLogger
from Dart import analyzer
_logger = PluginLogger(__name__)
class DartFindTopLevelDeclsCommand(sublime_plugin.WindowCommand):
'''Displays the top-level declarations.
'''
def run(self):
if analyzer.g_server.ping():
v = self.window.active_view()
word = v.word(v.sel()[0].b)
word = v.substr(word).strip()
_logger.info("finding top level decls")
analyzer.g_server.send_find_top_level_decls(v, word)
return
class DartFindReferences(sublime_plugin.WindowCommand):
'''Displays the references of the given element.
'''
def run(self):
if analyzer.g_server.ping():
v = self.window.active_view()
_logger.info("finding element references")
analyzer.g_server.send_find_element_refs(v)
return