sublimelsp / LSP-gopls

Golang support for Sublime's LSP plugin
MIT License
50 stars 8 forks source link

works only with go modules version 1.21.8 and below #78

Closed alvarolm closed 3 months ago

alvarolm commented 7 months ago

UPDATE:

I have removed go and re-installed it again, now its working. must be a local issue with my go configuration, even do this doesn't happens with vscode.

LSP-gopls should detect these edge cases and handle them like vscode does. or at least emit a warning. its sad with all this tooling there is no evident clue to grasp at first sight.

UPDATE:

I have isolated the issue to the go version in the go.mod file, it only works for 1.21.8 and below, is there any reason for this behavior.


Original issue:

for some reason I can't figure out why it seems to work partially on module, when hovering over the imported packages it displays the symbol info correctly but any other doesn't display anything and even "go to definition" throws: No results found.

works correctly with: when using a module and go.work when not using any module

here are some a brief videos:

working partially: https://github.com/sublimelsp/LSP-gopls/assets/2561547/58fad7f6-8635-40dd-a94e-2b0cbf7baeed

working ok: https://github.com/sublimelsp/LSP-gopls/assets/2561547/9e703ea3-35fc-4730-8910-ec5b9b68a1c6

any help is appreciated !

versions: sublime: 4169 LSP: 1.29.0 LSP-gopls: 1.15.0

lsp log panel:

gopls: 2024/03/18 23:11:05 go info for /home/alvarolm/dev/assets/go/src/almasesorias/ddjj/1948gen
(view type GoModView)
(root dir /home/alvarolm/dev/assets/go/src/almasesorias/ddjj/1948gen)
(go version go version go1.22.1 linux/amd64)
(build flags: [])
(go env: {GOOS:linux GOARCH:amd64 GOCACHE:/home/alvarolm/.cache/go-build GOMODCACHE:/home/alvarolm/dev/assets/go/pkg/mod GOPATH:/home/alvarolm/dev/assets/go GOPRIVATE: GOFLAGS: GO111MODULE: GoVersion:22 GoVersionOutput:go version go1.22.1 linux/amd64
 GOWORK: GOPACKAGESDRIVER:})
(env overlay: map[])

gopls: 2024/03/18 23:11:05 10.329663ms for GOROOT=/home/alvarolm/dev/globaldep/go GOPATH=/home/alvarolm/dev/assets/go GO111MODULE=off GOPROXY= PWD=/home/alvarolm/dev/assets/go/src/almasesorias/ddjj/1948gen go list -e -f {{context.ReleaseTags}} -- unsafe

gopls: 2024/03/18 23:11:05 10.982869ms for GOROOT=/home/alvarolm/dev/globaldep/go GOPATH=/home/alvarolm/dev/assets/go GO111MODULE=auto GOPROXY= PWD=/home/alvarolm/dev/assets/go/src/almasesorias/ddjj/1948gen go list -f "{{context.GOARCH}} {{context.Compiler}}" -- unsafe

gopls: 2024/03/18 23:11:05 221.426394ms for GOROOT=/home/alvarolm/dev/globaldep/go GOPATH=/home/alvarolm/dev/assets/go GO111MODULE=auto GOPROXY= PWD=/home/alvarolm/dev/assets/go/src/almasesorias/ddjj/1948gen go list -e -json=Name,ImportPath,Error,Dir,GoFiles,IgnoredGoFiles,IgnoredOtherFiles,CFiles,CgoFiles,CXXFiles,MFiles,HFiles,FFiles,SFiles,SwigFiles,SwigCXXFiles,SysoFiles,TestGoFiles,XTestGoFiles,CompiledGoFiles,Export,DepOnly,Imports,ImportMap,TestImports,XTestImports,ForTest,DepsErrors,Module,EmbedFiles -compiled=true -test=true -export=false -deps=true -find=false -pgo=off -- /home/alvarolm/dev/assets/go/src/almasesorias/ddjj/1948gen/... builtin

gopls: 2024/03/18 23:11:05 go/packages.Load #1
    snapshot=0
    directory=file:///home/alvarolm/dev/assets/go/src/almasesorias/ddjj/1948gen
    query=[/home/alvarolm/dev/assets/go/src/almasesorias/ddjj/1948gen/... builtin]
    packages=2

gopls: 2024/03/18 23:11:05 go/packages.Load #1
    snapshot=0
    directory=file:///home/alvarolm/dev/assets/go/src/almasesorias/ddjj/1948gen
    package="almasesorias/ddjj/1948gen"
    files=[/home/alvarolm/dev/assets/go/src/almasesorias/ddjj/1948gen/main.go]

gopls: 2024/03/18 23:11:05 go/packages.Load #1
    snapshot=0
    directory=file:///home/alvarolm/dev/assets/go/src/almasesorias/ddjj/1948gen
    package="builtin"
    files=[/home/alvarolm/dev/globaldep/go/src/builtin/builtin.go]

gopls: 2024/03/18 23:11:05 go/packages.Load #1: updating metadata for 48 packages

gopls: 2024/03/18 23:11:05 go info for /home/alvarolm/dev/assets/go/src/almasesorias/ddjj/1948gen
(view type GoModView)
(root dir /home/alvarolm/dev/assets/go/src/almasesorias/ddjj/1948gen)
(go version go version go1.22.1 linux/amd64)
(build flags: [])
(go env: {GOOS:linux GOARCH:amd64 GOCACHE:/home/alvarolm/.cache/go-build GOMODCACHE:/home/alvarolm/dev/assets/go/pkg/mod GOPATH:/home/alvarolm/dev/assets/go GOPRIVATE: GOFLAGS: GO111MODULE: GoVersion:22 GoVersionOutput:go version go1.22.1 linux/amd64
 GOWORK: GOPACKAGESDRIVER:})
(env overlay: map[])

gopls: 2024/03/18 23:11:05 13.789381ms for GOROOT=/home/alvarolm/dev/globaldep/go GOPATH=/home/alvarolm/dev/assets/go GO111MODULE=auto GOPROXY= PWD=/home/alvarolm/dev/assets/go/src/almasesorias/ddjj/1948gen go list -f "{{context.GOARCH}} {{context.Compiler}}" -- unsafe

gopls: 2024/03/18 23:11:05 14.542849ms for GOROOT=/home/alvarolm/dev/globaldep/go GOPATH=/home/alvarolm/dev/assets/go GO111MODULE=off GOPROXY= PWD=/home/alvarolm/dev/assets/go/src/almasesorias/ddjj/1948gen go list -e -f {{context.ReleaseTags}} -- unsafe

gopls: 2024/03/18 23:11:05 127.48843ms for GOROOT=/home/alvarolm/dev/globaldep/go GOPATH=/home/alvarolm/dev/assets/go GO111MODULE=auto GOPROXY= PWD=/home/alvarolm/dev/assets/go/src/almasesorias/ddjj/1948gen go list -e -json=Name,ImportPath,Error,Dir,GoFiles,IgnoredGoFiles,IgnoredOtherFiles,CFiles,CgoFiles,CXXFiles,MFiles,HFiles,FFiles,SFiles,SwigFiles,SwigCXXFiles,SysoFiles,TestGoFiles,XTestGoFiles,CompiledGoFiles,Export,DepOnly,Imports,ImportMap,TestImports,XTestImports,ForTest,DepsErrors,Module,EmbedFiles -compiled=true -test=true -export=false -deps=true -find=false -pgo=off -- /home/alvarolm/dev/assets/go/src/almasesorias/ddjj/1948gen/... builtin

gopls: 2024/03/18 23:11:05 go/packages.Load #2
    snapshot=0
    directory=file:///home/alvarolm/dev/assets/go/src/almasesorias/ddjj/1948gen
    query=[/home/alvarolm/dev/assets/go/src/almasesorias/ddjj/1948gen/... builtin]
    packages=2

gopls: 2024/03/18 23:11:05 go/packages.Load #2
    snapshot=0
    directory=file:///home/alvarolm/dev/assets/go/src/almasesorias/ddjj/1948gen
    package="almasesorias/ddjj/1948gen"
    files=[/home/alvarolm/dev/assets/go/src/almasesorias/ddjj/1948gen/main.go]

gopls: 2024/03/18 23:11:05 go/packages.Load #2
    snapshot=0
    directory=file:///home/alvarolm/dev/assets/go/src/almasesorias/ddjj/1948gen
    package="builtin"
    files=[/home/alvarolm/dev/globaldep/go/src/builtin/builtin.go]

gopls: 2024/03/18 23:11:05 go/packages.Load #2: updating metadata for 48 packages

gopls: 2024/03/18 23:11:16 fixImports(filename="/home/alvarolm/dev/assets/go/src/almasesorias/ddjj/1948gen/main.go"), abs="/home/alvarolm/dev/assets/go/src/almasesorias/ddjj/1948gen/main.go", srcDir="/home/alvarolm/dev/assets/go/src/almasesorias/ddjj/1948gen" ...

gopls: 2024/03/18 23:11:19 fixImports(filename="/home/alvarolm/dev/assets/go/src/almasesorias/ddjj/1948gen/main.go"), abs="/home/alvarolm/dev/assets/go/src/almasesorias/ddjj/1948gen/main.go", srcDir="/home/alvarolm/dev/assets/go/src/almasesorias/ddjj/1948gen" ...

LSP settings:

// Settings in here override those in "LSP/LSP.sublime-settings"
{

  // Show errors and warnings count in the status bar
  "show_diagnostics_count_in_view_status": true,

  // Show the diagnostics description of the code
  // under the cursor in status bar if available.
  "show_diagnostics_in_view_status": true,

  // Show diagnostics as annotations with level equal to or less than:
  // none: 0 (never show)
  // error: 1
  // warning: 2
  // info: 3
  // hint: 4
  // When enabled, it's recommended not to use the "annotation" value for the
  // `show_code_actions` option as it's impossible to enforce which one gets shown first.
  "show_diagnostics_annotations_severity_level": 4,
  "completion_insert_mode": "replace",
  "show_inlay_hints": true,

  "log_debug": true,

}

LSP-gopls settings:

