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

Feature request: automatically generate implementations by error message + fetch correct identifier name. #57

Open
arnevm123 opened this issue Jan 26, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@arnevm123
Copy link

Hi,
I have a feature request I'd like to try to implement myself.
The situation is this: you have a compilation error in your file:

compiler: cannot use &implementation{…} (value of type *implementation) as Manager value in return statement: *implementation does not implement Interface (missing method MissingMethod) [InvalidIfaceAssign]

I think we can use this to parse out the implementation and Interface and pass it on to Impl to let it generate our missing methods.

A second part to this would be to check the current file with treesitter to get the correct identifier name from other already implemented methods.

Eg. we already have func (i *implementation) Foo {}, but we're missing the implementation of Bar, if we use :Imp Interface we'd get func (i *implementation) Bar{} instead of func (implementation *implementation) Bar{} (I know it's just typing :Imp i Interface instead, but I keep forgetting 😄 )

Please let me know if this is something you'd want in your plugin.
(I'll probably write these as a wrapper around calling :Impl with your plugin anyway, but I might as well add them if you want)

@olexsmir
Copy link
Owner

first off, the plugin is just binding for existing cli tools. As I see this, it would take too much time, but I don't have much spare time because of uni.

so I will add this to my backed list, but I don't think that I will implement something like this

thanks for using the plugin 😄

@olexsmir olexsmir added the enhancement New feature or request label Jan 27, 2024
@arnevm123
Copy link
Author

No worries, I was thinking about making a PR myself for this if you want, we can still see if we add this to the plugin itself based on how well it integrates.

@olexsmir
Copy link
Owner

olexsmir commented Feb 11, 2024

sure, if you have the motivation and idea of how to make it, I would appreciate PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants