Skip to content

Commit 1fc85db

Browse files
committed
CR feedback and refactor bug fix
1 parent 4eea22b commit 1fc85db

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

typescript/libs/node_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def sendCmd(self, cmd, cb): pass
2525

2626
def sendCmdSync(self, cmd): pass
2727

28-
def sendCmdAsync(self, cmd): pass
28+
def sendCmdAsync(self, cmd, cb): pass
2929

3030

3131
class NodeCommClient(CommClient):
@@ -111,7 +111,7 @@ def makeTimeoutMsg(self, cmd, seq):
111111
}
112112
return timeoutMsg
113113

114-
def sendCmd(self, cmd, seq, cb):
114+
def sendCmd(self, cmd, cb, seq):
115115
"""
116116
send single-line command string; no sequence number; wait for response
117117
this assumes stdin/stdout; for TCP, need to add correlation with sequence numbers
@@ -133,7 +133,7 @@ def sendCmd(self, cmd, seq, cb):
133133
if (cb):
134134
cb(self.makeTimeoutMsg(cmd, seq))
135135

136-
def sendCmdAsync(self, cmd, seq, cb):
136+
def sendCmdAsync(self, cmd, cb, seq):
137137
"""
138138
Sends the command and registers a callback
139139
"""

typescript/libs/service_proxy.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,31 +47,31 @@ def completions(self, path, location=Location(1, 1), prefix="", on_completed=Non
4747
json_str = json_helpers.encode(req_dict)
4848
self.__comm.sendCmd(
4949
json_str,
50-
req_dict["seq"],
51-
lambda response_dict: None if on_completed is None else on_completed(response_dict)
50+
lambda response_dict: None if on_completed is None else on_completed(response_dict),
51+
req_dict["seq"]
5252
)
5353

5454
def async_completions(self, path, location=Location(1, 1), prefix="", on_completed=None):
5555
args = {"file": path, "line": location.line, "offset": location.offset, "prefix": prefix}
5656
req_dict = self.create_req_dict("completions", args)
5757
json_str = json_helpers.encode(req_dict)
58-
self.__comm.sendCmdAsync(json_str, req_dict["seq"], on_completed)
58+
self.__comm.sendCmdAsync(json_str, on_completed, req_dict["seq"])
5959

6060
def signature_help(self, path, location=Location(1, 1), prefix="", on_completed=None):
6161
args = {"file": path, "line": location.line, "offset": location.offset, "prefix": prefix}
6262
req_dict = self.create_req_dict("signatureHelp", args)
6363
json_str = json_helpers.encode(req_dict)
6464
self.__comm.sendCmd(
6565
json_str,
66-
req_dict["seq"],
67-
lambda response_dict: None if on_completed is None else on_completed(response_dict)
66+
lambda response_dict: None if on_completed is None else on_completed(response_dict),
67+
req_dict["seq"]
6868
)
6969

7070
def async_signature_help(self, path, location=Location(1, 1), prefix="", on_completed=None):
7171
args = {"file": path, "line": location.line, "offset": location.offset, "prefix": prefix}
7272
req_dict = self.create_req_dict("signatureHelp", args)
7373
json_str = json_helpers.encode(req_dict)
74-
self.__comm.sendCmdAsync(json_str, req_dict["seq"], on_completed)
74+
self.__comm.sendCmdAsync(json_str, on_completed, req_dict["seq"])
7575

7676
def definition(self, path, location=Location(1, 1)):
7777
args = {"file": path, "line": location.line, "offset": location.offset}
@@ -130,7 +130,7 @@ def reload_async(self, path, alternate_path, on_completed):
130130
args = {"file": path, "tmpfile": alternate_path}
131131
req_dict = self.create_req_dict("reload", args)
132132
json_str = json_helpers.encode(req_dict)
133-
self.__comm.sendCmdAsync(json_str, req_dict["seq"], on_completed)
133+
self.__comm.sendCmdAsync(json_str, on_completed, req_dict["seq"])
134134

135135
def rename(self, path, location=Location(1, 1)):
136136
args = {"file": path, "line": location.line, "offset": location.offset}
@@ -160,14 +160,14 @@ def quick_info(self, path, location=Location(1, 1), on_completed=None):
160160
if not IS_ST2:
161161
self.__comm.sendCmdAsync(
162162
json_str,
163-
req_dict["seq"],
164-
callback
163+
callback,
164+
req_dict["seq"]
165165
)
166166
else:
167167
self.__comm.sendCmd(
168168
json_str,
169-
req_dict["seq"],
170-
callback
169+
callback,
170+
req_dict["seq"]
171171
)
172172

173173
def get_event(self):

typescript/libs/view_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def is_special_view(view):
106106
in that they cannot be the active_view of their windows, therefore their ids
107107
shouldn't be equal to the current view id.
108108
"""
109-
return view.window() and view.id() != view.window().active_view().id()
109+
return view is not None and view.window() and view.id() != view.window().active_view().id()
110110

111111

112112
def get_location_from_view(view):

typescript/listeners/rename.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def on_load(self, view):
99
if client_info and client_info.rename_on_load:
1010
view.run_command(
1111
'typescript_delayed_rename_file',
12-
{"locs_name": client_info.renameOnLoad}
12+
{"locs_name": client_info.rename_on_load}
1313
)
1414
client_info.rename_on_load = None
1515

0 commit comments

Comments
 (0)