@@ -71,6 +71,52 @@ module Forge =
7171 if editor.document.languageId = " fsharp" then
7272 sprintf " remove file -n %s " editor.document.fileName |> spawnForge |> ignore
7373
74+ let addReference () =
75+ let projects = Project.getAll () |> List.toArray
76+ if projects.Length <> 0 then
77+ projects
78+ |> Promise.lift
79+ |> fun n ->
80+ let opts = createEmpty< QuickPickOptions>()
81+ opts.placeHolder <- " Project to edit"
82+ window.Globals.showQuickPick( n, opts)
83+ |> Promise.toPromise
84+ |> Promise.success ( fun edit ->
85+ let opts = createEmpty< InputBoxOptions>()
86+ opts.placeHolder <- " Reference"
87+ window.Globals.showInputBox( opts)
88+ |> Promise.toPromise
89+ |> Promise.success ( fun n ->
90+ sprintf " add reference -n %s -p %s " n edit |> spawnForge |> ignore
91+ ) )
92+ |> ignore
93+
94+ let removeReference () =
95+ let projects = Project.getAll () |> List.toArray
96+ if projects.Length <> 0 then
97+ projects
98+ |> Promise.lift
99+ |> fun n ->
100+ let opts = createEmpty< QuickPickOptions>()
101+ opts.placeHolder <- " Project to edit"
102+ window.Globals.showQuickPick( n, opts)
103+ |> Promise.toPromise
104+ |> Promise.bind ( fun edit ->
105+ sprintf " list references -p %s " edit
106+ |> execForge
107+ |> Promise.success handleForgeList
108+ |> Promise.success ( fun n ->
109+ if n.length <> 0. then
110+ let opts = createEmpty< QuickPickOptions>()
111+ opts.placeHolder <- " Reference"
112+ window.Globals.showQuickPick( n |> Promise.lift, opts)
113+ |> Promise.toPromise
114+ |> Promise.success ( fun ref ->
115+ sprintf " remove reference -n %s -p %s " ref edit |> spawnForge |> ignore )
116+ |> ignore
117+ ))
118+ |> ignore
119+
74120 let addProjectReference () =
75121 let projects = Project.getAll () |> List.toArray
76122 if projects.Length <> 0 then
@@ -164,4 +210,6 @@ module Forge =
164210 commands.Globals.registerTextEditorCommand( " fsharp.RemoveFileFromProject" , removeCurrentFileFromProject |> unbox) |> ignore
165211 commands.Globals.registerCommand( " fsharp.AddProjectReference" , addProjectReference |> unbox) |> ignore
166212 commands.Globals.registerCommand( " fsharp.RemoveProjectReference" , removeProjectReference |> unbox) |> ignore
213+ commands.Globals.registerCommand( " fsharp.AddReference" , addReference |> unbox) |> ignore
214+ commands.Globals.registerCommand( " fsharp.RemoveReference" , removeReference |> unbox) |> ignore
167215 ()
0 commit comments