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

goto_next_parameter behaves differnetly in Go,Zig, Rust #12682

Open
Smithx10 opened this issue Jan 26, 2025 · 1 comment
Open

goto_next_parameter behaves differnetly in Go,Zig, Rust #12682

Smithx10 opened this issue Jan 26, 2025 · 1 comment

Comments

@Smithx10
Copy link

In the following go code goto_next_parameter will go to the following 3 locations:
's *Dog'
's string'
'"hello"'

func MyFunc(s *Dog, s string) error {
	fmt.Println("hello")
	return nil
}

In the following zig code goto_next_parameter will go to the following 1 location:
'str: []const u8'

pub fn DoItLive(str: []const u8) void {
    DoItLive("MyString");
    std.debug.print("str {s}", .{str});
}

I'd expect goto_next_parameter to go to
'str: []const u8'
'"MyString"'
'"str {s}"'
'.{str}'

Is this expected behavior, how can I fix this? Do we need to adjust Zig Treesitter or something in the helix code?

@Smithx10
Copy link
Author

Javascript seems to work as expected:

In the following javascript code goto_next_parameter will go to the following 4 location:
'dog'
'cat'
'dog'
'cat'

class Dog {
 DoThisThing(dog, cat) {
    var foo = {
   "rawr": "sauce"
  }
   console.log(dog, cat)
    return null
  }
}

Rust Seems to not be so accurate:
In the following rust code goto_next_parameter will go to the following location:
'rawr: &str'
'"tommy"'
'name: String::from("mycoolguystring")'

fn myfunc(rawr: &str) {
    println!("{}", rawr);
}

fn main() {
    myfunc("tommy");
    let dog = MyStruct{
        name: String::from("mycoolguystring")
    };
    println!("{}", dog.name)
}

I'd expect the following:
'rawr: &str'
'"{}"'
'rawr'
'"tommy"'
'"mycoolguystring"'
'"{}"'
'dog.name'

@Smithx10 Smithx10 changed the title goto_next_parameter behaves differnetly in Go and Zig goto_next_parameter behaves differnetly in Go,Zig, Rust Jan 26, 2025
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

No branches or pull requests

1 participant