From 90287d82136034339959a3f0ea7050aab7ded2f8 Mon Sep 17 00:00:00 2001 From: Omar Tawfik Date: Fri, 4 Mar 2016 16:35:51 -0800 Subject: [PATCH 1/2] Fix Out/Error streams chunking in Fsi tool window --- .../src/FSharp.VS.FSI/fsiSessionToolWindow.fs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/vsintegration/src/FSharp.VS.FSI/fsiSessionToolWindow.fs b/vsintegration/src/FSharp.VS.FSI/fsiSessionToolWindow.fs index d69c2439949..96969df6895 100644 --- a/vsintegration/src/FSharp.VS.FSI/fsiSessionToolWindow.fs +++ b/vsintegration/src/FSharp.VS.FSI/fsiSessionToolWindow.fs @@ -59,16 +59,10 @@ module internal Locals = /// Given a list of (key,value) /// Chunk into (key,values) where the values are keys of (key,value) with the same key. /// Complexity: this code is linear in (length kxs). - let rec chunkKeyValues kxs = - let rec loop kxs acc = - match kxs with - | [] -> List.rev acc - | (key, v)::rest -> accumulate key [v] rest acc - and accumulate k chunk rest acc = - match rest with - | (key, v)::rest when equal key k -> accumulate k (v::chunk) rest acc - | rest -> loop rest ((k, (List.rev chunk))::acc) - loop kxs [] + let rec chunkKeyValues allEntries = + allEntries + |> List.groupBy(fun (responseType, line) -> responseType) + |> List.map(fun (responseType, entries) -> (responseType, entries |> List.map(fun (_, line) -> line))) open Util From ec6c79cd68b51251e92ebce676a94c04c8f76a3e Mon Sep 17 00:00:00 2001 From: Omar Tawfik Date: Mon, 7 Mar 2016 11:50:23 -0800 Subject: [PATCH 2/2] PR Comments --- vsintegration/src/FSharp.VS.FSI/fsiSessionToolWindow.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vsintegration/src/FSharp.VS.FSI/fsiSessionToolWindow.fs b/vsintegration/src/FSharp.VS.FSI/fsiSessionToolWindow.fs index 96969df6895..ac528ceb929 100644 --- a/vsintegration/src/FSharp.VS.FSI/fsiSessionToolWindow.fs +++ b/vsintegration/src/FSharp.VS.FSI/fsiSessionToolWindow.fs @@ -59,7 +59,7 @@ module internal Locals = /// Given a list of (key,value) /// Chunk into (key,values) where the values are keys of (key,value) with the same key. /// Complexity: this code is linear in (length kxs). - let rec chunkKeyValues allEntries = + let chunkKeyValues allEntries = allEntries |> List.groupBy(fun (responseType, line) -> responseType) |> List.map(fun (responseType, entries) -> (responseType, entries |> List.map(fun (_, line) -> line)))