Skip to content

Commit af178a5

Browse files
authored
Don't offer to reference the target project when adding a project reference (#1945)
1 parent b312908 commit af178a5

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/Core/FsProjEdit.fs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,21 @@ module FsProjEdit =
6464

6565
let addProjectReferencePath path =
6666
promise {
67-
let projects = Project.getAll () |> ResizeArray
67+
match path with
68+
| Some path ->
69+
let projects = Project.getAll () |> List.filter (fun p -> p <> path) |> ResizeArray
6870

69-
if projects.Count <> 0 then
70-
let opts = createEmpty<QuickPickOptions>
71-
opts.placeHolder <- Some "Reference"
71+
if projects.Count <> 0 then
72+
let opts = createEmpty<QuickPickOptions>
73+
opts.placeHolder <- Some "Reference"
7274

73-
let! n = window.showQuickPick (projects |> U2.Case1, opts)
75+
let! n = window.showQuickPick (projects |> U2.Case1, opts)
7476

75-
return!
76-
match n, path with
77-
| Some n, Some path -> LanguageService.dotnetAddProject path n
78-
| _ -> Promise.empty
77+
return!
78+
match n with
79+
| Some n -> LanguageService.dotnetAddProject path n
80+
| _ -> Promise.empty
81+
| _ -> return! Promise.empty
7982
}
8083

8184
let removeProjectReferencePath ref proj =

0 commit comments

Comments
 (0)