Skip to content

Sort completions by priority #6

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

Merged
merged 1 commit into from
Jul 4, 2025
Merged

Sort completions by priority #6

merged 1 commit into from
Jul 4, 2025

Conversation

gaearon
Copy link
Contributor

@gaearon gaearon commented Jul 4, 2025

Attempts to implement #5 (comment).

Note:

  • I don't know Python well, this is written by Claude
  • I did test it, but then I ran out of credits, so I didn't test the final version after I removed debug code
  • So I might've goofed something

It does look like a good starting point though, if you forgive the fiddly word boundary logic. This might be better done with a regex or something.

@gaearon gaearon mentioned this pull request Jul 4, 2025

client: LeanLSPClient = ctx.request_context.lifespan_context.client
completions = client.get_completions(rel_path, line - 1, column - 1)

lines = content.splitlines()
if line > 0 and line <= len(lines):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this part of the code is crap and might benefit from some rewriting. we're just trying to extract the previous words here.

@oOo0oOo
Copy link
Owner

oOo0oOo commented Jul 4, 2025

Thanks! I will take this as a basis and do some reformatting on this PR.

@oOo0oOo oOo0oOo mentioned this pull request Jul 4, 2025
Merged
@oOo0oOo
Copy link
Owner

oOo0oOo commented Jul 4, 2025

Not sure this was the best workflow but what do you think about this PR?
#7

@oOo0oOo oOo0oOo merged commit 2d0b400 into oOo0oOo:main Jul 4, 2025
@gaearon
Copy link
Contributor Author

gaearon commented Jul 4, 2025

thanks, looks legit, i should have credits now so lemme play with it

@gaearon gaearon deleted the patch-1 branch July 5, 2025 01:51
@PhilNorfleet
Copy link

PhilNorfleet commented Jul 6, 2025

I'm just curious what you are using Lean for, @gaearon? I was so pleasantly surprised to see your contribution here!

@gaearon
Copy link
Contributor Author

gaearon commented Jul 7, 2025

Just for fun. I kind of started with NNG and then went through some of MIL, and now that Tao is working on Analysis companion, I got back into it since I really enjoyed doing exercises from this book before I even got into Lean.

So now I'm working through those exercises.

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.

3 participants