From cb3915c5e12be588d3f94e43d3db2eefd35a88dd Mon Sep 17 00:00:00 2001 From: Thomas Kinnen Date: Mon, 1 Jul 2013 20:24:05 +0200 Subject: [PATCH] Order suggestion output by scope and then by item name. --- compiler/suggest.nim | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/compiler/suggest.nim b/compiler/suggest.nim index b86a2c3658..892afc05ea 100644 --- a/compiler/suggest.nim +++ b/compiler/suggest.nim @@ -11,7 +11,7 @@ # included from sigmatch.nim -import algorithm +import algorithm, sequtils const sep = '\t' @@ -71,7 +71,10 @@ template wholeSymTab(cond, section: expr) {.immediate.} = var isLocal = true for scope in walkScopes(c.currentScope): if scope == c.topLevelScope: isLocal = false - for item in items(scope.symbols): + var entries = sequtils.toSeq(items(scope.symbols)) + sort(entries) do (a,b: PSym) -> int: + return cmp(a.name.s, b.name.s) + for item in entries: let it {.inject.} = item if cond: SuggestWriteln(SymToStr(it, isLocal = isLocal, section))