Repository: sublimelsp/LSP

Issue:
Lsp-Omnisharp Code Actions does not work
**Describe the bug**
as title say

**To Reproduce**
Steps to reproduce the behavior:
1. Install Lsp and Lsp-Omnisharp
2. Enable Omnisharp Lsp Server
3. using xxx; Code Actions
4. Does not work

**Expected behavior**
change document to add `using xxx`

**Environment (please complete the following information):**
- OS: Arch
- Sublime Text version: 4152
- LSP version: 1.25.0
- Language servers used: Lsp-Omnisharp

**Additional context**

`self.has_capability("codeActionProvider.resolveProvider")` False
![image](https://github.com/sublimelsp/LSP/assets/51814639/1b455e8d-f532-4687-8925-d266584d9f91)

CodeActionProvider register with selector. So `self.has_capability` check failed

![image](https://github.com/sublimelsp/LSP/assets/51814639/89186f16-3ad0-4f80-a85c-aa4f960dc133)




Discussion:

Resolving patch:
diff --git a/plugin/core/sessions.py b/plugin/core/sessions.py
--- a/plugin/core/sessions.py
+++ b/plugin/core/sessions.py
@@ -1619,7 +1619,7 @@ def run_code_action_async(
         # A code action can have an edit and/or command. Note that it can have *both*. In case both are present, we
         # must apply the edits before running the command.
         code_action = cast(CodeAction, code_action)
-        return self._maybe_resolve_code_action(code_action) \
+        return self._maybe_resolve_code_action(code_action, view) \
             .then(lambda code_action: self._apply_code_action_async(code_action, view))
 
     def open_uri_async(
@@ -1704,12 +1704,19 @@ def notify_plugin_on_session_buffer_change(self, session_buffer: SessionBufferPr
         if self._plugin:
             self._plugin.on_session_buffer_changed_async(session_buffer)
 
-    def _maybe_resolve_code_action(self, code_action: CodeAction) -> Promise[Union[CodeAction, Error]]:
-        if "edit" not in code_action and self.has_capability("codeActionProvider.resolveProvider"):
-            # TODO: Should we accept a SessionBuffer? What if this capability is registered with a documentSelector?
-            # We must first resolve the command and edit properties, because they can potentially be absent.
-            request = Request("codeAction/resolve", code_action)
-            return self.send_request_task(request)
+    def _maybe_resolve_code_action(
+        self, code_action: CodeAction, view: Optional[sublime.View]
+    ) -> Promise[Union[CodeAction, Error]]:
+        if "edit" not in code_action:
+            has_capability = self.has_capability("codeActionProvider.resolveProvider")
+            if not has_capability and view:
+                session_view = self.session_view_for_view_async(view)
+                if session_view:
+                    has_capability = session_view.has_capability_async("codeActionProvider.resolveProvider")
+            if has_capability:
+                # We must first resolve the command and edit properties, because they can potentially be absent.
+                request = Request("codeAction/resolve", code_action)
+                return self.send_request_task(request)
         return Promise.resolve(code_action)
 
     def _apply_code_action_async(


Test patch: