Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

x/tools/gopls: Completion: "unexpected surrounding: %q != %q" bug in collectCompletions #75192

Open
Assignees
Labels
BugReportIssues describing a possible bug in the Go implementation. NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one. ToolsThis label describes issues relating to any tools in the x/tools repository. goplsIssues related to the Go language server, gopls. gopls/telemetry-wins
Milestone
@adonovan

Description

#!stacks
"bug.Reportf" && "completion.(*completer).selector:+57"

Issue created by stacks.

	// -- completion of symbols in unimported packages --
	// use new code for unimported completions, if flag allows it
	if c.snapshot.Options().ImportsSource == settings.ImportsSourceGopls {
		// The user might have typed strings.TLower, so id.Name==strings, sel.Sel.Name == TLower,
		// but the cursor might be inside TLower, so adjust the prefix
		prefix := sel.Sel.Name
		if c.surrounding != nil {
			if c.surrounding.content != sel.Sel.Name {
				bug.Reportf("unexpected surrounding: %q != %q", c.surrounding.content, sel.Sel.Name)
			} else {
				prefix = sel.Sel.Name[:c.surrounding.cursor-c.surrounding.start]
			}
		}
		c.unimported(ctx, metadata.PackageName(id.Name), prefix)
		return nil
	}

Possible regression in https://go.dev/cl/667576?

This stack _bvZaw was reported by telemetry:

golang.org/x/tools/gopls@v0.20.0 go1.25.0 darwin/arm64 vscode (1)

Metadata

Metadata

Assignees

Labels

BugReportIssues describing a possible bug in the Go implementation. NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one. ToolsThis label describes issues relating to any tools in the x/tools repository. goplsIssues related to the Go language server, gopls. gopls/telemetry-wins

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    AltStyle によって変換されたページ (->オリジナル) /