// Packages/User/LSP-gopls.sublime-settings
{
  "command": [
    "${storage_path}/LSP-gopls/bin/gopls"
  ],
  "selector": "source.go | source.gomod",
  "settings": {
    // Controls if LSP-gopls will automatically install and upgrade gopls.
    // If this option is set to `False` the user will need to update the
    // `command` to point to a valid gopls binary.
    "manageGoplsBinary": true,

    // Controls if the Terminus panel/tab will auto close on tests completing.
    "closeTestResultsWhenFinished": false,

    // Controls if the test results output to a panel instead of a tab.
    "runTestsInPanel": true,

    // buildFlags is the set of flags passed on to the build system when invoked.
    // It is applied to queries like `go list`, which is used when discovering files.
    // The most common use is to set `-tags`.
    //
    "gopls.buildFlags": [],

    // env adds environment variables to external commands run by `gopls`, most notably `go list`.
    //
    "gopls.env": {},

    // directoryFilters can be used to exclude unwanted directories from the
    // workspace. By default, all directories are included. Filters are an
    // operator, `+` to include and `-` to exclude, followed by a path prefix
    // relative to the workspace folder. They are evaluated in order, and
    // the last filter that applies to a path controls whether it is included.
    // The path prefix can be empty, so an initial `-` excludes everything.
    //
    // DirectoryFilters also supports the `**` operator to match 0 or more directories.
    //
    // Examples:
    //
    // Exclude node_modules at current depth: `-node_modules`
    //
    // Exclude node_modules at any depth: `-**/node_modules`
    //
    // Include only project_a: `-` (exclude everything), `+project_a`
    //
    // Include only project_a, but not node_modules inside it: `-`, `+project_a`, `-project_a/node_modules`
    //
    "gopls.directoryFilters": [
      "-**/node_modules"
    ],

    // templateExtensions gives the extensions of file names that are treateed
    // as template files. (The extension
    // is the part of the file name after the final dot.)
    //
    "gopls.templateExtensions": [],

    // (experimental) obsolete, no effect
    //
    "gopls.memoryMode": "",

    // (experimental) expandWorkspaceToModule determines which packages are considered
    // "workspace packages" when the workspace is using modules.
    //
    // Workspace packages affect the scope of workspace-wide operations. Notably,
    // gopls diagnoses all packages considered to be part of the workspace after
    // every keystroke, so by setting "ExpandWorkspaceToModule" to false, and
    // opening a nested workspace directory, you can reduce the amount of work
    // gopls has to do to keep your workspace up to date.
    //
    "gopls.expandWorkspaceToModule": true,

    // (experimental) allowModfileModifications disables -mod=readonly, allowing imports from
    // out-of-scope modules. This option will eventually be removed.
    //
    "gopls.allowModfileModifications": false,

    // (experimental) allowImplicitNetworkAccess disables GOPROXY=off, allowing implicit module
    // downloads rather than requiring user action. This option will eventually
    // be removed.
    //
    "gopls.allowImplicitNetworkAccess": false,

    // standaloneTags specifies a set of build constraints that identify
    // individual Go source files that make up the entire main package of an
    // executable.
    //
    // A common example of standalone main files is the convention of using the
    // directive `//go:build ignore` to denote files that are not intended to be
    // included in any package, for example because they are invoked directly by
    // the developer using `go run`.
    //
    // Gopls considers a file to be a standalone main file if and only if it has
    // package name "main" and has a build directive of the exact form
    // "//go:build tag" or "// +build tag", where tag is among the list of tags
    // configured by this setting. Notably, if the build constraint is more
    // complicated than a simple tag (such as the composite constraint
    // `//go:build tag && go1.18`), the file is not considered to be a standalone
    // main file.
    //
    // This setting is only supported when gopls is built with Go 1.16 or later.
    //
    "gopls.standaloneTags": [
      "ignore"
    ],

    // hoverKind controls the information that appears in the hover text.
    // SingleLine and Structured are intended for use only by authors of editor plugins.
    //
    "gopls.hoverKind": "FullDocumentation",

    // linkTarget controls where documentation links go.
    // It might be one of:
    //
    // * `"godoc.org"`
    // * `"pkg.go.dev"`
    //
    // If company chooses to use its own `godoc.org`, its address can be used as well.
    //
    // Modules matching the GOPRIVATE environment variable will not have
    // documentation links in hover.
    //
    "gopls.linkTarget": "pkg.go.dev",

    // linksInHover toggles the presence of links to documentation in hover.
    //
    "gopls.linksInHover": true,

    // placeholders enables placeholders for function parameters or struct
    // fields in completion responses.
    //
    "gopls.usePlaceholders": true,

    // (debug) completionBudget is the soft latency goal for completion requests. Most
    // requests finish in a couple milliseconds, but in some cases deep
    // completions can take much longer. As we use up our budget we
    // dynamically reduce the search scope to ensure we return timely
    // results. Zero means unlimited.
    //
    "gopls.completionBudget": "100ms",

    // (advanced) matcher sets the algorithm that is used when calculating completion
    // candidates.
    //
    "gopls.matcher": "Fuzzy",

    // (experimental) experimentalPostfixCompletions enables artificial method snippets
    // such as "someSlice.sort!".
    //
    "gopls.experimentalPostfixCompletions": true,

    // completeFunctionCalls enables function call completion.
    //
    // When completing a statement, or when a function return type matches the
    // expected of the expression being completed, completion may suggest call
    // expressions (i.e. may include parentheses).
    //
    "gopls.completeFunctionCalls": true,

    // importShortcut specifies whether import statements should link to
    // documentation or go to definitions.
    //
    "gopls.importShortcut": "Both",

    // (advanced) symbolMatcher sets the algorithm that is used when finding workspace symbols.
    //
    "gopls.symbolMatcher": "FastFuzzy",

    // (advanced) symbolStyle controls how symbols are qualified in symbol responses.
    //
    // Example Usage:
    //
    // ```json5
    // "gopls": {
    // ...
    //   "symbolStyle": "Dynamic",
    // ...
    // }
    // ```
    //
    "gopls.symbolStyle": "Dynamic",

    // symbolScope controls which packages are searched for workspace/symbol
    // requests. The default value, "workspace", searches only workspace
    // packages. The legacy behavior, "all", causes all loaded packages to be
    // searched, including dependencies; this is more expensive and may return
    // unwanted results.
    //
    "gopls.symbolScope": "all",

    // analyses specify analyses that the user would like to enable or disable.
    // A map of the names of analysis passes that should be enabled/disabled.
    // A full list of analyzers that gopls uses can be found in
    // [analyzers.md](https://github.com/golang/tools/blob/master/gopls/doc/analyzers.md).
    //
    // Example Usage:
    //
    // ```json5
    // ...
    // "analyses": {
    //   "unreachable": false, // Disable the unreachable analyzer.
    //   "unusedvariable": true  // Enable the unusedvariable analyzer.
    // }
    // ...
    // ```
    //
    "gopls.analyses": {},

    // (experimental) staticcheck enables additional analyses from staticcheck.io.
    // These analyses are documented on
    // [Staticcheck's website](https://staticcheck.io/docs/checks/).
    //
    "gopls.staticcheck": false,

    // (experimental) annotations specifies the various kinds of optimization diagnostics
    // that should be reported by the gc_details command.
    //
    "gopls.annotations": {
      "bounds": true,
      "escape": true,
      "inline": true,
      "nil": true
    },

    // (experimental) vulncheck enables vulnerability scanning.
    //
    "gopls.vulncheck": "Off",

    // (advanced) diagnosticsDelay controls the amount of time that gopls waits
    // after the most recent file modification before computing deep diagnostics.
    // Simple diagnostics (parsing and type-checking) are always run immediately
    // on recently modified packages.
    //
    // This option must be set to a valid duration string, for example `"250ms"`.
    //
    "gopls.diagnosticsDelay": "1s",

    // (experimental) diagnosticsTrigger controls when to run diagnostics.
    //
    "gopls.diagnosticsTrigger": "Edit",

    // analysisProgressReporting controls whether gopls sends progress
    // notifications when construction of its index of analysis facts is taking a
    // long time. Cancelling these notifications will cancel the indexing task,
    // though it will restart after the next change in the workspace.
    //
    // When a package is opened for the first time and heavyweight analyses such as
    // staticcheck are enabled, it can take a while to construct the index of
    // analysis facts for all its dependencies. The index is cached in the
    // filesystem, so subsequent analysis should be faster.
    //
    "gopls.analysisProgressReporting": true,

    // (experimental) hints specify inlay hints that users want to see. A full list of hints
    // that gopls uses can be found in
    // [inlayHints.md](https://github.com/golang/tools/blob/master/gopls/doc/inlayHints.md).
    //
    "gopls.hints": {},

    // codelenses overrides the enabled/disabled state of code lenses. See the
    // "Code Lenses" section of the
    // [Settings page](https://github.com/golang/tools/blob/master/gopls/doc/settings.md#code-lenses)
    // for the list of supported lenses.
    //
    // Example Usage:
    //
    // ```json5
    // "gopls": {
    // ...
    //   "codelenses": {
    //     "generate": false,  // Don't show the `go generate` lens.
    //     "gc_details": true  // Show a code lens toggling the display of gc's choices.
    //   }
    // ...
    // }
    // ```
    //
    "gopls.codelenses": {
      "gc_details": false,
      "generate": true,
      "regenerate_cgo": true,
      "tidy": true,
      "upgrade_dependency": true,
      "vendor": true
    },

    // (experimental) semanticTokens controls whether the LSP server will send
    // semantic tokens to the client.
    //
    "gopls.semanticTokens": false,

    // (experimental) noSemanticString turns off the sending of the semantic token 'string'
    //
    "gopls.noSemanticString": false,

    // (experimental) noSemanticNumber  turns off the sending of the semantic token 'number'
    //
    "gopls.noSemanticNumber": false,

    // local is the equivalent of the `goimports -local` flag, which puts
    // imports beginning with this string after third-party packages. It should
    // be the prefix of the import path whose imports should be grouped
    // separately.
    //
    "gopls.local": "",

    // gofumpt indicates if we should run gofumpt formatting.
    //
    "gopls.gofumpt": false,

    // (debug) verboseOutput enables additional debug logging.
    //
    "gopls.verboseOutput": true,
  }
}
alvarolm commented 7 months ago

