@@ -46,11 +46,34 @@ def format_diffs(old_content, new_content):
46
46
prefixes = {
47
47
"method" : u"◉" ,
48
48
"property" : u"●" ,
49
- "class" :u"⊗"
49
+ "class" :u"◆" ,
50
+ "interface" :u"◇" ,
51
+ "keyword" :u"∆" ,
52
+ "variable" : u"∨" ,
50
53
}
51
54
55
+ js_id_re = re .compile (
56
+ ur'^[_$a-zA-Z\u00FF-\uFFFF][_$a-zA-Z0-9\u00FF-\uFFFF]*'
57
+ )
58
+
59
+ def is_member_completion (line ):
60
+
61
+ def partial_completion ():
62
+ print "IN partial_completion"
63
+ print line
64
+ sp = line .split ("." )
65
+ if len (sp ) > 1 :
66
+ print "OKAY"
67
+ return js_id_re .match (sp [- 1 ]) is not None
68
+ print "NOTOKAY"
69
+ return False
70
+
71
+ return line .endswith ("." ) or partial_completion ()
72
+
73
+
74
+
52
75
def format_completion_entry (c_entry ):
53
- prefix = prefixes [ c_entry ["kind" ]]
76
+ prefix = prefixes . get ( c_entry ["kind" ], u"-" )
54
77
prefix += " "
55
78
middle = c_entry ["name" ]
56
79
suffix = "\t " + c_entry ["type" ]
@@ -128,7 +151,8 @@ def msg(self, *args):
128
151
message = json .dumps (args ) + "\n "
129
152
t = time ()
130
153
self .p .stdin .write (message )
131
- res = json .loads (self .p .stdout .readline ())
154
+ msg_content = self .p .stdout .readline ()
155
+ res = json .loads (msg_content )
132
156
return res
133
157
134
158
def serv_add_file (self , file_name ):
@@ -373,10 +397,13 @@ def on_query_completions(self, view, prefix, locations):
373
397
if is_ts (view ):
374
398
# Get the position of the cursor (first one in case of multiple sels)
375
399
pos = view .sel ()[0 ].begin ()
376
- line = view .substr (sublime .Region (view .word (pos - 1 ).a , pos ))
377
- # Determine wether it is a member completion or not
378
- is_member = line .endswith ("." )
379
- completions_json = get_plugin (view ).serv_get_completions (view .file_name (), pos , is_member )
400
+ line = view .substr (sublime .Region (view .line (pos - 1 ).a , pos ))
401
+ bword_pos = sublime .Region (view .word (pos ).a , pos )
402
+ word = view .substr (bword_pos )
403
+ print "WORD : " , word
404
+ completions_json = get_plugin (view ).serv_get_completions (
405
+ view .file_name (), bword_pos .a , is_member_completion (line )
406
+ )
380
407
get_plugin (view ).set_error_status (view )
381
408
return completions_ts_to_sublime (completions_json )
382
409
0 commit comments