Skip to content

Commit 555bd9f

Browse files
authored
clients/lsp-csharp.el: add lsp-csharp-open-project-file (#2572)
1 parent 5a0034c commit 555bd9f

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

clients/lsp-csharp.el

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,15 @@ tarball or a zip file (based on a current platform) to TARGET-DIR."
235235
"Resolves path and arguments to use to start the server."
236236
(list (lsp-csharp--language-server-path) "-lsp"))
237237

238+
(lsp-defun lsp-csharp-open-project-file ()
239+
"Open corresponding project file (.csproj) for the current file."
240+
(interactive)
241+
(-let* ((project-info-req (lsp-make-omnisharp-project-information-request :file-name (buffer-file-name)))
242+
(project-info (lsp-request "o#/project" project-info-req))
243+
((&omnisharp:ProjectInformation :ms-build-project) project-info)
244+
((&omnisharp:MsBuildProject :path) ms-build-project))
245+
(find-file path)))
246+
238247
(lsp-defun lsp-csharp--action-client-find-references ((&Command :arguments?))
239248
"Read first argument from ACTION as Location and display xrefs for that location
240249
using the `textDocument/references' request."

lsp-protocol.el

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,10 @@ See `-let' for a description of the destructuring mechanism."
364364

365365
(lsp-interface (pwsh:ScriptRegion (:StartLineNumber :EndLineNumber :StartColumnNumber :EndColumnNumber :Text) nil))
366366

367-
(lsp-interface (omnisharp:ErrorMessage (:Text :FileName :Line :Column)))
367+
(lsp-interface (omnisharp:ErrorMessage (:Text :FileName :Line :Column))
368+
(omnisharp:ProjectInformationRequest (:FileName))
369+
(omnisharp:MsBuildProject (:IsUnitProject :IsExe :Platform :Configuration :IntermediateOutputPath :OutputPath :TargetFrameworks :SourceFiles :TargetFramework :TargetPath :AssemblyName :Path :ProjectGuid))
370+
(omnisharp:ProjectInformation (:ScriptProject :MsBuildProject)))
368371

369372
(lsp-interface (rls:Cmd (:args :binary :env :cwd) nil))
370373

0 commit comments

Comments
 (0)