Skip to content

Show warning, when overwriting variable #3674

Open
@guettli

Description

@guettli

Is your feature request related to a problem? Please describe.

I wrote that code, and I did not understand why path was empty, although findDev() returns a non-empty path:

func getDeviceFromPath(path string) (*evdev.InputDevice, error) {
	if path == "" {
		path, err := findDev()   // "path" of outer block gets overwritten
		if err != nil {
			return nil, err
		}
		fmt.Printf("Using device %q\n", path)
	}
	sourceDev, err := evdev.Open(path)

Describe the solution you'd like

I would like to see a warning in vscode, when I overwrite a variable from the outer scope.

Describe alternatives you've considered

I could use external linters, but I think that should be available "out of the box".

Metadata

Metadata

Assignees

No one assigned

    Labels

    WaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions