Skip to content

Commit 5876ba0

Browse files
committed
use longer names
1 parent bd23db9 commit 5876ba0

File tree

6 files changed

+41
-41
lines changed

6 files changed

+41
-41
lines changed

plugin/code_actions.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from __future__ import annotations
2-
from .core.logging import notify_err
2+
from .core.logging import notify_error
33
from .core.promise import Promise
44
from .core.protocol import CodeAction
55
from .core.protocol import CodeActionKind
@@ -353,8 +353,8 @@ def run_async() -> None:
353353

354354
def _handle_response_async(self, session_name: str, response: Any) -> None:
355355
if isinstance(response, Error):
356-
msg = f"{session_name}: {str(response)}"
357-
notify_err(msg, msg)
356+
message = f"{session_name}: {str(response)}"
357+
notify_error(message, message)
358358

359359

360360
# This command must be a WindowCommand in order to reliably hide corresponding menu entries when no view has focus.
@@ -416,8 +416,8 @@ def run_async(self, index: int, event: dict | None) -> None:
416416

417417
def _handle_response_async(self, session_name: str, response: Any) -> None:
418418
if isinstance(response, Error):
419-
msg = f"{session_name}: {str(response)}"
420-
notify_err(msg, msg)
419+
message = f"{session_name}: {str(response)}"
420+
notify_error(message, message)
421421

422422
def _is_cache_valid(self, event: dict | None) -> bool:
423423
view = self.view

plugin/core/logging.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,25 +41,25 @@ def printf(*args: Any, prefix: str = 'LSP') -> None:
4141
print(prefix + ":", *args)
4242

4343

44-
def notify(win: sublime.Window, msg: str, status: str = 'LSP: see console log…') -> None:
44+
def notify(window: sublime.Window, message: str, status: str = 'LSP: see console log…') -> None:
4545
"""Pick either of the 2 ways to show a message:
4646
- via a blocking modal dialog
4747
- via a detailed console message and a short status message"""
4848
from .settings import userprefs
4949
if userprefs().suppress_error_dialogs:
50-
win.status_message(status)
51-
print(msg)
50+
window.status_message(status)
51+
print(message)
5252
else:
53-
win.message_dialog(msg)
53+
window.message_dialog(message)
5454

5555

56-
def notify_err(win: sublime.Window, msg: str, status: str = '❗LSP: see console log…') -> None:
56+
def notify_error(window: sublime.Window, message: str, status: str = '❗LSP: see console log…') -> None:
5757
"""Pick either of the 2 ways to show a message:
5858
- via a blocking modal dialog
5959
- via a detailed console message and a short status message"""
6060
from .settings import userprefs
6161
if userprefs().suppress_error_dialogs:
62-
win.status_message(status)
63-
print(msg)
62+
window.status_message(status)
63+
print(message)
6464
else:
65-
sublime.error_message(msg)
65+
sublime.error_message(message)

plugin/core/workspace.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ def enable_in_project(window: sublime.Window, config_name: str) -> None:
147147
project_client_settings['enabled'] = True
148148
window.set_project_data(project_data)
149149
else:
150-
msg = f"Can't enable {config_name} in the current workspace. Ensure that the project is saved first."
150+
message = f"Can't enable {config_name} in the current workspace. Ensure that the project is saved first."
151151
status = f"LSP: Can't enable {config_name} in this workspace… See console"
152-
notify(window, msg, status)
152+
notify(window, message, status)
153153

154154

155155
def disable_in_project(window: sublime.Window, config_name: str) -> None:
@@ -161,6 +161,6 @@ def disable_in_project(window: sublime.Window, config_name: str) -> None:
161161
project_client_settings['enabled'] = False
162162
window.set_project_data(project_data)
163163
else:
164-
msg = f"Can't disable {config_name} in the current workspace. Ensure that the project is saved first."
164+
message = f"Can't disable {config_name} in the current workspace. Ensure that the project is saved first."
165165
status = f"LSP: Can't enable {config_name} in this workspace… See console"
166-
notify(window, msg, status)
166+
notify(window, message, status)

