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

x/tools/gopls: can't add new file to existing package #35605

Closed
muirdm opened this issue Nov 15, 2019 · 3 comments
Closed

x/tools/gopls: can't add new file to existing package #35605

muirdm opened this issue Nov 15, 2019 · 3 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@muirdm
Copy link

muirdm commented Nov 15, 2019

On master (4191b8c) when I add a new file to an existing package I get no ParseGoHandle for file://... when I try to use gopls functionality in the new file.

Note that in my editor the new file comes pre-populated with the package name based on the file's directory name (i.e. the bug only reproduces if the initial "didOpen" message already contains the "package foo" line). If I subsequently edit the package name then the file gets loaded normally.

Below is an RPC trace starting from opening the new file through the first "no ParseGoHandle" error:

[Trace - 05:01:19 PM] Sending notification 'textDocument/didOpen'.
Params: {
  "textDocument": {
    "uri": "file:///Users/muir/scratch/foo/bar.go",
    "languageId": "go",
    "version": 0,
    "text": "\npackage foo\n"
  }
}


[Trace - 05:01:19 PM] Received notification 'window/logMessage'.
Params: {
  "message": "2019/11/14 17:01:19 go/packages.Load\n\tpackages = 1",
  "type": 3
}


[Trace - 05:01:19 PM] Received notification 'window/logMessage'.
Params: {
  "message": "2019/11/14 17:01:19 go/packages.Load\n\tpackage = foo\n\tfiles = [/Users/muir/scratch/foo/foo.go /Users/muir/scratch/foo/bar.go]",
  "type": 3
}


[Trace - 05:01:19 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "diagnostics": [],
  "uri": "file:///Users/muir/scratch/foo/foo.go"
}


[Trace - 05:01:23 PM] Sending notification 'textDocument/didChange'.
Params: {
  "textDocument": {
    "uri": "file:///Users/muir/scratch/foo/bar.go",
    "version": 1
  },
  "contentChanges": [
    {
      "range": {
        "start": {
          "line": 1,
          "character": 11
        },
        "end": {
          "line": 1,
          "character": 11
        }
      },
      "rangeLength": 0,
      "text": "\n"
    }
  ]
}


[Trace - 05:01:23 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "diagnostics": [],
  "uri": "file:///Users/muir/scratch/foo/foo.go"
}


[Trace - 05:01:23 PM] Sending request 'textDocument/signatureHelp - (568)'.
Params: {
  "textDocument": {
    "uri": "file:///Users/muir/scratch/foo/bar.go"
  },
  "position": {
    "line": 2,
    "character": 0
  }
}


[Trace - 05:01:23 PM] Received response 'textDocument/signatureHelp - (568)' in 6ms.
Result: null


[Trace - 05:01:23 PM] Received notification 'window/logMessage'.
Params: {
  "message": "2019/11/14 17:01:23 no signature help\n\tAt = {2 0}\n\tFailure = no ParseGoHandle for file:///Users/muir/scratch/foo/bar.go",
  "type": 3
}
@gopherbot gopherbot added this to the Unreleased milestone Nov 15, 2019
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Nov 15, 2019
@gopherbot
Copy link

Thank you for filing a gopls issue! Please take a look at the Troubleshooting guide, and make sure that you have provided all of the relevant information here.

@stamblerre stamblerre self-assigned this Nov 15, 2019
@stamblerre stamblerre modified the milestones: Unreleased, gopls v1.0 Dec 4, 2019
@stamblerre
Copy link
Contributor

Thanks for the report. This sounds a lot like #35949, so I will close this as a duplicate.

@stamblerre
Copy link
Contributor

Duplicate of #35949

@stamblerre stamblerre marked this as a duplicate of #35949 Dec 4, 2019
@stamblerre stamblerre modified the milestones: gopls/v1.0.0, gopls/v0.4.0 Jul 22, 2020
@golang golang locked and limited conversation to collaborators Jul 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants