From 9729399d7484c64eef883caacd4a64608a6a67c4 Mon Sep 17 00:00:00 2001
From: Rafal Chlodnicki <rchl2k@gmail.com>
Date: Wed, 27 Sep 2023 22:10:17 +0200
Subject: [PATCH] a bit less indent

---
 plugin/formatting.py | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/plugin/formatting.py b/plugin/formatting.py
index 5ef93ed14..73287e98d 100644
--- a/plugin/formatting.py
+++ b/plugin/formatting.py
@@ -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)