This commit is contained in:
Veit Heller 2021-02-01 19:20:44 +01:00 committed by GitHub
parent e42922e96e
commit ce69cec245
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 10 deletions

View File

@ -85,6 +85,16 @@ envBindingNames = concatMap select . envBindings
select (Binder _ (XObj (Mod m) _ _)) = envBindingNames m
select (Binder _ obj) = [getName obj]
envPublicBindingNames :: Env -> [String]
envPublicBindingNames = concatMap select . envBindings
where
select :: Binder -> [String]
select (Binder _ (XObj (Mod m) _ _)) = envPublicBindingNames m
select (Binder meta obj) =
if metaIsTrue meta "private" || metaIsTrue meta "hidden"
then []
else [getName obj]
-- | Recursively look through all environments for (def ...) forms.
findAllGlobalVariables :: Env -> [Binder]
findAllGlobalVariables env =

View File

@ -27,7 +27,7 @@ import System.Exit (exitSuccess)
completeKeywordsAnd :: Context -> String -> [Completion]
completeKeywordsAnd context word =
findKeywords word (envBindingNames (contextGlobalEnv context) ++ keywords) []
findKeywords word (envPublicBindingNames (contextGlobalEnv context) ++ keywords) []
where
findKeywords _ [] res = res
findKeywords match (x : xs) res =
@ -35,15 +35,7 @@ completeKeywordsAnd context word =
then findKeywords match xs (res ++ [simpleCompletion x])
else findKeywords match xs res
keywords =
[ "Int", -- we should probably have a list of those somewhere
"Float",
"Double",
"Bool",
"String",
"Char",
"Array",
"Fn",
"def",
[ "def",
"defn",
"let",
"do",