Here is the source code: testSource.zip

I have removed all configurations and started with a new installation, same versions as before, this is the output of LSP Log Panel:

:: [10:41:40.593] --> gopls initialize (1): {'processId': 8092, 'workspaceFolders': [{'uri': 'file:///home/alvarolm/Desktop/1948gen', 'name': '1948gen'}], 'rootUri': 'file:///home/alvarolm/Desktop/1948gen', 'capabilities': {'textDocument': {'synchronization': {'willSaveWaitUntil': True, 'dynamicRegistration': True, 'willSave': True, 'didSave': True}, 'completion': {'completionItemKind': {'valueSet': [2, 6, 11, 17, 10, 14, 4, 22, 24, 7, 19, 1, 18, 16, 21, 5, 8, 15, 20, 3, 9, 13, 12, 23, 25]}, 'insertTextMode': 2, 'dynamicRegistration': True, 'completionItem': {'insertTextModeSupport': {'valueSet': [2]}, 'deprecatedSupport': True, 'snippetSupport': True, 'labelDetailsSupport': True, 'resolveSupport': {'properties': ['detail', 'documentation', 'additionalTextEdits']}, 'tagSupport': {'valueSet': [1]}, 'documentationFormat': ['markdown', 'plaintext'], 'insertReplaceSupport': True}, 'completionList': {'itemDefaults': ['editRange', 'insertTextFormat', 'data']}}, 'semanticTokens': {'augmentsSyntaxTokens': True, 'formats': ['relative'], 'overlappingTokenSupport': False, 'requests': {'full': {'delta': True}, 'range': True}, 'tokenTypes': ['method', 'variable', 'class', 'function', 'parameter', 'type', 'struct', 'operator', 'property', 'comment', 'regexp', 'decorator', 'modifier', 'namespace', 'typeParameter', 'interface', 'enum', 'string', 'macro', 'enumMember', 'keyword', 'event', 'number'], 'multilineTokenSupport': True, 'dynamicRegistration': True, 'tokenModifiers': ['deprecated', 'static', 'abstract', 'readonly', 'documentation', 'declaration', 'defaultLibrary', 'async', 'definition', 'modification']}, 'typeDefinition': {'dynamicRegistration': True, 'linkSupport': True}, 'definition': {'dynamicRegistration': True, 'linkSupport': True}, 'callHierarchy': {'dynamicRegistration': True}, 'typeHierarchy': {'dynamicRegistration': True}, 'diagnostic': {'dynamicRegistration': True, 'relatedDocumentSupport': True}, 'hover': {'dynamicRegistration': True, 'contentFormat': ['markdown', 'plaintext']}, 'foldingRange': {'dynamicRegistration': True, 'foldingRangeKind': {'valueSet': ['comment', 'imports', 'region']}}, 'publishDiagnostics': {'versionSupport': True, 'tagSupport': {'valueSet': [2, 1]}, 'relatedInformation': True, 'codeDescriptionSupport': True, 'dataSupport': True}, 'documentLink': {'dynamicRegistration': True, 'tooltipSupport': True}, 'signatureHelp': {'dynamicRegistration': True, 'contextSupport': True, 'signatureInformation': {'parameterInformation': {'labelOffsetSupport': True}, 'activeParameterSupport': True, 'documentationFormat': ['markdown', 'plaintext']}}, 'documentHighlight': {'dynamicRegistration': True}, 'documentSymbol': {'hierarchicalDocumentSymbolSupport': True, 'dynamicRegistration': True, 'symbolKind': {'valueSet': [6, 13, 7, 4, 21, 9, 23, 20, 19, 18, 3, 24, 1, 14, 8, 11, 17, 10, 16, 2, 22, 25, 12, 5, 15, 26]}, 'tagSupport': {'valueSet': [1]}}, 'selectionRange': {'dynamicRegistration': True}, 'rangeFormatting': {'dynamicRegistration': True, 'rangesSupport': True}, 'inlayHint': {'resolveSupport': {'properties': ['textEdits', 'label.command']}, 'dynamicRegistration': True}, 'declaration': {'dynamicRegistration': True, 'linkSupport': True}, 'formatting': {'dynamicRegistration': True}, 'implementation': {'dynamicRegistration': True, 'linkSupport': True}, 'codeAction': {'resolveSupport': {'properties': ['edit']}, 'isPreferredSupport': True, 'dynamicRegistration': True, 'codeActionLiteralSupport': {'codeActionKind': {'valueSet': ['quickfix', 'refactor', 'refactor.extract', 'refactor.inline', 'refactor.rewrite', 'source.fixAll', 'source.organizeImports']}}, 'dataSupport': True}, 'rename': {'prepareSupportDefaultBehavior': 1, 'dynamicRegistration': True, 'prepareSupport': True}, 'codeLens': {'dynamicRegistration': True}, 'colorProvider': {'dynamicRegistration': True}, 'references': {'dynamicRegistration': True}}, 'general': {'markdown': {'parser': 'Python-Markdown', 'version': '3.2.2'}, 'regularExpressions': {'engine': 'ECMAScript'}}, 'window': {'workDoneProgress': True, 'showMessage': {'messageActionItem': {'additionalPropertiesSupport': True}}, 'showDocument': {'support': True}}, 'workspace': {'diagnostics': {'refreshSupport': True}, 'workspaceFolders': True, 'inlayHint': {'refreshSupport': True}, 'symbol': {'resolveSupport': {'properties': ['location.range']}, 'dynamicRegistration': True, 'symbolKind': {'valueSet': [6, 13, 7, 4, 21, 9, 23, 20, 19, 18, 3, 24, 1, 14, 8, 11, 17, 10, 16, 2, 22, 25, 12, 5, 15, 26]}, 'tagSupport': {'valueSet': [1]}}, 'applyEdit': True, 'executeCommand': {}, 'didChangeConfiguration': {'dynamicRegistration': True}, 'semanticTokens': {'refreshSupport': True}, 'codeLens': {'refreshSupport': True}, 'configuration': True, 'workspaceEdit': {'failureHandling': 'abort', 'documentChanges': True}}}, 'rootPath': '/home/alvarolm/Desktop/1948gen', 'clientInfo': {'name': 'Sublime Text LSP', 'version': '1.29.0'}, 'initializationOptions': {}}
:: [10:41:40.666] <<< gopls (1) (duration: 73ms): {'serverInfo': {'name': 'gopls', 'version': '{"GoVersion":"go1.21.6","Path":"golang.org/x/tools/gopls","Main":{"Path":"golang.org/x/tools/gopls","Version":"v0.15.0","Sum":"h1:L0GwEHBsOERhkmi9E2Ag0xjAY7exrFsiKhQLX7mBJjM=","Replace":null},"Deps":[{"Path":"github.com/BurntSushi/toml","Version":"v1.2.1","Sum":"h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=","Replace":null},{"Path":"github.com/google/go-cmp","Version":"v0.6.0","Sum":"h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=","Replace":null},{"Path":"golang.org/x/exp/typeparams","Version":"v0.0.0-20221212164502-fae10dda9338","Sum":"h1:2O2DON6y3XMJiQRAS1UWU+54aec2uopH3x7MAiqGW6Y=","Replace":null},{"Path":"golang.org/x/mod","Version":"v0.15.0","Sum":"h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8=","Replace":null},{"Path":"golang.org/x/sync","Version":"v0.6.0","Sum":"h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=","Replace":null},{"Path":"golang.org/x/telemetry","Version":"v0.0.0-20240209200032-7b892fcb8a78","Sum":"h1:vcVnuftN4J4UKLRcgetjzfU9FjjgXUUYUc3JhFplgV4=","Replace":null},{"Path":"golang.org/x/text","Version":"v0.14.0","Sum":"h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=","Replace":null},{"Path":"golang.org/x/tools","Version":"v0.18.1-0.20240221145400-a220b3b5ba60","Sum":"h1:2rj0Wb7+TXMtGEN3h6rrHno/8PmOJ/FVkLLTQSZeo4I=","Replace":null},{"Path":"golang.org/x/vuln","Version":"v1.0.1","Sum":"h1:KUas02EjQK5LTuIx1OylBQdKKZ9jeugs+HiqO5HormU=","Replace":null},{"Path":"honnef.co/go/tools","Version":"v0.4.6","Sum":"h1:oFEHCKeID7to/3autwsWfnuv69j3NsfcXbvJKuIcep8=","Replace":null},{"Path":"mvdan.cc/gofumpt","Version":"v0.6.0","Sum":"h1:G3QvahNDmpD+Aek/bNOLrFR2XC6ZAdo62dZu65gmwGo=","Replace":null},{"Path":"mvdan.cc/xurls/v2","Version":"v2.5.0","Sum":"h1:lyBNOm8Wo71UknhUs4QTFUNNMyxy2JEIaKKo0RWOh+8=","Replace":null}],"Settings":[{"Key":"-buildmode","Value":"exe"},{"Key":"-compiler","Value":"gc"},{"Key":"DefaultGODEBUG","Value":"panicnil=1"},{"Key":"CGO_ENABLED","Value":"1"},{"Key":"CGO_CFLAGS","Value":""},{"Key":"CGO_CPPFLAGS","Value":""},{"Key":"CGO_CXXFLAGS","Value":""},{"Key":"CGO_LDFLAGS","Value":""},{"Key":"GOARCH","Value":"amd64"},{"Key":"GOOS","Value":"linux"},{"Key":"GOAMD64","Value":"v1"}],"Version":"v0.15.0"}'}, 'capabilities': {'textDocumentSync': {'save': {}, 'didOpen': {}, 'didClose': {}, 'change': {'syncKind': 2}}, 'inlayHintProvider': {}, 'executeCommandProvider': {'commands': ['gopls.add_dependency', 'gopls.add_import', 'gopls.add_telemetry_counters', 'gopls.apply_fix', 'gopls.change_signature', 'gopls.check_upgrades', 'gopls.diagnose_files', 'gopls.edit_go_directive', 'gopls.fetch_vulncheck_result', 'gopls.gc_details', 'gopls.generate', 'gopls.go_get_package', 'gopls.list_imports', 'gopls.list_known_packages', 'gopls.maybe_prompt_for_telemetry', 'gopls.mem_stats', 'gopls.regenerate_cgo', 'gopls.remove_dependency', 'gopls.reset_go_mod_diagnostics', 'gopls.run_go_work_command', 'gopls.run_govulncheck', 'gopls.run_tests', 'gopls.start_debugging', 'gopls.start_profile', 'gopls.stop_profile', 'gopls.test', 'gopls.tidy', 'gopls.toggle_gc_details', 'gopls.update_go_sum', 'gopls.upgrade_dependency', 'gopls.vendor', 'gopls.views', 'gopls.workspace_stats']}, 'documentFormattingProvider': True, 'renameProvider': {'prepareProvider': True}, 'documentSymbolProvider': True, 'foldingRangeProvider': True, 'typeDefinitionProvider': True, 'codeActionProvider': {'codeActionKinds': ['quickfix', 'refactor.extract', 'refactor.inline', 'refactor.rewrite', 'source.fixAll', 'source.organizeImports'], 'resolveProvider': True}, 'semanticTokensProvider': {'full': True, 'legend': {'tokenModifiers': ['deprecated', 'static', 'abstract', 'readonly', 'documentation', 'declaration', 'defaultLibrary', 'async', 'definition', 'modification'], 'tokenTypes': ['method', 'variable', 'class', 'function', 'parameter', 'type', 'struct', 'operator', 'property', 'comment', 'regexp', 'decorator', 'modifier', 'namespace', 'typeParameter', 'interface', 'enum', 'string', 'macro', 'enumMember', 'keyword', 'event', 'number']}, 'range': True}, 'definitionProvider': True, 'documentLinkProvider': {}, 'signatureHelpProvider': {'triggerCharacters': ['(', ',']}, 'workspace': {'workspaceFolders': {'changeNotifications': 'workspace/didChangeWorkspaceFolders', 'supported': True}}, 'referencesProvider': True, 'callHierarchyProvider': True, 'implementationProvider': True, 'codeLensProvider': {}, 'completionProvider': {'triggerCharacters': ['.']}, 'hoverProvider': True, 'documentHighlightProvider': True, 'workspaceSymbolProvider': True, 'selectionRangeProvider': True}}
:: [10:41:40.666]  -> gopls initialized: {}
:: [10:41:40.668]  -> gopls workspace/didChangeConfiguration: {'settings': {'manageGoplsBinary': True, 'runTestsInPanel': True, 'gopls': {'buildFlags': [], 'expandWorkspaceToModule': True, 'vulncheck': 'Off', 'allowImplicitNetworkAccess': False, 'usePlaceholders': False, 'linkTarget': 'pkg.go.dev', 'standaloneTags': ['ignore'], 'annotations': {'escape': True, 'bounds': True, 'nil': True, 'inline': True}, 'diagnosticsDelay': '1s', 'matcher': 'Fuzzy', 'local': '', 'codelenses': {'vendor': True, 'gc_details': False, 'tidy': True, 'generate': True, 'upgrade_dependency': True, 'regenerate_cgo': True}, 'diagnosticsTrigger': 'Edit', 'noSemanticNumber': False, 'completeFunctionCalls': True, 'analyses': {}, 'symbolScope': 'all', 'experimentalPostfixCompletions': True, 'staticcheck': False, 'allowModfileModifications': False, 'linksInHover': True, 'templateExtensions': [], 'symbolStyle': 'Dynamic', 'completionBudget': '100ms', 'env': {}, 'hoverKind': 'FullDocumentation', 'verboseOutput': False, 'analysisProgressReporting': True, 'directoryFilters': ['-**/node_modules'], 'importShortcut': 'Both', 'memoryMode': '', 'hints': {}, 'semanticTokens': False, 'gofumpt': False, 'symbolMatcher': 'FastFuzzy', 'noSemanticString': False}, 'closeTestResultsWhenFinished': False}}
:: [10:41:40.669] <-- gopls window/workDoneProgress/create (1): {'token': '4128902986973328157'}
:: [10:41:40.669] >>> gopls (1) (duration: 0ms): None
:: [10:41:40.682]  -> gopls textDocument/didOpen: {'textDocument': {'uri': 'file:///home/alvarolm/Desktop/1948gen/main.go', 'text': 'package main\n\nimport (\n\t"log"\n)\n\nvar s = 0\n\nfunc main() {\n\tlog.Println("hello!", s)\n}\n', 'languageId': 'go', 'version': 0}}
:: [10:41:40.696] --> gopls textDocument/documentLink (2): {'textDocument': {'uri': 'file:///home/alvarolm/Desktop/1948gen/main.go'}}
:: [10:41:40.700] --> gopls textDocument/codeLens (3): {'textDocument': {'uri': 'file:///home/alvarolm/Desktop/1948gen/main.go'}}
:: [10:41:40.703] <-  gopls $/progress: {'value': {'kind': 'begin', 'title': 'Setting up workspace', 'message': 'Loading packages...'}, 'token': '4128902986973328157'}
:: [10:41:40.706] <-- gopls workspace/configuration (2): {'items': [{'scopeUri': 'file:///home/alvarolm/Desktop/1948gen', 'section': 'gopls'}]}
:: [10:41:40.708] >>> gopls (2) (duration: 1ms): [{'buildFlags': [], 'expandWorkspaceToModule': True, 'vulncheck': 'Off', 'allowImplicitNetworkAccess': False, 'usePlaceholders': False, 'linkTarget': 'pkg.go.dev', 'standaloneTags': ['ignore'], 'annotations': {'escape': True, 'bounds': True, 'nil': True, 'inline': True}, 'diagnosticsDelay': '1s', 'matcher': 'Fuzzy', 'local': '', 'codelenses': {'vendor': True, 'gc_details': False, 'tidy': True, 'generate': True, 'upgrade_dependency': True, 'regenerate_cgo': True}, 'diagnosticsTrigger': 'Edit', 'noSemanticNumber': False, 'completeFunctionCalls': True, 'analyses': {}, 'symbolScope': 'all', 'experimentalPostfixCompletions': True, 'staticcheck': False, 'allowModfileModifications': False, 'linksInHover': True, 'templateExtensions': [], 'symbolStyle': 'Dynamic', 'completionBudget': '100ms', 'env': {}, 'hoverKind': 'FullDocumentation', 'verboseOutput': False, 'analysisProgressReporting': True, 'directoryFilters': ['-**/node_modules'], 'importShortcut': 'Both', 'memoryMode': '', 'hints': {}, 'semanticTokens': False, 'gofumpt': False, 'symbolMatcher': 'FastFuzzy', 'noSemanticString': False}]
:: [10:41:40.709] <-  gopls window/showMessage: {'message': 'Invalid settings: gopls setting "allowModfileModifications" is deprecated.\nPlease comment on https://go.dev/issue/65546 if this impacts your workflow.; gopls setting "memoryMode" is deprecated', 'type': 2}
gopls: 2024/03/19 10:41:40 go info for /home/alvarolm/Desktop/1948gen
(view type GoModView)
(root dir /home/alvarolm/Desktop/1948gen)
(go version go version go1.22.1 linux/amd64)
(build flags: [])
(go env: {GOOS:linux GOARCH:amd64 GOCACHE:/home/alvarolm/.cache/go-build GOMODCACHE:/home/alvarolm/dev/assets/go/pkg/mod GOPATH:/home/alvarolm/dev/assets/go GOPRIVATE: GOFLAGS: GO111MODULE: GoVersion:22 GoVersionOutput:go version go1.22.1 linux/amd64
 GOWORK: GOPACKAGESDRIVER:})
