Git Product home page Git Product logo

Comments (4)

RobertOstermann avatar RobertOstermann commented on August 11, 2024

@mattiab-axis Thanks for bringing this to my attention and providing an example for me to use. I have never used Golang before so that is extremely helpful. I have released version 1.1.0 which should address this problem.

from vscode-inline-parameters.

mattiasberlin avatar mattiasberlin commented on August 11, 2024

Thank you, methods seems to work like they should now!

I noticed another oddity, which seems to occur when you call a function from another package which takes an interface as a parameter. I don't know if you want to continue in this issue or create another one, but I'll give a repro here. Unfortunately since it requires two packages it needs a little more setup.

anotherpackage/anotherpackage.go

package anotherpackage

type Struct struct{}

func (a Struct) Method(s string) string {
	return s
}

func Function(s string) string {
	return s
}

type Interface interface {
	Method(string) string
}

func FunctionWithInterfaceParameter(a Interface, s string) string {
	return a.Method(s)
}

example.go

package main

import "example/anotherpackage"

func main() {
	anotherpackage.Function("test") // Correct.

	a := anotherpackage.Struct{}
	a.Method("test") // Correct.

	anotherpackage.FunctionWithInterfaceParameter(a, "test") // First param is correct. Second should be "s:" but is "Interface:" (the type name of the first param).
}

Then either run go mod init example or create a go.mod with this content (if you're running Go 1.18 that is):

module example

go 1.18

from vscode-inline-parameters.

RobertOstermann avatar RobertOstermann commented on August 11, 2024

ok, I looked into that problem. Looks like it is a bug because I messed up the regex to parse the variadic parameters. I have published version 1.1.1 that should fix that bug.

from vscode-inline-parameters.

mattiasberlin avatar mattiasberlin commented on August 11, 2024

Awesome, thanks a lot! I'll close the task.

from vscode-inline-parameters.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.