From ccedb9302632fcdbc75292b90942a34b98bebcee Mon Sep 17 00:00:00 2001
From: bob <bcz@cs.brown.edu>
Date: Fri, 7 Feb 2020 13:58:24 -0500
Subject: restored things that cause problems.

---
 src/client/views/MetadataEntryMenu.tsx | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

(limited to 'src/client/views/MetadataEntryMenu.tsx')

diff --git a/src/client/views/MetadataEntryMenu.tsx b/src/client/views/MetadataEntryMenu.tsx
index ac152bf67..23b21ae0c 100644
--- a/src/client/views/MetadataEntryMenu.tsx
+++ b/src/client/views/MetadataEntryMenu.tsx
@@ -133,7 +133,23 @@ export class MetadataEntryMenu extends React.Component<MetadataEntryProps>{
     }
 
     getKeySuggestions = async (value: string): Promise<string[]> => {
-        return [];
+        value = value.toLowerCase();
+        let docs = this.props.docs;
+        if (typeof docs === "function") {
+            if (this.props.suggestWithFunction) {
+                docs = docs();
+            } else {
+                return [];
+            }
+        }
+        docs = await docs;
+        if (docs instanceof Doc) {
+            return Object.keys(docs).filter(key => key.toLowerCase().startsWith(value));
+        } else {
+            const keys = new Set<string>();
+            docs.forEach(doc => Doc.allKeys(doc).forEach(key => keys.add(key)));
+            return Array.from(keys).filter(key => key.toLowerCase().startsWith(value));
+        }
     }
     getSuggestionValue = (suggestion: string) => suggestion;
 
-- 
cgit v1.2.3-70-g09d2

