Visual Studio 2017 重构不适用于 F#

VisualStudio 2017 refactor doesnt work for F#

我在 F# 有项目,正在 VisualStudio2017。我试图重构代码并使用内联,但是这个菜单项不可用。此外,当我单击 重命名 时,什么也没发生。

let blobToBlobWithInfo (b:IListBlobItem ) = 
    try
        let blobUri = b.Uri.ToString()
        let blobUriParts = blobUri.Split '/'
        let t = Array.length blobUriParts
        let integrationName =  blobUriParts.[t-2]
        if(integrationName <> "LogsToBlobService") then
            let logTime = new System.DateTime( System.Int32.Parse <| blobUriParts.[t-1].Substring(0,4), System.Int32.Parse <|blobUriParts.[t-1].Substring(4,2), System.Int32.Parse <|blobUriParts.[t-1].Substring(6,2))
            Some((b,integrationName,logTime))
        else
            None
    with
        | :? System.ArgumentException -> None
        | _ -> None

这是 Visual Studio 2017 年的一个已知问题。

它将在更新 2 中修复。

在此GitHub issue中得到确认。

是Resharper的重构还是VS2017的重构?如果您只想重命名,您可以将 Visual F# Tools 更新到 myget 的最新版本(这将包含在答案中引用的 VS 更新中):
https://github.com/Microsoft/visualfsharp/wiki/Using-Nightly-Releases-of-the-Visual-F%23-Tools

例如将 csv 重命名为 csv2 inline:

使用最新版本的 VF# 工具更新:

您也可以从这里下载: https://dotnet.myget.org/feed/fsharp/package/vsix/VisualFSharp