Skip to content
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

respect completion prefix when completing optional arguments #1277

Merged
merged 5 commits into from
May 17, 2024

Conversation

awilliambauer
Copy link
Contributor

For completions on labels that the LSP gets from merlin, take into account whether the prefix being completed starts with ~ or ?.

Merlin appears to always returns the full set of labeled/optional arguments when asked for completions. The LSP forwards these on, leaving it to the client to filter them. The problem is that merlin supplies the optional argument completions with a leading ? regardless of the prefix the user typed. This causes the client to either filter them out (VSCode) or offer completions that might flip an optional argument being passed with ~ to one passed with ? (Emacs).

This PR changes the label completions that start with ? to start with ~ when the prefix being completed starts with ~. It also adds a test case and does a bit of refactoring of test helper functions.

awilliambauer and others added 3 commits May 16, 2024 21:46
_
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
_
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
_
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
@coveralls
Copy link

coveralls commented May 17, 2024

Pull Request Test Coverage Report for Build 4230

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 6 of 6 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.03%) to 21.181%

Totals Coverage Status
Change from base Build 4225: 0.03%
Covered Lines: 5145
Relevant Lines: 24291

💛 - Coveralls

@rgrinberg
Copy link
Member

There were some async leftovers I had to tweak. LGTM now.

@rgrinberg rgrinberg added this to the 1.18.0 milestone May 17, 2024
_
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
@rgrinberg rgrinberg merged commit b47bd73 into ocaml:master May 17, 2024
9 checks passed
@awilliambauer awilliambauer deleted the respect-completion-prefix branch May 20, 2024 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants