Skip to content

Commit

Permalink
[ upstream ] Add WithDefault handling to visibility (#207)
Browse files Browse the repository at this point in the history
  • Loading branch information
Adowrath authored Oct 25, 2023
1 parent 7fa662a commit 526902b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Idris2
Submodule Idris2 updated 3237 files
3 changes: 2 additions & 1 deletion src/Language/LSP/BrowseNamespace.idr
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import Idris.Syntax
import Language.LSP.Definition
import Language.LSP.Message
import Libraries.Data.NameMap
import Libraries.Data.WithDefault
import Parser.Source
import Parser.Rule.Source
import Server.Configuration
Expand All @@ -23,7 +24,7 @@ visible : Defs -> Name -> Core Bool
visible defs n = do
Just def <- lookupCtxtExact n (gamma defs)
| Nothing => pure False
pure $ visibility def /= Private
pure $ collapseDefault (visibility def) /= Private

inNS : Namespace -> Name -> Bool
inNS ns (NS xns (UN _)) = ns `isParentOf` xns
Expand Down
3 changes: 2 additions & 1 deletion src/Language/LSP/Completion/Handler.idr
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import Language.LSP.Utils
import Language.LSP.VirtualDocument
import Libraries.Data.NameMap
import Libraries.Data.UserNameMap
import Libraries.Data.WithDefault
import Server.Configuration
import Server.Log
import Server.Utils
Expand Down Expand Up @@ -110,7 +111,7 @@ completionNames = do
case mdef of
Nothing => pure Nothing
Just def =>
let visible = (ns == currentNS defs) || (visibility def /= Private) in
let visible = (ns == currentNS defs) || (collapseDefault (visibility def) /= Private) in
if visible
then do
ty <- prettyType (const ()) def.type
Expand Down

0 comments on commit 526902b

Please sign in to comment.