Skip to content

"Unqualify type" code action does not show up in record declarations #4565

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

Open
folospior opened this issue May 5, 2025 · 10 comments
Open
Labels
good first issue Good for newcomers help wanted Contributions encouraged priority:medium

Comments

@folospior
Copy link

folospior commented May 5, 2025

Reproduction code:

  • wibble.gleam:
pub type Wibble
  • wobble.gleam:
import wibble

pub type Wobble {
  Wobble(wibble: wibble.Wibble)
  //             ^^^^^^^^^^^^^
}

Highlighting on the marked area and running the Show code actions LSP command shows no available code actions.
Image

Gleam 1.10.0 from Nixpkgs

@lpil
Copy link
Member

lpil commented May 6, 2025

Thank you

@lpil lpil added help wanted Contributions encouraged good first issue Good for newcomers priority:medium labels May 6, 2025
@cysabi
Copy link

cysabi commented May 7, 2025

hi! i'm a new contributor, wanted to try tackling this issue :)

i found my way to

code_action_convert_unqualified_constructor_to_qualified(
which seems to be the right spot?

going to try to figure this out but would love some tips!

@GearsDatapacks
Copy link
Member

Yeah! Except you're looking at unqualified_to_qualified, the code action in question here is the one above, qualified_to_unqualified.
You'll need to look at how it is implemented and make changes inside the code_action module.

Actually, that depends on where the bug is. I suspect the issue might lie in the fact that the AST visitor is still not 100% implemented, so you might need to edit that.

@cysabi
Copy link

cysabi commented May 8, 2025

thank you!!

for the ast visitor, do u mean this?

fn visit_typed_custom_type(&mut self, custom_type: &'ast ast::TypedCustomType) {

@GearsDatapacks
Copy link
Member

That's what one implementation of the ast visitor looks like, yes. Though I think you may need to modify the actual definition of it, in the ast::visit module.

@cysabi
Copy link

cysabi commented May 10, 2025

hi! thank you so much taking the time to explain stuff ~ i might be lost again 😭

i tried to do cysabi@9b86e8a which did not work

i tried finding some other places to look and i found some comments about Record Value Constructor which im not sure i quite understand what it's referring to, and of which happens here:

fn visit_typed_expr_module_select(
which led to
pub fn visit_typed_expr_module_select<'a, V>(

which does have a todo comment? but im not sure if that's the issue

i also know that there's impl's in

impl<'ast> ast::visit::Visit<'ast> for AddAnnotations<'_> {
and tried playing around with impl a visit_typed_custom_type in there, also no avail

im sure im missing something obvious, thank you in advance!

@GearsDatapacks
Copy link
Member

Your commit seems like the correct way to go, at least that's where I would have started. At this point, I would probably just sprinkle in a handful of dbg! macros and try to figure out where it's going wrong.

cysabi added a commit to cysabi/gleam that referenced this issue May 13, 2025
@cysabi
Copy link

cysabi commented May 13, 2025

okay! sent a pr #4595

just as an fyi, it turns out my fix did work, i just did not know haha. got super confused about how the snapshot runner worked as ive never done something like this before, a couple lines in the contributing about installing insta and using the review tool would be my suggestion!

@GearsDatapacks
Copy link
Member

GearsDatapacks commented May 13, 2025

A couple lines in the contributing about installing insta and using the review tool would be my suggestion!

You mean something like this?

@cysabi
Copy link

cysabi commented May 13, 2025

omg i missed this sorry!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Contributions encouraged priority:medium
Projects
None yet
Development

No branches or pull requests

4 participants