(env overlay: map[])

:: [10:41:40.730] <-  gopls window/logMessage: {'message': '2024/03/19 10:41:40 go info for /home/alvarolm/Desktop/1948gen\n(view type GoModView)\n(root dir /home/alvarolm/Desktop/1948gen)\n(go version go version go1.22.1 linux/amd64)\n(build flags: [])\n(go env: {GOOS:linux GOARCH:amd64 GOCACHE:/home/alvarolm/.cache/go-build GOMODCACHE:/home/alvarolm/dev/assets/go/pkg/mod GOPATH:/home/alvarolm/dev/assets/go GOPRIVATE: GOFLAGS: GO111MODULE: GoVersion:22 GoVersionOutput:go version go1.22.1 linux/amd64\n GOWORK: GOPACKAGESDRIVER:})\n(env overlay: map[])\n\n', 'type': 3}
gopls: 2024/03/19 10:41:40 go/packages.Load #1
    snapshot=0
    directory=file:///home/alvarolm/Desktop/1948gen
    query=[/home/alvarolm/Desktop/1948gen/... builtin]
    packages=2

:: [10:41:40.874] <-  gopls window/logMessage: {'message': '2024/03/19 10:41:40 go/packages.Load #1\n\tsnapshot=0\n\tdirectory=file:///home/alvarolm/Desktop/1948gen\n\tquery=[/home/alvarolm/Desktop/1948gen/... builtin]\n\tpackages=2\n', 'type': 3}
gopls: 2024/03/19 10:41:40 go/packages.Load #1: updating metadata for 48 packages

