Skip to content
This repository was archived by the owner on Jul 15, 2023. It is now read-only.
This repository was archived by the owner on Jul 15, 2023. It is now read-only.

automatic import adder should not separate first import from its comment #1701

@mbenkmann

Description

@mbenkmann
  1. Relevant Settings:

    "go.autocompleteUnimportedPackages": true 
  2. Type the following program

package main //#include <stdlib.h> import "C" func main() { fmt } 
  1. Place cursor behind "fmt"
  2. Type "." The Intellisense window should pop up with suggestions.
  3. Accept any suggestion (e.g. "Errorf")
  4. The import statement will be rewritten to
//#include <stdlib.h> import (	"fmt"	"C" ) 

However this breaks the magic of import "C" which uses the preceding comment.

When converting import lines to a parenthesized import block, vscode-go should insert the "import (" before the comment lines immediately preceding (i.e. with no empty lines in between) the first import (if there are any).

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedneeds-decisionFeedback is required from experts, contributors, and/or the community before a change can be made.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions