Skip to content

Commit

Permalink
a bit less indent
Browse files Browse the repository at this point in the history
  • Loading branch information
rchl committed Sep 27, 2023
1 parent 33911c8 commit 9729399
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions plugin/formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,20 +154,19 @@ def on_select_formatter(self, base_scope: str, session_names: List[str], index:
if index == -1:
return
session_name = session_names[index]
window = self.view.window()
if window:
window_manager = windows.lookup(window)
if window_manager:
project_data = window.project_data()
if isinstance(project_data, dict):
project_settings = project_data.setdefault('settings', dict())
project_lsp_settings = project_settings.setdefault('LSP', dict())
project_formatter_settings = project_lsp_settings.setdefault('formatters', dict())
project_formatter_settings[base_scope] = session_name
window_manager.suppress_sessions_restart_on_project_update = True
window.set_project_data(project_data)
else: # Save temporarily for this window
window_manager.formatters[base_scope] = session_name
window_manager = windows.lookup(self.view.window())
if window_manager:
window = window_manager.window
project_data = window.project_data()
if isinstance(project_data, dict):
project_settings = project_data.setdefault('settings', dict())
project_lsp_settings = project_settings.setdefault('LSP', dict())
project_formatter_settings = project_lsp_settings.setdefault('formatters', dict())
project_formatter_settings[base_scope] = session_name
window_manager.suppress_sessions_restart_on_project_update = True
window.set_project_data(project_data)
else: # Save temporarily for this window
window_manager.formatters[base_scope] = session_name
session = self.session_by_name(session_name, self.capability)
if session:
session.send_request_task(text_document_formatting(self.view)).then(self.on_result)
Expand Down

0 comments on commit 9729399

Please sign in to comment.