:: [10:41:40.877] <-  gopls window/logMessage: {'message': '2024/03/19 10:41:40 go/packages.Load #1: updating metadata for 48 packages\n', 'type': 3}
:: [10:41:40.913] <-  gopls $/progress: {'value': {'kind': 'end', 'message': 'Finished loading packages.'}, 'token': '4128902986973328157'}
:: [10:41:40.914] <-- gopls client/registerCapability (3): {'registrations': [{'method': 'workspace/didChangeConfiguration', 'id': 'workspace/didChangeConfiguration'}]}
:: [10:41:40.914] >>> gopls (3) (duration: 0ms): None
:: [10:41:40.918] <-- gopls workspace/configuration (4): {'items': [{'section': 'gopls'}]}
:: [10:41:40.928] >>> gopls (4) (duration: 9ms): [{'buildFlags': [], 'expandWorkspaceToModule': True, 'vulncheck': 'Off', 'allowImplicitNetworkAccess': False, 'usePlaceholders': False, 'linkTarget': 'pkg.go.dev', 'standaloneTags': ['ignore'], 'annotations': {'escape': True, 'bounds': True, 'nil': True, 'inline': True}, 'diagnosticsDelay': '1s', 'matcher': 'Fuzzy', 'local': '', 'codelenses': {'vendor': True, 'gc_details': False, 'tidy': True, 'generate': True, 'upgrade_dependency': True, 'regenerate_cgo': True}, 'diagnosticsTrigger': 'Edit', 'noSemanticNumber': False, 'completeFunctionCalls': True, 'analyses': {}, 'symbolScope': 'all', 'experimentalPostfixCompletions': True, 'staticcheck': False, 'allowModfileModifications': False, 'linksInHover': True, 'templateExtensions': [], 'symbolStyle': 'Dynamic', 'completionBudget': '100ms', 'env': {}, 'hoverKind': 'FullDocumentation', 'verboseOutput': False, 'analysisProgressReporting': True, 'directoryFilters': ['-**/node_modules'], 'importShortcut': 'Both', 'memoryMode': '', 'hints': {}, 'semanticTokens': False, 'gofumpt': False, 'symbolMatcher': 'FastFuzzy', 'noSemanticString': False}]
:: [10:41:40.932] <-  gopls window/showMessage: {'message': 'Invalid settings: gopls setting "allowModfileModifications" is deprecated.\nPlease comment on https://go.dev/issue/65546 if this impacts your workflow.; gopls setting "memoryMode" is deprecated', 'type': 2}
:: [10:41:40.932] <-- gopls workspace/configuration (5): {'items': [{'scopeUri': 'file:///home/alvarolm/Desktop/1948gen', 'section': 'gopls'}]}
:: [10:41:40.945] >>> gopls (5) (duration: 12ms): [{'buildFlags': [], 'expandWorkspaceToModule': True, 'vulncheck': 'Off', 'allowImplicitNetworkAccess': False, 'usePlaceholders': False, 'linkTarget': 'pkg.go.dev', 'standaloneTags': ['ignore'], 'annotations': {'escape': True, 'bounds': True, 'nil': True, 'inline': True}, 'diagnosticsDelay': '1s', 'matcher': 'Fuzzy', 'local': '', 'codelenses': {'vendor': True, 'gc_details': False, 'tidy': True, 'generate': True, 'upgrade_dependency': True, 'regenerate_cgo': True}, 'diagnosticsTrigger': 'Edit', 'noSemanticNumber': False, 'completeFunctionCalls': True, 'analyses': {}, 'symbolScope': 'all', 'experimentalPostfixCompletions': True, 'staticcheck': False, 'allowModfileModifications': False, 'linksInHover': True, 'templateExtensions': [], 'symbolStyle': 'Dynamic', 'completionBudget': '100ms', 'env': {}, 'hoverKind': 'FullDocumentation', 'verboseOutput': False, 'analysisProgressReporting': True, 'directoryFilters': ['-**/node_modules'], 'importShortcut': 'Both', 'memoryMode': '', 'hints': {}, 'semanticTokens': False, 'gofumpt': False, 'symbolMatcher': 'FastFuzzy', 'noSemanticString': False}]
:: [10:41:40.947] <-  gopls window/showMessage: {'message': 'Invalid settings: gopls setting "allowModfileModifications" is deprecated.\nPlease comment on https://go.dev/issue/65546 if this impacts your workflow.; gopls setting "memoryMode" is deprecated', 'type': 2}
gopls: 2024/03/19 10:41:40 go info for /home/alvarolm/Desktop/1948gen
(view type GoModView)
(root dir /home/alvarolm/Desktop/1948gen)
(go version go version go1.22.1 linux/amd64)
(build flags: [])
(go env: {GOOS:linux GOARCH:amd64 GOCACHE:/home/alvarolm/.cache/go-build GOMODCACHE:/home/alvarolm/dev/assets/go/pkg/mod GOPATH:/home/alvarolm/dev/assets/go GOPRIVATE: GOFLAGS: GO111MODULE: GoVersion:22 GoVersionOutput:go version go1.22.1 linux/amd64
 GOWORK: GOPACKAGESDRIVER:})
