This repository was archived by the owner on May 25, 2019. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork 168
/
Copy pathviewlocation.py
57 lines (45 loc) · 1.33 KB
/
viewlocation.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
importsublime, re
isST2=int(sublime.version()) <3000
ifisST2:
importmessage
else:
from . importmessage
defsettings():
returnsublime.load_settings('AngularJS-sublime-package.sublime-settings')
defat_line_with_module(view, locations):
line=view.substr(view.line(locations[0]))
return'module('inline
defat_html_attribute(view, attribute, locations):
selector=view.match_selector(locations[0], 'text.html string')
ifnotselector:
returnFalse
check_attribute=''
view_point=locations[0]
char=''
while(notchar.isspace() andview_point>-1):
char=view.substr(view_point)
if(notchar.isspace()):
check_attribute+=char
view_point-=1
check_attribute=check_attribute[::-1]
ifcheck_attribute.startswith(attribute):
returnTrue
returnFalse
deffind_word(view, region):
non_char=re.compile(settings().get('non_word_chars'))
look_up_found=""
start_point=region.end()
begin_point=start_point-1
end_point=start_point+1
while (
notnon_char.search(view.substr(sublime.Region(start_point, end_point)))
andend_point
):
end_point+=1
while (
notnon_char.search(view.substr(sublime.Region(begin_point, start_point)))
):
begin_point-=1
look_up_found=view.substr(sublime.Region(begin_point+1, end_point-1))
message.alert('Looking up: '+look_up_found)
returnlook_up_found