diff --git a/paket.lock b/paket.lock index db595cc96..c71ddbe3e 100644 --- a/paket.lock +++ b/paket.lock @@ -1,14 +1,14 @@ FRAMEWORK: NET45 NUGET remote: https://www.nuget.org/api/v2 - FAKE (4.43) + FAKE (4.47.2) FParsec (1.0.2) - FSharp.Compiler.Service (8.0) - framework: >= net45 + FSharp.Compiler.Service (8.0) System.Collections.Immutable (>= 1.2) System.Reflection.Metadata (>= 1.4.1-beta-24227-04) FSharp.Compiler.Service.ProjectCracker (8.0) FSharp.Core (4.0.0.1) - redirects: on - FSharpLint.Core (0.4.10) + FSharpLint.Core (0.5.1-beta) FParsec (>= 1.0.2) FSharp.Compiler.Service (>= 8.0) FSharp.Compiler.Service.ProjectCracker (>= 8.0) @@ -32,10 +32,10 @@ NUGET Octokit (0.23) Suave (1.1.3) FSharp.Core (>= 3.1.2.5) - System.Collections.Immutable (1.3.0-preview1-24530-04) - System.Reflection.Metadata (1.4.1-preview1-24530-04) - System.Collections.Immutable (>= 1.3.0-preview1-24530-04) + System.Collections.Immutable (1.3) + System.Reflection.Metadata (1.4.1) + System.Collections.Immutable (>= 1.3) GITHUB remote: fsharp/FAKE - modules/Octokit/Octokit.fsx (da711ab136889bead398d5ac1a10dc53e60a2c87) + modules/Octokit/Octokit.fsx (be6e4b2b513b5f2cd64ec689fe7f1f45c39f4e92) Octokit (>= 0.20) \ No newline at end of file diff --git a/src/FsAutoComplete.Core/CommandResponse.fs b/src/FsAutoComplete.Core/CommandResponse.fs index f5ef8cb88..d831ae496 100644 --- a/src/FsAutoComplete.Core/CommandResponse.fs +++ b/src/FsAutoComplete.Core/CommandResponse.fs @@ -286,6 +286,9 @@ module CommandResponse = IsFromType = su.IsFromType } ] |> Seq.distinct |> Seq.toList } serialize { Kind = "symboluse"; Data = su } + let help (serialize : Serializer) (data : string) = + serialize { Kind = "help"; Data = data } + let methods (serialize : Serializer) (meth: FSharpMethodGroup, commas: int) = serialize { Kind = "method" Data = { Name = meth.MethodName @@ -382,4 +385,4 @@ module CommandResponse = Word = word } - serialize { Kind = "namespaces"; Data = data} + serialize { Kind = "namespaces"; Data = data} diff --git a/src/FsAutoComplete.Core/Commands.fs b/src/FsAutoComplete.Core/Commands.fs index b976b7764..19534f7ca 100644 --- a/src/FsAutoComplete.Core/Commands.fs +++ b/src/FsAutoComplete.Core/Commands.fs @@ -60,9 +60,10 @@ type Commands (serialize : Serializer) = return! parse' file text checkOptions } - member __.ParseAllInBackground () = - do checker.ParseAndCheckAllProjectsInBackground (state.FileCheckOptions.ToSeq() |> Seq.map snd) - [Response.errors serialize ([||], "") ] + member __.ParseAndCheckProjectsInBackgroundForFile file = async { + do checker.CheckProjectsInBackgroundForFile (file, state.FileCheckOptions.ToSeq() ) + return [Response.errors serialize ([||], "") ] + } member __.ParseProjectsForFile file = async { let! res = checker.ParseProjectsForFile(file, state.FileCheckOptions.ToSeq()) @@ -74,19 +75,21 @@ type Commands (serialize : Serializer) = [ Response.errors serialize (errors, file)] } - member __.FileChecked = - checker.FileChecked - |> Event.map (fun fn -> - let file = Path.GetFullPath fn - let res = state.FileCheckOptions |> Seq.tryFind (fun kv -> Path.GetFullPath kv.Key = file) - match res with - | None -> async { return [Response.info serialize ( sprintf "Project for file not found: %s" file) ] } - | Some kv -> - async { - let! (_, checkResults) = checker.GetBackgroundCheckResultsForFileInProject(fn, kv.Value) - return [ Response.errors serialize (checkResults.Errors, file) ] }) - - + // member __.FileChecked = + // checker.FileChecked + // |> Event.map (fun fn -> + // let file = Path.GetFullPath fn + // let res = state.FileCheckOptions |> Seq.tryFind (fun kv -> Path.GetFullPath kv.Key = file) + // match res with + // | None -> async { return [Response.info serialize ( sprintf "Project for file not found: %s" file) ] } + // | Some kv -> + // async { + // let result= checker.TryGetRecentCheckResultsForFile(fn, kv.Value) + // return + // match result with + // | None -> [Response.info serialize "File not parsed"] + // | Some res -> [ Response.errors serialize (res.GetCheckResults.Errors, file) ] + // }) member __.Project projectFileName verbose onChange = async { let projectFileName = Path.GetFullPath projectFileName @@ -200,6 +203,9 @@ type Commands (serialize : Serializer) = member x.SymbolUse (tyRes : ParseAndCheckResults) (pos: Pos) lineStr = tyRes.TryGetSymbolUse pos lineStr |> x.SerializeResult Response.symbolUse + member x.Help (tyRes : ParseAndCheckResults) (pos: Pos) lineStr = + tyRes.TryGetF1Help pos lineStr |> x.SerializeResult Response.help + member x.SymbolUseProject (tyRes : ParseAndCheckResults) (pos: Pos) lineStr = let fn = tyRes.FileName tyRes.TryGetSymbolUse pos lineStr |> x.SerializeResultAsync (fun _ (sym, usages) -> @@ -255,15 +261,6 @@ type Commands (serialize : Serializer) = } member __.GetNamespaceSuggestions (tyRes : ParseAndCheckResults) (pos: Pos) (line: LineStr) = async { - let! entitiesRes = tyRes.GetAllEntities () - let symbol = Lexer.getSymbol pos.Line pos.Col line SymbolLookupKind.Fuzzy [||] - - match symbol with - | None -> return [Response.info serialize "Symbol at position not found"] - | Some sym -> - match entitiesRes with - | None -> return [Response.info serialize "Something went wrong"] - | Some entities -> match tyRes.GetAST with | None -> return [Response.info serialize "Parsed Tree not avaliable"] | Some parsedTree -> @@ -273,6 +270,16 @@ type Commands (serialize : Serializer) = match ParsedInput.getEntityKind parsedTree pos with | None -> return [Response.info serialize "EntityKind not found"] | Some entityKind -> + + let symbol = Lexer.getSymbol pos.Line pos.Col line SymbolLookupKind.Fuzzy [||] + match symbol with + | None -> return [Response.info serialize "Symbol at position not found"] + | Some sym -> + + let! entitiesRes = tyRes.GetAllEntities () + match entitiesRes with + | None -> return [Response.info serialize "Something went wrong"] + | Some entities -> let isAttribute = entityKind = EntityKind.Attribute let entities = entities |> List.filter (fun e -> diff --git a/src/FsAutoComplete.Core/CompilerServiceInterface.fs b/src/FsAutoComplete.Core/CompilerServiceInterface.fs index 2fa75f5e7..5eb059573 100644 --- a/src/FsAutoComplete.Core/CompilerServiceInterface.fs +++ b/src/FsAutoComplete.Core/CompilerServiceInterface.fs @@ -94,6 +94,17 @@ type ParseAndCheckResults let! symboluses = checkResults.GetUsesOfSymbolInFile symboluse.Symbol return Success (symboluse, symboluses) } + member __.TryGetF1Help (pos: Pos) (lineStr: LineStr) = + async { + match Parsing.findLongIdents(pos.Col - 1, lineStr) with + | None -> return (Failure "No ident at this location") + | Some(colu, identIsland) -> + + let! help = checkResults.GetF1KeywordAlternate(pos.Line, colu, lineStr, identIsland) + match help with + | None -> return (Failure "No symbol information found") + | Some hlp -> return Success hlp} + member __.TryGetCompletions (pos: Pos) (lineStr: LineStr) filter = async { let longName, residue = Parsing.findLongIdentsAndResidue(pos.Col - 1, lineStr) try @@ -150,7 +161,7 @@ type FSharpCompilerServiceChecker() = let checker = FSharpChecker.Create( projectCacheSize = 200, - keepAllBackgroundResolutions = true, + keepAllBackgroundResolutions = false, keepAssemblyContents = true) let files = ConcurrentDictionary() @@ -234,10 +245,9 @@ type FSharpCompilerServiceChecker() = return { rawOptions with OtherOptions = opts } } - member __.ParseAndCheckAllProjectsInBackground (options : FSharpProjectOptions seq) = - options - |> Seq.distinctBy(fun v -> v.ProjectFileName) - |> Seq.iter (checker.CheckProjectInBackground) + member __.CheckProjectsInBackgroundForFile (file,options : seq) = + defaultArg (getDependingProjects file options) [] + |> List.iter (checker.CheckProjectInBackground) member __.ParseProjectsForFile(file, options : seq ) = let project = options |> Seq.tryFind (fun (k,_) -> k = file) diff --git a/src/FsAutoComplete.Core/FsAutoComplete.Core.fsproj b/src/FsAutoComplete.Core/FsAutoComplete.Core.fsproj index 786935084..9511ad0a3 100644 --- a/src/FsAutoComplete.Core/FsAutoComplete.Core.fsproj +++ b/src/FsAutoComplete.Core/FsAutoComplete.Core.fsproj @@ -1,4 +1,4 @@ - + FsAutoComplete.Core @@ -112,16 +112,6 @@ True True - - ..\..\packages\FSharp.Compiler.Service\lib\net45\stock\FSharp.Compiler.Service.MSBuild.v12.dll - True - True - - - ..\..\packages\FSharp.Compiler.Service\lib\net45\stock\FSharp.Compiler.Service.dll - True - True - diff --git a/src/FsAutoComplete.Core/paket.references b/src/FsAutoComplete.Core/paket.references index ecb5a0fd8..0453cfb64 100644 --- a/src/FsAutoComplete.Core/paket.references +++ b/src/FsAutoComplete.Core/paket.references @@ -1,2 +1,3 @@ -FSharpLint.Core -FSharp.Compiler.Service.ProjectCracker \ No newline at end of file +FSharp.Compiler.Service.ProjectCracker +FSharp.Compiler.Service +FSharpLint.Core \ No newline at end of file diff --git a/src/FsAutoComplete.Suave/AssemblyInfo.fs b/src/FsAutoComplete.Suave/AssemblyInfo.fs index 8aed02bdf..46e6a039e 100644 --- a/src/FsAutoComplete.Suave/AssemblyInfo.fs +++ b/src/FsAutoComplete.Suave/AssemblyInfo.fs @@ -13,6 +13,5 @@ module internal AssemblyVersionInformation = let [] AssemblyTitle = "FsAutoComplete.Suave" let [] AssemblyProduct = "FsAutoComplete.Suave" let [] AssemblyDescription = "A Suave web server for interfacing with FSharp.Compiler.Service over a HTTP." - let [] AssemblyVersion = "0.30.2" let [] AssemblyFileVersion = "0.30.2" diff --git a/src/FsAutoComplete.Suave/FsAutoComplete.Suave.fs b/src/FsAutoComplete.Suave/FsAutoComplete.Suave.fs index 04dfa6a5c..946f28e6b 100644 --- a/src/FsAutoComplete.Suave/FsAutoComplete.Suave.fs +++ b/src/FsAutoComplete.Suave/FsAutoComplete.Suave.fs @@ -45,14 +45,15 @@ let main argv = let fs = new FileSystem(originalFs, commands.Files.TryFind) AbstractIL.Internal.Library.Shim.FileSystem <- fs - commands.FileChecked - |> Event.add (fun response -> - client |> Option.iter (fun socket -> - async { - let! res = response - let cnt = res |> List.toArray |> Json.toJson - return! socket.send Text cnt true - } |> Async.Ignore |> Async.Start )) + // commands.FileChecked + // |> Event.add (fun response -> + // client |> Option.iter (fun socket -> + // async { + // let! res = response + + // let cnt = res |> List.toArray |> Json.toJson + // return! socket.send Text cnt true + // } |> Async.Ignore |> Async.Start )) let handler f : WebPart = fun (r : HttpContext) -> async { let data = r.request |> getResourceFromReq @@ -109,16 +110,11 @@ let main argv = let app = choose [ - path "/notify" >=> handShake echo + // path "/notify" >=> handShake echo path "/parse" >=> handler (fun (data : ParseRequest) -> commands.Parse data.FileName data.Lines data.Version) path "/parseProjects" >=> handler (fun (data : ProjectRequest) -> commands.ParseProjectsForFile data.FileName) //TODO: Add filewatcher - path "/parseProjectsInBackground" >=> fun httpCtx -> - async { - let errors = commands.ParseAllInBackground() - let res = errors |> List.toArray |> Json.toJson - return! Response.response HttpCode.HTTP_200 res httpCtx - } + path "/parseProjectsInBackground" >=> handler (fun (data : ProjectRequest) -> commands.ParseAndCheckProjectsInBackgroundForFile data.FileName) path "/project" >=> handler (fun (data : ProjectRequest) -> commands.Project data.FileName false ignore) path "/declarations" >=> handler (fun (data : DeclarationsRequest) -> commands.Declarations data.FileName) path "/declarationsProjects" >=> fun httpCtx -> @@ -151,6 +147,8 @@ let main argv = path "/symboluse" >=> positionHandler (fun data tyRes lineStr _ -> commands.SymbolUse tyRes { Line = data.Line; Col = data.Column } lineStr) path "/finddeclaration" >=> positionHandler (fun data tyRes lineStr _ -> commands.FindDeclarations tyRes { Line = data.Line; Col = data.Column } lineStr) path "/methods" >=> positionHandler (fun data tyRes _ lines -> commands.Methods tyRes { Line = data.Line; Col = data.Column } lines) + path "/help" >=> positionHandler (fun data tyRes line _ -> commands.Help tyRes { Line = data.Line; Col = data.Column } line) + path "/compilerlocation" >=> fun httpCtx -> async { let res = commands.CompilerLocation() |> List.toArray |> Json.toJson diff --git a/src/FsAutoComplete.Suave/FsAutoComplete.Suave.fsproj b/src/FsAutoComplete.Suave/FsAutoComplete.Suave.fsproj index 20bcfa916..7fd911bc8 100644 --- a/src/FsAutoComplete.Suave/FsAutoComplete.Suave.fsproj +++ b/src/FsAutoComplete.Suave/FsAutoComplete.Suave.fsproj @@ -98,16 +98,6 @@ True True - - ..\..\packages\FSharp.Compiler.Service\lib\net45\stock\FSharp.Compiler.Service.MSBuild.v12.dll - True - True - - - ..\..\packages\FSharp.Compiler.Service\lib\net45\stock\FSharp.Compiler.Service.dll - True - True - diff --git a/src/FsAutoComplete.Suave/JsonSerializer.fs b/src/FsAutoComplete.Suave/JsonSerializer.fs index 5aed84da9..fb24cd8da 100644 --- a/src/FsAutoComplete.Suave/JsonSerializer.fs +++ b/src/FsAutoComplete.Suave/JsonSerializer.fs @@ -2,6 +2,8 @@ namespace FsAutoComplete module JsonSerializer = + open System + open Microsoft.FSharp.Reflection open Newtonsoft.Json open Newtonsoft.Json.Converters open Microsoft.FSharp.Compiler @@ -48,10 +50,35 @@ module JsonSerializer = override x.CanRead = false override x.CanWrite = true + type OptionConverter() = + inherit JsonConverter() + + override x.CanConvert(t) = + t.IsGenericType && t.GetGenericTypeDefinition() = typedefof> + + override x.WriteJson(writer, value, serializer) = + let value = + if isNull value then null + else + let _,fields = FSharpValue.GetUnionFields(value, value.GetType()) + fields.[0] + serializer.Serialize(writer, value) + + override x.ReadJson(reader, t, existingValue, serializer) = + let innerType = t.GetGenericArguments().[0] + let innerType = + if innerType.IsValueType then (typedefof>).MakeGenericType([|innerType|]) + else innerType + let value = serializer.Deserialize(reader, innerType) + let cases = FSharpType.GetUnionCases(t) + if isNull value then FSharpValue.MakeUnion(cases.[0], [||]) + else FSharpValue.MakeUnion(cases.[1], [|value|]) + let private jsonConverters = [| - new FSharpErrorSeverityConverter() :> JsonConverter; + new FSharpErrorSeverityConverter() :> JsonConverter new RangeConverter() :> JsonConverter + new OptionConverter() :> JsonConverter |] let internal writeJson(o: obj) = JsonConvert.SerializeObject(o, jsonConverters) diff --git a/src/FsAutoComplete/FsAutoComplete.fsproj b/src/FsAutoComplete/FsAutoComplete.fsproj index 58690545c..97f32c70b 100644 --- a/src/FsAutoComplete/FsAutoComplete.fsproj +++ b/src/FsAutoComplete/FsAutoComplete.fsproj @@ -101,16 +101,6 @@ True True - - ..\..\packages\FSharp.Compiler.Service\lib\net45\stock\FSharp.Compiler.Service.MSBuild.v12.dll - True - True - - - ..\..\packages\FSharp.Compiler.Service\lib\net45\stock\FSharp.Compiler.Service.dll - True - True - diff --git a/test/FsAutoComplete.IntegrationTests/Linter/output.json b/test/FsAutoComplete.IntegrationTests/Linter/output.json index b7a01c436..38de22b90 100644 --- a/test/FsAutoComplete.IntegrationTests/Linter/output.json +++ b/test/FsAutoComplete.IntegrationTests/Linter/output.json @@ -13,24 +13,54 @@ "Kind": "lint", "Data": [ { - "Info": "`not (a=b)` might be able to be refactored into `a<>b`.", + "Info": "`not (a = b)` might be able to be refactored into `a <> b`.", "Range": { "StartColumn": 17, "StartLine": 1, "EndColumn": 26, "EndLine": 1 }, - "Input": "let test1 a b = not (a=b)\nlet test2 a b = not (a<>b)\nlet test3 = fun a -> a\nlet test4 = not true\nlet test5 = not false\nlet test6 = List.fold ( + ) 0\nlet test7 a = a<>true\nlet test8 a = a=null\nlet test9 a = List.head (List.sort a) \n" + "Input": "let test1 a b = not (a=b)\nlet test2 a b = not (a<>b)\nlet test3 = fun a -> a\nlet test4 = not true\nlet test5 = not false\nlet test6 = List.fold ( + ) 0\nlet test7 a = a<>true\nlet test8 a = a=null\nlet test9 a = List.head (List.sort a) \n", + "Fix": { + "Case": "Some", + "Fields": [ + { + "FromText": "not (a=b)", + "FromRange": { + "StartColumn": 17, + "StartLine": 1, + "EndColumn": 26, + "EndLine": 1 + }, + "ToText": "a <> b" + } + ] + } }, { - "Info": "`not (a<>b)` might be able to be refactored into `a=b`.", + "Info": "`not (a <> b)` might be able to be refactored into `a = b`.", "Range": { "StartColumn": 17, "StartLine": 2, "EndColumn": 27, "EndLine": 2 }, - "Input": "let test1 a b = not (a=b)\nlet test2 a b = not (a<>b)\nlet test3 = fun a -> a\nlet test4 = not true\nlet test5 = not false\nlet test6 = List.fold ( + ) 0\nlet test7 a = a<>true\nlet test8 a = a=null\nlet test9 a = List.head (List.sort a) \n" + "Input": "let test1 a b = not (a=b)\nlet test2 a b = not (a<>b)\nlet test3 = fun a -> a\nlet test4 = not true\nlet test5 = not false\nlet test6 = List.fold ( + ) 0\nlet test7 a = a<>true\nlet test8 a = a=null\nlet test9 a = List.head (List.sort a) \n", + "Fix": { + "Case": "Some", + "Fields": [ + { + "FromText": "not (a<>b)", + "FromRange": { + "StartColumn": 17, + "StartLine": 2, + "EndColumn": 27, + "EndLine": 2 + }, + "ToText": "a = b" + } + ] + } }, { "Info": "`fun x -> x` might be able to be refactored into `id`.", @@ -40,7 +70,22 @@ "EndColumn": 23, "EndLine": 3 }, - "Input": "let test1 a b = not (a=b)\nlet test2 a b = not (a<>b)\nlet test3 = fun a -> a\nlet test4 = not true\nlet test5 = not false\nlet test6 = List.fold ( + ) 0\nlet test7 a = a<>true\nlet test8 a = a=null\nlet test9 a = List.head (List.sort a) \n" + "Input": "let test1 a b = not (a=b)\nlet test2 a b = not (a<>b)\nlet test3 = fun a -> a\nlet test4 = not true\nlet test5 = not false\nlet test6 = List.fold ( + ) 0\nlet test7 a = a<>true\nlet test8 a = a=null\nlet test9 a = List.head (List.sort a) \n", + "Fix": { + "Case": "Some", + "Fields": [ + { + "FromText": "fun a -> a", + "FromRange": { + "StartColumn": 13, + "StartLine": 3, + "EndColumn": 23, + "EndLine": 3 + }, + "ToText": "id" + } + ] + } }, { "Info": "`not true` might be able to be refactored into `false`.", @@ -50,7 +95,22 @@ "EndColumn": 21, "EndLine": 4 }, - "Input": "let test1 a b = not (a=b)\nlet test2 a b = not (a<>b)\nlet test3 = fun a -> a\nlet test4 = not true\nlet test5 = not false\nlet test6 = List.fold ( + ) 0\nlet test7 a = a<>true\nlet test8 a = a=null\nlet test9 a = List.head (List.sort a) \n" + "Input": "let test1 a b = not (a=b)\nlet test2 a b = not (a<>b)\nlet test3 = fun a -> a\nlet test4 = not true\nlet test5 = not false\nlet test6 = List.fold ( + ) 0\nlet test7 a = a<>true\nlet test8 a = a=null\nlet test9 a = List.head (List.sort a) \n", + "Fix": { + "Case": "Some", + "Fields": [ + { + "FromText": "not true", + "FromRange": { + "StartColumn": 13, + "StartLine": 4, + "EndColumn": 21, + "EndLine": 4 + }, + "ToText": "false" + } + ] + } }, { "Info": "`not false` might be able to be refactored into `true`.", @@ -60,27 +120,58 @@ "EndColumn": 22, "EndLine": 5 }, - "Input": "let test1 a b = not (a=b)\nlet test2 a b = not (a<>b)\nlet test3 = fun a -> a\nlet test4 = not true\nlet test5 = not false\nlet test6 = List.fold ( + ) 0\nlet test7 a = a<>true\nlet test8 a = a=null\nlet test9 a = List.head (List.sort a) \n" + "Input": "let test1 a b = not (a=b)\nlet test2 a b = not (a<>b)\nlet test3 = fun a -> a\nlet test4 = not true\nlet test5 = not false\nlet test6 = List.fold ( + ) 0\nlet test7 a = a<>true\nlet test8 a = a=null\nlet test9 a = List.head (List.sort a) \n", + "Fix": { + "Case": "Some", + "Fields": [ + { + "FromText": "not false", + "FromRange": { + "StartColumn": 13, + "StartLine": 5, + "EndColumn": 22, + "EndLine": 5 + }, + "ToText": "true" + } + ] + } }, { - "Info": "`a<>true` might be able to be refactored into `not a`.", + "Info": "`a <> true` might be able to be refactored into `not a`.", "Range": { "StartColumn": 15, "StartLine": 7, "EndColumn": 22, "EndLine": 7 }, - "Input": "let test1 a b = not (a=b)\nlet test2 a b = not (a<>b)\nlet test3 = fun a -> a\nlet test4 = not true\nlet test5 = not false\nlet test6 = List.fold ( + ) 0\nlet test7 a = a<>true\nlet test8 a = a=null\nlet test9 a = List.head (List.sort a) \n" + "Input": "let test1 a b = not (a=b)\nlet test2 a b = not (a<>b)\nlet test3 = fun a -> a\nlet test4 = not true\nlet test5 = not false\nlet test6 = List.fold ( + ) 0\nlet test7 a = a<>true\nlet test8 a = a=null\nlet test9 a = List.head (List.sort a) \n", + "Fix": { + "Case": "Some", + "Fields": [ + { + "FromText": "a<>true", + "FromRange": { + "StartColumn": 15, + "StartLine": 7, + "EndColumn": 22, + "EndLine": 7 + }, + "ToText": "not a" + } + ] + } }, { - "Info": "`x=null`; suggestion: Consider using pattern matching, or if you're using F# 4 then `isNull`.", + "Info": "`x = null`; suggestion: Consider using pattern matching, or if you're using F# 4 then `isNull`.", "Range": { "StartColumn": 15, "StartLine": 8, "EndColumn": 21, "EndLine": 8 }, - "Input": "let test1 a b = not (a=b)\nlet test2 a b = not (a<>b)\nlet test3 = fun a -> a\nlet test4 = not true\nlet test5 = not false\nlet test6 = List.fold ( + ) 0\nlet test7 a = a<>true\nlet test8 a = a=null\nlet test9 a = List.head (List.sort a) \n" + "Input": "let test1 a b = not (a=b)\nlet test2 a b = not (a<>b)\nlet test3 = fun a -> a\nlet test4 = not true\nlet test5 = not false\nlet test6 = List.fold ( + ) 0\nlet test7 a = a<>true\nlet test8 a = a=null\nlet test9 a = List.head (List.sort a) \n", + "Fix": null }, { "Info": "`List.head (List.sort x)` might be able to be refactored into `List.min x`.", @@ -90,7 +181,22 @@ "EndColumn": 38, "EndLine": 9 }, - "Input": "let test1 a b = not (a=b)\nlet test2 a b = not (a<>b)\nlet test3 = fun a -> a\nlet test4 = not true\nlet test5 = not false\nlet test6 = List.fold ( + ) 0\nlet test7 a = a<>true\nlet test8 a = a=null\nlet test9 a = List.head (List.sort a) \n" + "Input": "let test1 a b = not (a=b)\nlet test2 a b = not (a<>b)\nlet test3 = fun a -> a\nlet test4 = not true\nlet test5 = not false\nlet test6 = List.fold ( + ) 0\nlet test7 a = a<>true\nlet test8 a = a=null\nlet test9 a = List.head (List.sort a) \n", + "Fix": { + "Case": "Some", + "Fields": [ + { + "FromText": "List.head (List.sort a)", + "FromRange": { + "StartColumn": 15, + "StartLine": 9, + "EndColumn": 38, + "EndLine": 9 + }, + "ToText": "List.min a" + } + ] + } } ] } diff --git a/test/FsAutoComplete.Tests/FsAutoComplete.Tests.fsproj b/test/FsAutoComplete.Tests/FsAutoComplete.Tests.fsproj index abf69fadb..9f4f8dda7 100644 --- a/test/FsAutoComplete.Tests/FsAutoComplete.Tests.fsproj +++ b/test/FsAutoComplete.Tests/FsAutoComplete.Tests.fsproj @@ -92,16 +92,6 @@ True True - - ..\..\packages\FSharp.Compiler.Service\lib\net45\stock\FSharp.Compiler.Service.MSBuild.v12.dll - True - True - - - ..\..\packages\FSharp.Compiler.Service\lib\net45\stock\FSharp.Compiler.Service.dll - True - True -