(env overlay: map[])

:: [10:41:40.969] <-  gopls window/logMessage: {'message': '2024/03/19 10:41:40 go info for /home/alvarolm/Desktop/1948gen\n(view type GoModView)\n(root dir /home/alvarolm/Desktop/1948gen)\n(go version go version go1.22.1 linux/amd64)\n(build flags: [])\n(go env: {GOOS:linux GOARCH:amd64 GOCACHE:/home/alvarolm/.cache/go-build GOMODCACHE:/home/alvarolm/dev/assets/go/pkg/mod GOPATH:/home/alvarolm/dev/assets/go GOPRIVATE: GOFLAGS: GO111MODULE: GoVersion:22 GoVersionOutput:go version go1.22.1 linux/amd64\n GOWORK: GOPACKAGESDRIVER:})\n(env overlay: map[])\n\n', 'type': 3}
gopls: 2024/03/19 10:41:41 go/packages.Load #2
    snapshot=0
    directory=file:///home/alvarolm/Desktop/1948gen
    query=[/home/alvarolm/Desktop/1948gen/... builtin]
    packages=2

:: [10:41:41.077] <-  gopls window/logMessage: {'message': '2024/03/19 10:41:41 go/packages.Load #2\n\tsnapshot=0\n\tdirectory=file:///home/alvarolm/Desktop/1948gen\n\tquery=[/home/alvarolm/Desktop/1948gen/... builtin]\n\tpackages=2\n', 'type': 3}
gopls: 2024/03/19 10:41:41 go/packages.Load #2: updating metadata for 48 packages

