From becb1652cc5f9c3aa86fe8b51871f34d9afeb17a Mon Sep 17 00:00:00 2001 From: dawe Date: Sat, 7 Oct 2023 11:37:56 +0200 Subject: [PATCH] Don't offer to reference the target project when adding a project reference --- src/Core/FsProjEdit.fs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/Core/FsProjEdit.fs b/src/Core/FsProjEdit.fs index cd8d4a6b..d782ada0 100644 --- a/src/Core/FsProjEdit.fs +++ b/src/Core/FsProjEdit.fs @@ -64,18 +64,21 @@ module FsProjEdit = let addProjectReferencePath path = promise { - let projects = Project.getAll () |> ResizeArray + match path with + | Some path -> + let projects = Project.getAll () |> List.filter (fun p -> p <> path) |> ResizeArray - if projects.Count <> 0 then - let opts = createEmpty - opts.placeHolder <- Some "Reference" + if projects.Count <> 0 then + let opts = createEmpty + opts.placeHolder <- Some "Reference" - let! n = window.showQuickPick (projects |> U2.Case1, opts) + let! n = window.showQuickPick (projects |> U2.Case1, opts) - return! - match n, path with - | Some n, Some path -> LanguageService.dotnetAddProject path n - | _ -> Promise.empty + return! + match n with + | Some n -> LanguageService.dotnetAddProject path n + | _ -> Promise.empty + | _ -> return! Promise.empty } let removeProjectReferencePath ref proj =