Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornosami <jasonimison@gmail.com>2018-10-02 18:13:56 +0300
committernosami <jasonimison@gmail.com>2018-10-02 18:13:56 +0300
commit14b6cfb5f7ea4f2607799e6c6c5845ea0cec5a22 (patch)
treec8b5d2196ad7d078f7994fd1526219e4d5956098 /main/external/fsharpbinding
parentb55c23dbf1ff1ef1bff46f63f5e55d793ae10c2e (diff)
[F#] Fix CanDropNode so that it only works within F# projects
Also check that drag node is not the same as drop node. Fixes VSTS #694596
Diffstat (limited to 'main/external/fsharpbinding')
-rw-r--r--main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpProjectFileNodeExtension.fs15
1 files changed, 10 insertions, 5 deletions
diff --git a/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpProjectFileNodeExtension.fs b/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpProjectFileNodeExtension.fs
index 2c6b7263b9..a2f63b80ec 100644
--- a/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpProjectFileNodeExtension.fs
+++ b/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpProjectFileNodeExtension.fs
@@ -24,6 +24,9 @@ type FSharpProjectNodeCommandHandler() =
monitor.Step (1)
monitor.EndTask()
+ let fileIsInFSharpProject (file: ProjectFile) =
+ file.Project.SupportedLanguages |> Array.contains "F#"
+
let rec moveNodeInXDoc (xdoc:XElement) (moveToNode: ProjectFile) (movingNode:ProjectFile) position isNested =
let descendantsNamed ns name ancestor =
///partially apply the default namespace of msbuild to xs
@@ -109,15 +112,17 @@ type FSharpProjectNodeCommandHandler() =
override x.CanDragNode() = DragOperation.Move
/// Implement drag and drop of nodes in F# projects in the solution explorer.
- override x.CanDropNode(_dataObject, _dragOperation) = true
-
- /// Implement drag and drop of nodes in F# projects in the solution explorer.
- override x.CanDropNode(dataObject, _dragOperation, _position) =
+ override x.CanDropNode(dataObject, _dragOperation) =
//currently we are going to only support dropping project files from the same parent project
match (dataObject, x.CurrentNode.DataItem) with
- | (:? ProjectFile as drag), (:? ProjectFile as drop) ->
+ | (:? ProjectFile as drag), (:? ProjectFile as drop) when fileIsInFSharpProject drag && fileIsInFSharpProject drop ->
+ drag <> drop &&
drag.Project = drop.Project && drop.ProjectVirtualPath.ParentDirectory = drag.ProjectVirtualPath.ParentDirectory
| _ -> false
+
+ /// Implement drag and drop of nodes in F# projects in the solution explorer.
+ override x.CanDropNode(dataObject, dragOperation, _position) =
+ x.CanDropNode(dataObject, dragOperation)
//This would allow anything to be droppped as long as it was in the same project and path level
//We would need to add to moveNodes so it knows how to find ProvectFolders and other items that mught be present
// | drag, drop ->