:: [10:41:41.081] <-  gopls window/logMessage: {'message': '2024/03/19 10:41:41 go/packages.Load #2: updating metadata for 48 packages\n', 'type': 3}
:: [10:41:41.089] <<< gopls (2) (duration: -): [{'target': 'https://pkg.go.dev/log', 'range': {'end': {'line': 3, 'character': 5}, 'start': {'line': 3, 'character': 2}}}]
:: [10:41:41.090] <<< gopls (3) (duration: -): None
:: [10:41:41.131] <-  gopls textDocument/publishDiagnostics: {'uri': 'file:///home/alvarolm/Desktop/1948gen/main.go', 'diagnostics': []}
:: [10:41:48.611] --> gopls textDocument/hover (4): {'textDocument': {'uri': 'file:///home/alvarolm/Desktop/1948gen/main.go'}, 'position': {'line': 9, 'character': 9}}
:: [10:41:48.617] --> gopls textDocument/codeAction (5): {'textDocument': {'uri': 'file:///home/alvarolm/Desktop/1948gen/main.go'}, 'context': {'diagnostics': [], 'triggerKind': 2}, 'range': {'end': {'line': 9, 'character': 9}, 'start': {'line': 9, 'character': 9}}}
:: [10:41:48.619] <<< gopls (4) (duration: 7ms): None
:: [10:41:48.622] <<< gopls (5) (duration: 5ms): None
:: [10:41:55.290] --> gopls textDocument/hover (6): {'textDocument': {'uri': 'file:///home/alvarolm/Desktop/1948gen/main.go'}, 'position': {'line': 9, 'character': 9}}
:: [10:41:55.294] <<< gopls (6) (duration: 4ms): None
:: [10:41:58.964] --> gopls textDocument/hover (7): {'textDocument': {'uri': 'file:///home/alvarolm/Desktop/1948gen/main.go'}, 'position': {'line': 9, 'character': 9}}
:: [10:41:58.967] <<< gopls (7) (duration: 3ms): None

https://github.com/golang/tools/blob/c21ae4cabc44594caf9cbfa867a678ad4a2df387/gopls/internal/golang/implementation.go#L431

TerminalFi commented 7 months ago

I will test your source tonight. My initial gut feeling is this is gopls and not our plugin.

TerminalFi commented 4 months ago

@alvarolm Sorry for the delay. But I can not replicate your issues. This is working as expected for me.

https://github.com/sublimelsp/LSP-gopls/assets/32599364/dbc98ac3-0934-493d-b131-ca45a65bfaaf

alvarolm commented 4 months ago

Currently im working with a fresh installation of debian 12 Now there is an issue with discovering the path, sometimes it works, seems to be pretty random.

I ended up specifying the path in the project settings:

"LSP":
{
    "gopls":
    {
        "env":
        {
            "PATH": "/home/xxxxx/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/xxxxxxx/go/bin:/usr/local/go/bin",
        },
    }
},

there is no issue with any other IDEs like vscode

TerminalFi commented 4 months ago

This is not a plugin issue. That would be a Sublime text issue