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

Auto-detect annotation types #30

Closed
meijieru opened this issue Dec 8, 2021 · 7 comments
Closed

Auto-detect annotation types #30

meijieru opened this issue Dec 8, 2021 · 7 comments
Labels
enhancement New feature or request

Comments

@meijieru
Copy link
Contributor

meijieru commented Dec 8, 2021

vim-doge doesn't need to specify the type to annotate.
Could we have similar features?

@danymat
Copy link
Owner

danymat commented Dec 8, 2021

Hello! thanks for chiming in !

vim-doge doesn't need to specify the type to annotate.
Could we have similar features?

In theory we could indeed, but we need to do it well if we're about to do it.
Just for you to know, atm, in order to generate the annotations we:

  • call the annotator function with a specified type
  • search the first upper node that matches the type
  • Generate the annotations for the node

I think it is not a problem if we only have classes, and functions annotations (and templates too). What happens if we have the cursor on a type annotation ? Like this:

local function test()
  local test_var = do_smt() --> cursor on this line will generate a type annotation just before this line
  -- this is a comment  
end

@meijieru
Copy link
Contributor Author

meijieru commented Dec 9, 2021

I think the behavior in the comment is decent.

@danymat danymat added the enhancement New feature or request label Dec 10, 2021
@danymat
Copy link
Owner

danymat commented Jan 7, 2022

Sorry for putting this feat on hold, as it was the holidays season. I'm thinking about it right now:

Do you know what's the logic behind vim-doge automatic selection ? Or better, what do you think will be the best:

  • Going up in the tree until we stop on a first matching node, no matter what the type?
  • Having a priority list of types, that we will loop until we stop on a matching node, i.e:
priority = { "func", "class", "type", ...}

@meijieru
Copy link
Contributor Author

meijieru commented Jan 7, 2022

I am not familiar with the vim-doge's logic.
Personally, I prefer the second option.
Maybe some polls may help.

@danymat
Copy link
Owner

danymat commented Feb 24, 2022

This will have the same complexity (mostly) as this issue (point 2): #53 (comment)

I will try to keep this open for a while, in case someone wants to comment

@danymat
Copy link
Owner

danymat commented Mar 3, 2022

@meijieru I recommend following and testing #74

@danymat danymat linked a pull request Mar 5, 2022 that will close this issue
@danymat
Copy link
Owner

danymat commented Jan 9, 2023

#116 Implemented this feature, see Neogen 2.11 !

@danymat danymat closed this as completed Jan 9, 2023
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

Successfully merging a pull request may close this issue.

2 participants