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

Issue with GoTagAdd Function when Called on Multiple Structs #43

Open
harunnryd opened this issue Aug 13, 2023 · 2 comments
Open

Issue with GoTagAdd Function when Called on Multiple Structs #43

harunnryd opened this issue Aug 13, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@harunnryd
Copy link

Problem Description:

I'm trying to use the GoTagAdd function on multiple structs in my Go code, as shown below:

type (
	LandingArticle struct {
		ID               uuid.UUID  `json:"id"`
		UserID           uuid.UUID  `json:"user_id"`
		Title            string     `json:"title"`
		ShortDescription string     `json:"short_description"`
		Content          string     `json:"content"`
		KitabisaURL      string     `json:"kitabisa_url"`
		ImageURL         string     `json:"image_url"`
		Status           string     `json:"status"`
		TotalRecord      int        `json:"total_record"`
		TotalPage        int        `json:"total_page"`
		CreatedAt        time.Time  `json:"created_at"`
		UpdatedAt        time.Time  `json:"updated_at"`
		DeletedAt        *time.Time `json:"deleted_at"`
	}

	FilterLandingArticle struct {
		Status      string
		SearchTitle string
		SortOrder   string
		PageNumber  int
		PageSize    int
	}
)

However, I'm encountering an issue when attempting to call GoTagAdd on the above-mentioned structs. The function doesn't seem to work as expected, especially when used on multiple structs as shown in the provided example.

Reproduction Steps:

  1. Create structures similar to the example given above.
  2. Call GoTagAdd on those structs with appropriate parameters.

Expected Outcome:

I expect GoTagAdd to function properly on multiple structs as demonstrated in the example above. Unfortunately, there seems to be an issue causing the function to not work as expected.

Actual Outcome:

The call to GoTagAdd does not work as expected when used on multiple structs as described above. This results in my inability to effectively add tags to multiple structs.

E5108: Error executing lua ...are/nvim/lazy/gopher.nvim/lua/gopher/_utils/ts/nodes.lua:44: attempt to call field 'count_parents' (a nil value)
stack traceback:
        ...are/nvim/lazy/gopher.nvim/lua/gopher/_utils/ts/nodes.lua:44: in function <...are/nvim/lazy/gopher.nvim/lua/gopher/_utils/ts/nodes.lua:43>
        [C]: in function 'sort'
        ...are/nvim/lazy/gopher.nvim/lua/gopher/_utils/ts/nodes.lua:43: in function 'sort_nodes'
        ...are/nvim/lazy/gopher.nvim/lua/gopher/_utils/ts/nodes.lua:130: in function 'nodes_at_cursor'
        ...hare/nvim/lazy/gopher.nvim/lua/gopher/_utils/ts/init.lua:34: in function 'get_struct_node_at_pos'
        ...l/share/nvim/lazy/gopher.nvim/lua/gopher/struct_tags.lua:10: in function 'modify'
        ...l/share/nvim/lazy/gopher.nvim/lua/gopher/struct_tags.lua:100: in function 'tags_add'
        [string ":lua"]:1: in main chunk
@harunnryd

This comment was marked as off-topic.

@olexsmir
Copy link
Owner

currently, the plugin doesn't support adding tags on multiple structs simultaneously. I will implement this feature in the future, but not soon. Currently, I'm working on refactoring this plugin

@olexsmir olexsmir added the bug Something isn't working label Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants