@@ -41,7 +41,7 @@ def get_info(view, open_if_not_cached=True):
41
41
"""Find the file info on the server that matches the given view"""
42
42
if not get_language_service_enabled ():
43
43
return
44
-
44
+
45
45
if not cli .initialized :
46
46
cli .initialize ()
47
47
@@ -106,15 +106,18 @@ def is_typescript(view):
106
106
except :
107
107
return False
108
108
109
- return (view .match_selector (location , 'source.ts' ) or
110
- view .match_selector (location , 'source.tsx' ))
109
+ is_ts_file = view .match_selector (location , 'source.ts, source.tsx' )
110
+ is_js_file = cli .enable_language_service_for_js \
111
+ and view .match_selector (location , 'source.js, source.jsx' )
112
+
113
+ return is_ts_file or is_js_file
111
114
112
115
113
116
def is_special_view (view ):
114
117
"""Determine if the current view is a special view.
115
118
116
119
Special views are mostly referring to panels. They are different from normal views
117
- in that they cannot be the active_view of their windows, therefore their ids
120
+ in that they cannot be the active_view of their windows, therefore their ids
118
121
shouldn't be equal to the current view id.
119
122
"""
120
123
return view is not None and view .window () and view .id () != view .window ().active_view ().id ()
@@ -265,7 +268,7 @@ def reload_required(view):
265
268
def check_update_view (view ):
266
269
"""Check if the buffer in the view needs to be reloaded
267
270
268
- If we have changes to the view not accounted for by change messages,
271
+ If we have changes to the view not accounted for by change messages,
269
272
send the whole buffer through a temporary file
270
273
"""
271
274
if is_typescript (view ):
@@ -276,7 +279,7 @@ def check_update_view(view):
276
279
277
280
def send_replace_changes_for_regions (view , regions , insert_string ):
278
281
"""
279
- Given a list of regions and a (possibly zero-length) string to insert,
282
+ Given a list of regions and a (possibly zero-length) string to insert,
280
283
send the appropriate change information to the server.
281
284
"""
282
285
if not is_typescript (view ):
0 commit comments