wz1000 / HieDb

Generates a references DB from .hie files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

configurable limit in searchDef

goolord opened this issue · comments

currently, searchDef is implemented like

HieDb/src/HieDb/Query.hs

Lines 121 to 126 in bb7367f

searchDef :: HieDb -> String -> IO [Res DefRow]
searchDef conn cs
= query (getConn conn) "SELECT defs.*,mods.mod,mods.unit,mods.is_boot,mods.hs_src,mods.is_real,mods.hash \
\FROM defs JOIN mods USING (hieFile) \
\WHERE occ LIKE ? \
\LIMIT 200" (Only $ '_':cs++"%")

the LIMIT on line 126 is problematic for HLS's workspace symbol handler, since it frequently omits symbols from a workspace_symbols query in a way that's opaque to the user
https://github.com/haskell/haskell-language-server/blob/3be343acf76f05fb9b8adb73625439a5d40b362c/ghcide/src/Development/IDE/Core/Actions.hs#L123-L127

I think it's fine to either

  1. remove the LIMIT line
  2. add a Maybe Int parameter or similar to make this limit configurable

Sounds reasonable. But does this actually manifest in practice? Don't clients make another query when you refine your search by adding more characters?

neovim doesn't, at least. there are UIs that wrap nvim's workspace symbol handler that do/could do that, though.

most UIs I've used that provide functionality like that to nvim just query once and filter the results with some fuzzy filter, but maybe that's not a use case worth supporting 🤔

I think it's worth it, if only because other language servers might not return symbols LIKE the query and it's worth maintaining that that workflow works across any language