@@ -625,9 +625,15 @@ module SolutionExplorer =
625625 else
626626 ( fn + " .fs" )
627627
628- let private createNewFileDialg ( proj : string ) ( existingFiles : list < Model >) ( prompt : string ) =
628+ let private createNewFileDialg
629+ ( proj : string )
630+ ( existingFiles : list < Model >)
631+ ( prompt : string )
632+ ( prefilled : string Option )
633+ =
629634 let opts = createEmpty< InputBoxOptions>
630635 opts.placeHolder <- Some " new.fs"
636+ opts.value <- prefilled
631637 opts.prompt <- Some prompt
632638
633639 opts.validateInput <-
@@ -875,7 +881,11 @@ module SolutionExplorer =
875881 | Some model ->
876882 match tryFindParentProject model with
877883 | Some( Project(_, proj, _, files, _, _, _, _)) ->
878- createNewFileDialg proj files " Enter a new name"
884+ createNewFileDialg
885+ proj
886+ files
887+ " Enter a new name"
888+ ( Some( virtualPath.Split([| '/' |]) |> Array.last))
879889 |> Promise.ofThenable
880890 |> Promise.bind ( fun newFileNameOpt ->
881891 promise {
@@ -909,7 +919,7 @@ module SolutionExplorer =
909919 | Some model ->
910920 match tryFindParentProject model with
911921 | Some( Project(_, proj, _, files, _, _, _, _)) ->
912- createNewFileDialg proj files " New file name, relative to selected file"
922+ createNewFileDialg proj files " New file name, relative to selected file" None
913923 |> Promise.ofThenable
914924 |> Promise.bind ( fun file ->
915925 match file with
@@ -933,7 +943,7 @@ module SolutionExplorer =
933943 | Some model ->
934944 match tryFindParentProject model with
935945 | Some( Project(_, proj, _, files, _, _, _, _)) ->
936- createNewFileDialg proj files " New file name, relative to selected file"
946+ createNewFileDialg proj files " New file name, relative to selected file" None
937947 |> Promise.ofThenable
938948 |> Promise.map ( fun file ->
939949 match file with
@@ -954,7 +964,7 @@ module SolutionExplorer =
954964 objfy2 ( fun m ->
955965 match unbox m with
956966 | Project(_, proj, _, files, _, _, _, _) ->
957- createNewFileDialg proj files " New file name, relative to project file"
967+ createNewFileDialg proj files " New file name, relative to project file" None
958968 |> Promise.ofThenable
959969 |> Promise.map ( fun file ->
960970 match file with
0 commit comments