plugin/execute_command.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ def handle_error_async(self, error: Error, command_name: str) -> None:
5959
:param error: The Error object.
6060
:param command_name: The name of the command that was executed.
6161
"""
62-
msg = f"command {command_name} failed. Reason: {str(error)}"
62+
message = f"command {command_name} failed. Reason: {str(error)}"
6363
status = f"LSP: {command_name} failed… See console"
64-
notify(self.view.window(), msg, status)
64+
notify(self.view.window(), message, status)
6565

6666
def _expand_variables(self, command_args: list[Any]) -> list[Any]:
6767
view = self.view

plugin/rename.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from .core.edit import parse_range
33
from .core.edit import parse_workspace_edit
44
from .core.edit import WorkspaceChanges
5-
from .core.logging import notify_err
5+
from .core.logging import notify_error
66
from .core.protocol import PrepareRenameParams
77
from .core.protocol import PrepareRenameResult
88
from .core.protocol import Range
@@ -212,8 +212,8 @@ def _on_rename_result_async(self, session: Session, response: WorkspaceEdit | No
212212

213213
def _on_prepare_result(self, pos: int, session_name: str | None, response: PrepareRenameResult | None) -> None:
214214
if response is None:
215-
msg = "The current selection cannot be renamed"
216-
notify_err(msg, msg)
215+
message = "The current selection cannot be renamed"
216+
notify_error(message, message)
217217
return
218218
if is_range_response(response):
219219
r = range_to_region(response, self.view)
@@ -228,8 +228,8 @@ def _on_prepare_result(self, pos: int, session_name: str | None, response: Prepa
228228
self.view.run_command("lsp_symbol_rename", args)
229229

230230
def _on_prepare_error(self, error: Any) -> None:
231-
msg = "Rename error: {}".format(error["message"])
232-
notify_err(msg, msg)
231+
message = "Rename error: {}".format(error["message"])
232+
notify_error(message, message)
233233

234234
def _get_relative_path(self, file_path: str) -> str:
235235
wm = windows.lookup(self.view.window())

plugin/tooling.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from .core.css import css
33
from .core.logging import debug
44
from .core.logging import notify
5-
from .core.logging import notify_err
5+
from .core.logging import notify_error
66
from .core.registry import windows
77
from .core.sessions import get_plugin
88
from .core.transports import create_transport
@@ -132,19 +132,19 @@ def run(self, base_package_name: str) -> None:
132132
try:
133133
urllib.parse.urlparse(base_url)
134134
except Exception:
135-
msg = "The clipboard content must be a URL to a package.json file."
135+
message = "The clipboard content must be a URL to a package.json file."
136136
status = "Clipboard must be a URL to package.json"
137-
notify_err(sublime.active_window(), msg, status)
137+
notify_error(sublime.active_window(), message, status)
138138
return
139139
if not base_url.endswith("package.json"):
140-
msg = "URL must end with 'package.json'"
141-
notify_err(sublime.active_window(), msg, msg)
140+
message = "URL must end with 'package.json'"
141+
notify_error(sublime.active_window(), message, message)
142142
return
143143
try:
144144
package = json.loads(urllib.request.urlopen(base_url).read().decode("utf-8"))
145145
except Exception as ex:
146-
msg = f'Unable to load "{base_url}": {ex}'
147-
notify_err(sublime.active_window(), msg, msg)
146+
message = f'Unable to load "{base_url}": {ex}'
147+
notify_error(sublime.active_window(), message, message)
148148
return
149149

150150
# There might be a translations file as well.
@@ -156,13 +156,13 @@ def run(self, base_package_name: str) -> None:
156156

157157
contributes = package.get("contributes")
158158
if not isinstance(contributes, dict):
159-
msg = 'No "contributes" key found!'
160-
notify_err(sublime.active_window(), msg, msg)
159+
message = 'No "contributes" key found!'
160+
notify_error(sublime.active_window(), message, message)
161161
return
162162
configuration = contributes.get("configuration")
163163
if not isinstance(configuration, dict) and not isinstance(configuration, list):
164-
msg = 'No "contributes.configuration" key found!'
165-
notify_err(sublime.active_window(), msg, msg)
164+
message = 'No "contributes.configuration" key found!'
165+
notify_error(sublime.active_window(), message, message)
166166
return
167167
if isinstance(configuration, dict):
168168
properties = configuration.get("properties")
@@ -171,8 +171,8 @@ def run(self, base_package_name: str) -> None:
171171
for configuration_item in configuration:
172172
properties.update(configuration_item.get("properties"))
173173
if not isinstance(properties, dict):
174-
msg = 'No "contributes.configuration.properties" key found!'
175-
notify_err(sublime.active_window(), msg, msg)
174+
message = 'No "contributes.configuration.properties" key found!'
175+
notify_error(sublime.active_window(), message, message)
176176
return
177177

178178
# Process each key-value pair of the server settings.
@@ -312,8 +312,8 @@ def run(self) -> None:
312312
return
313313
view = wm.window.active_view()
314314
if not view:
315-
msg = 'Troubleshooting must be run with a file opened'
316-
notify(self.window, msg, msg)
315+
message = 'Troubleshooting must be run with a file opened'
316+
notify(self.window, message, message)
317317
return
318318
active_view = view
319319
configs = wm.get_config_manager().get_configs()
@@ -467,9 +467,9 @@ def run(self, edit: sublime.Edit) -> None:
467467
return
468468
listener = wm.listener_for_view(self.view)
469469
if not listener or not any(listener.session_views_async()):
470-
msg = "There is no language server running for this view."
470+
message = "There is no language server running for this view."
471471
status = "No language server for this view"
472-
notify_err(wm.window, msg, status)
472+
notify_error(wm.window, message, status)
473473
return
474474
v = wm.window.new_file()
475475
v.set_scratch(True)

0 commit comments

Comments
 (0)