Skip to content

Commit 630195e

Browse files
committed
Magic constant explained and increased to 40
1 parent e9c2284 commit 630195e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ghcide/src/Development/IDE/Plugin/Completions.hs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ module Development.IDE.Plugin.Completions
66
(
77
plugin
88
, getCompletionsLSP
9+
, maxCompletions
910
) where
1011

1112
import Language.Haskell.LSP.Messages
@@ -116,6 +117,12 @@ instance Hashable NonLocalCompletions
116117
instance NFData NonLocalCompletions
117118
instance Binary NonLocalCompletions
118119

120+
-- | 40 may seem conservative but note that most editors limit how many completions
121+
-- are displayed in the screen, and most users rarely scroll.
122+
-- For instance, VSCode only shows 12 completions in its popup, and Emacs has a similar limit.
123+
maxCompletions :: Int
124+
maxCompletions = 40
125+
119126
-- | Generate code actions.
120127
getCompletionsLSP
121128
:: LSP.LspFuncs Config

0 commit comments

Comments
 (0)