VisualStudio 2017 refactor doesnt work for F#

空扰寡人 提交于 2019-12-12 19:05:35

问题


I have project in F#, i'm working on VisualStudio2017. I tried to refactor the code and use inline, but this menu item is unavailable. Also when i click Rename nothing happened.

  • Why it is unavailable?
  • How to force refactor operation to work?

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

回答1:


This is a known issue in Visual Studio 2017.

It will be fixed in Update 2.

It's confirmed in this GitHub issue.




回答2:


Is that Resharper's refactoring or VS2017's proper? If you just want to rename you can update the Visual F# Tools to the latest version from myget (which will be included in the VS update referenced in the answer):
https://github.com/Microsoft/visualfsharp/wiki/Using-Nightly-Releases-of-the-Visual-F%23-Tools.

For example renaming csv to csv2 inline:

Update with latest version of VF# Tools:

You can also download it from here: https://dotnet.myget.org/feed/fsharp/package/vsix/VisualFSharp



来源:https://stackoverflow.com/questions/43402467/visualstudio-2017-refactor-doesnt-work-for-f

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!