Skip to content

Add completions for included modules #7509

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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nojaf
Copy link
Collaborator

@nojaf nojaf commented May 23, 2025

I'm a little stuck on this one, could use a pointer @zth if you have any ideas.

open Types

@send
external addPos: (context, float, float) => comp = "pos"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This becomes available in Wall after its inclusion.


let make = () => {
[
// k.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We should be able to complete k->addPos and k->addPosFromVec2.

@@ -357,6 +357,7 @@ let completePipeChain ~(inJsxContext : bool) (exp : Parsetree.expression) =

let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor
?findThisExprLoc text =
let cursorPath = Stack.create () in
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm trying to keep track of which nested modules we have visited so far.
So, I can construct the current path of the cursor.

@@ -1180,8 +1182,17 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact
|> TypeUtils.filterPipeableFunctions ~synthetic:true ~env ~full
~targetTypeId:mainTypeId
in
(* Add completions from current fully qualified path module *)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Here, I use the cursorPath collected via the frontend, to ask for DotPipeCompleteFromCurrentModule.Wall completions.

This is the only way I get the addPos and addPosFromVec2 completions.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This, of course, doesn't take into account functions defined after the cursor.
So that is not ideal.
It also proposes fully qualified function calls instead of having no path at all.

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.

1 participant