Skip to content

Commit e720d18

Browse files
Remove Project Reference
1 parent e26f666 commit e720d18

File tree

3 files changed

+36
-4
lines changed

3 files changed

+36
-4
lines changed

paket.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ GIT
2424
(90423567453c82104e852a188640cbfad5882aaa)
2525
build: build.cmd LocalRelease
2626
remote: https://github.com/fsprojects/Forge.git
27-
(b2ce55cfb380ef898aae7b46d7e4eda839fb6707)
27+
(19e5ba663e05cdaecb56bff74f169345ff755a1e)
2828
build: build.cmd
2929
remote: [email protected]:ionide/ionide-fsgrammar.git
3030
(77ad35a24efc2d0acc84402250589a7f24b803ea)

release/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@
105105
{
106106
"command": "fsharp.AddProjectReference",
107107
"title": "F#: Add Project Reference"
108+
},
109+
{
110+
"command": "fsharp.RemoveProjectReference",
111+
"title": "F#: Remove Project Reference"
108112
}
109113
],
110114
"outputChannels": [
@@ -143,7 +147,8 @@
143147
"onCommand:webpreview.Show",
144148
"onCommand:fsharp.NewProject",
145149
"onCommand:fsharp.RefreshProjectTemplates",
146-
"onCommand:fsharp.AddProjectReference"
150+
"onCommand:fsharp.AddProjectReference",
151+
"onCommand:fsharp.RemoveProjectReference"
147152
],
148153
"extensionDependencies": [
149154
"vscode.fsharp"

src/Components/Forge.fs

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ namespace Ionide.VSCode.FSharp
22

33
open System
44
open FunScript
5-
open FunScript.TypeScript
5+
open FunScript.TypeScript
66
open FunScript.TypeScript.vscode
77
open FunScript.TypeScript.vscode.languages
88
open FunScript.TypeScript.path
@@ -13,7 +13,7 @@ open Ionide.VSCode.Helpers
1313

1414
[<ReflectedDefinition>]
1515
module Forge =
16-
16+
1717
let (</>) a b =
1818
if Process.isWin ()
1919
then a + @"\" + b
@@ -91,6 +91,32 @@ module Forge =
9191
) )
9292
|> ignore
9393

94+
let removeProjectReference () =
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 projectReferences -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 project -n %s -p %s" ref edit |> spawnForge |> ignore )
116+
|> ignore
117+
))
118+
|> ignore
119+
94120
let newProject () =
95121
"list templates"
96122
|> execForge
@@ -137,4 +163,5 @@ module Forge =
137163
commands.Globals.registerTextEditorCommand("fsharp.AddFileToProject", addCurrentFileToProject |> unbox) |> ignore
138164
commands.Globals.registerTextEditorCommand("fsharp.RemoveFileFromProject", removeCurrentFileFromProject |> unbox) |> ignore
139165
commands.Globals.registerCommand("fsharp.AddProjectReference", addProjectReference |> unbox) |> ignore
166+
commands.Globals.registerCommand("fsharp.RemoveProjectReference", removeProjectReference |> unbox) |> ignore
140167
()

0 commit comments

Comments
 (0)