sublimelsp / LSP-gopls

Golang support for Sublime's LSP plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to enable inlay hints

wburningham opened this issue · comments

With the v1.1.1 release, inlay hint support was added (I saw an example photo but I'm not sure if that was from a local/custom build). I'm trying to leverage that functionality.

My setup:

Test go file:

package main

func main() {
	r := []string{"foobar"}
	i, j := 0, len(r)-1
	println(i, j)
}

Output from Package control list packages/versions
image

Output from ${storage_path}/LSP-gopls/bin/gopls version

golang.org/x/tools/gopls v0.9.1
    golang.org/x/tools/gopls@v0.9.1 h1:SigsTL4Hpv3a6b/a7oPCLRv5QUeSM6PZNdta1oKY4B0=

Output from troubleshoot LSP server command:

Troubleshooting: gopls

Version

  • LSP: 1.16.3
  • Sublime Text: 4126

Server Test Run

  • exit code: 0
  • output

Server Configuration

  • command
[
  "${storage_path}/LSP-gopls/bin/gopls"
]
  • shell command
"/Users/wesb/Library/Caches/Sublime Text/Package Storage/LSP-gopls/bin/gopls"
  • selector
source.go | source.gomod
  • priority_selector
source.go | source.gomod
  • init_options
{}
  • settings
{
  "closeTestResultsWhenFinished": false, 
  "gopls": {
    "allowImplicitNetworkAccess": false, 
    "allowModfileModifications": false, 
    "analyses": {}, 
    "annotations": {
      "bounds": true, 
      "escape": true, 
      "inline": true, 
      "nil": true
    }, 
    "buildFlags": [], 
    "codelenses": {
      "gc_details": false, 
      "generate": true, 
      "regenerate_cgo": true, 
      "tidy": true, 
      "upgrade_dependency": true, 
      "vendor": true
    }, 
    "completionBudget": "100ms", 
    "diagnosticsDelay": "250ms", 
    "directoryFilters": [
      "-node_modules"
    ], 
    "env": {}, 
    "expandWorkspaceToModule": true, 
    "experimentalPackageCacheKey": true, 
    "experimentalPostfixCompletions": true, 
    "experimentalUseInvalidMetadata": false, 
    "experimentalWatchedFileDelay": "0s", 
    "experimentalWorkspaceModule": false, 
    "gofumpt": true, 
    "hints": {
      "assignVariableTypes": true, 
      "assign_variable_types": true, 
      "compositeLiteralFields": true, 
      "compositeLiteralTypes": true, 
      "composite_literal_fields": true, 
      "composite_literal_types": true, 
      "constantValues": true, 
      "constant_values": true, 
      "functionTypeParameters": true, 
      "function_type_parameters": true, 
      "parameterNames": true, 
      "parameter_names": true, 
      "rangeVariableTypes": true, 
      "range_variable_types": true
    }, 
    "hoverKind": "FullDocumentation", 
    "importShortcut": "Both", 
    "linkTarget": "pkg.go.dev", 
    "linksInHover": true, 
    "local": "", 
    "matcher": "Fuzzy", 
    "memoryMode": "Normal", 
    "semanticTokens": false, 
    "staticcheck": false, 
    "symbolMatcher": "FastFuzzy", 
    "symbolStyle": "Dynamic", 
    "templateExtensions": [], 
    "usePlaceholders": false, 
    "verboseOutput": false
  }, 
  "runTestsInPanel": true
}
  • env
{}

Active view

  • File name
/private/tmp/ttt/main.go
  • Settings
{
  "auto_complete_selector": "meta.tag, source - comment - string.quoted.double.block - string.quoted.single.block - string.unquoted.heredoc", 
  "lsp_active": true, 
  "syntax": "Packages/Go/Go.sublime-syntax"
}
  • base scope
source.go

Project / Workspace

  • folders
[
  "/private/tmp/ttt"
]
  • is project: False

LSP configuration

{
  "clients": {
    "efm-langserver": {
      "command": [
        "/Users/wesb/code/go/bin/efm-langserver"
      ], 
      "enabled": true, 
      "selector": "text.html.markdown | source.css | source.json | source.js | source.jsx | source.yaml | source.groovy"
    }
  }, 
  "log_debug": true, 
  "lsp_code_actions_on_save": {
    "source.organizeImports": true
  }, 
  "lsp_format_on_save": true
}

See sublimelsp/LSP#1746 (comment)

You can see that the primary LSP release still doesn't support inlayHints. If you want a temporary solution, that comment should help you.