-
-
Notifications
You must be signed in to change notification settings - Fork 367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include sortText in completions and improve suggestions #2332
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks for improving this
6568b3c
to
d89c97e
Compare
I made some more changes this morning after realising that alphabetical ordering is incompatible with qualified completions, so I have ditched the multi-dimensional sort key and gone back to a flat numbered sequence. |
This fixes the ugly "Imported from 'Just B'" and other inconsistencies
Is it incompatible? It seems to me like this means that there are three lexicographically ordered sorting factors:
We can encode all this into the sort text if we want: an integer for 1, and integer for 2, and then the text for 3. (But I think I must be missing something, since it looks like you tried something like that already?) |
Yes, this is true, we could extend the product with another factor to track qualified suggestions. It just gets a bit tedious to encode the triple in a string for the alphabetical ordering used by the client. Basically, there are two ways that we can go about it: a. Extend our sorting to cover all 3 (currently it's missing the last one, name) and then do a flat sequential ordering. It probably makes more sense to go with a, since we crop the list of suggestions by |
Ooh, this is a great point, worth including in the comment. I think this alone basically means that the client can't realistically sort the results, since it doesn't have access to the full list. So we might as well just force our ordering. |
The client can sort, but if we don't sort then the quality of suggestions will be worse. I have implemented a few more improvements (see PR description) including alphabetical sorting |
For example, don't suggest GHC.Exts.fromList when Data.Map.fromList is in scope alraedy
6037798
to
eb90042
Compare
This is awesome! Thanks for the work!
Is it reasonable to have this be configurable? I'd like to reduce my usage of the shift key, and I was very happy with the past behaviour where the whole match was case insensitive. If you consider this too much of a maintenance burden, that's fine too. :) |
* sort completions * add an example * Include fuzzy scores in completions sort text * hlints * Extend completion documentation to inform whether an identifier is alreaady imported * Ditch alphabetical ordering - it's incompatible with qualified completions * Fix bugs in completion help text This fixes the ugly "Imported from 'Just B'" and other inconsistencies * added tests for qualified completions * Fix redundant import * Inline Fuzzy.match to apply [1] and to be case-sensitive on first match [1] - joom/fuzzy#4 * fixup! Fix bugs in completion help text * Sort qualified completions first * Filter out global suggestions that overlap with local For example, don't suggest GHC.Exts.fromList when Data.Map.fromList is in scope alraedy * Sort completions alphabetically * Show provenance in detail text * Sort local/in-scope completions first * Fix build with GHC 9 * Ignore func symbol tests Co-authored-by: Alex Naspo <[email protected]> Co-authored-by: Javier Neira <[email protected]>
* Skip parsing without haddock for above GHC9.0 * Use runtime ghc version check * Need parse twice in getParsedModuleRule * Include sortText in completions and improve suggestions (#2332) * sort completions * add an example * Include fuzzy scores in completions sort text * hlints * Extend completion documentation to inform whether an identifier is alreaady imported * Ditch alphabetical ordering - it's incompatible with qualified completions * Fix bugs in completion help text This fixes the ugly "Imported from 'Just B'" and other inconsistencies * added tests for qualified completions * Fix redundant import * Inline Fuzzy.match to apply [1] and to be case-sensitive on first match [1] - joom/fuzzy#4 * fixup! Fix bugs in completion help text * Sort qualified completions first * Filter out global suggestions that overlap with local For example, don't suggest GHC.Exts.fromList when Data.Map.fromList is in scope alraedy * Sort completions alphabetically * Show provenance in detail text * Sort local/in-scope completions first * Fix build with GHC 9 * Ignore func symbol tests Co-authored-by: Alex Naspo <[email protected]> Co-authored-by: Javier Neira <[email protected]> * Give unique names to post-jobs (#2337) * Restore comment * Parse only with Haddock above GHC90 * Remove obsolete comment Co-authored-by: Pepe Iborra <[email protected]> Co-authored-by: Alex Naspo <[email protected]> Co-authored-by: Javier Neira <[email protected]>
* Skip parsing without haddock for above GHC9.0 * Use runtime ghc version check * Need parse twice in getParsedModuleRule * Include sortText in completions and improve suggestions (#2332) * sort completions * add an example * Include fuzzy scores in completions sort text * hlints * Extend completion documentation to inform whether an identifier is alreaady imported * Ditch alphabetical ordering - it's incompatible with qualified completions * Fix bugs in completion help text This fixes the ugly "Imported from 'Just B'" and other inconsistencies * added tests for qualified completions * Fix redundant import * Inline Fuzzy.match to apply [1] and to be case-sensitive on first match [1] - joom/fuzzy#4 * fixup! Fix bugs in completion help text * Sort qualified completions first * Filter out global suggestions that overlap with local For example, don't suggest GHC.Exts.fromList when Data.Map.fromList is in scope alraedy * Sort completions alphabetically * Show provenance in detail text * Sort local/in-scope completions first * Fix build with GHC 9 * Ignore func symbol tests Co-authored-by: Alex Naspo <[email protected]> Co-authored-by: Javier Neira <[email protected]> * Give unique names to post-jobs (#2337) * Restore comment * Parse only with Haddock above GHC90 * Remove obsolete comment Co-authored-by: Pepe Iborra <[email protected]> Co-authored-by: Alex Naspo <[email protected]> Co-authored-by: Javier Neira <[email protected]>
Changes:
head
forhea
overNoHeapProfiling
truncate
forTru
, onlyTrue
Closes #2291 and #2082