swiftlang / sourcekit-lsp

Language Server Protocol implementation for Swift and C-based languages
Apache License 2.0
3.21k stars 264 forks source link

Inlay hint is not displayed in Neovim #757

Closed uhooi closed 1 year ago

uhooi commented 1 year ago

Inlay hint is not displayed in Neovim. Do I need to configure anything?


ahoppen commented 1 year ago

If neovim supports inlay hints they should just work with sourcekit-lsp.

Do inlay hints work with sourcekit-lsp shipped with Xcode 14.3.1? IIRC we haven’t made any changes regarding inlay hints in sourcekit-lsp between these two versions.

ahoppen commented 1 year ago

Tracked in Apple’s issue tracker as rdar://111325382

uhooi commented 1 year ago

Neovim now supports inlay hint. https://github.com/neovim/neovim/pull/23984

Inlay hint do not work with sourcekit-lsp shipped with Xcode 14.3.1.

ahoppen commented 1 year ago

Could you figure out how to get a log of how to get a log of the requests/notifications sent between neovim and sourcekit-lsp? If I’ve got that, I could take a look at it and see if I see anything that might be causing inlay hints not to work.

uhooi commented 1 year ago

:lua print(vim.lsp.get_log_path()) /Users/uhooi/.local/state/nvim/lsp.log

uhooi commented 1 year ago
vim.api.nvim_create_autocmd('LspAttach', {
  group = vim.api.nvim_create_augroup('UserLspConfig', {}),
  callback = function(ev)
    local client = vim.lsp.get_client_by_id(ev.data.client_id)
    if client.name == 'sourcekit' then
      print(vim.inspect(client.supports_method('textDocument/inlayHint')))
    end
  end,
})
false
uhooi commented 1 year ago

@ahoppen Where is the schema file in sourcekit-lsp?

e.g. lua_ls: https://github.com/LuaLS/vscode-lua/blob/35f76105ae481d41c82cbe1ce71d0da7925f2621/setting/schema.json vtsls: https://github.com/yioneko/vtsls/blob/8bae97c5ac278e08c7338b9b2041ab9bcf3f47af/packages/service/configuration.schema.json

uhooi commented 1 year ago

Perhaps this is it. Is there any way to use this in Neovim? https://github.com/swift-server/vscode-swift/blob/67c766d236ea138a2316334b6fb2be8969f9efaa/package.json

uhooi commented 1 year ago

Here is a list of support methods.

vim.api.nvim_create_autocmd('LspAttach', {
  group = vim.api.nvim_create_augroup('UserLspConfig', {}),
  callback = function(ev)
    local client = vim.lsp.get_client_by_id(ev.data.client_id)
    if client.name == 'sourcekit' then
      vim.notify('textDocument/completion: ' .. vim.inspect(client.supports_method('textDocument/completion')))
      vim.notify('textDocument/hover: ' .. vim.inspect(client.supports_method('textDocument/hover')))
      vim.notify('textDocument/signatureHelp: ' .. vim.inspect(client.supports_method('textDocument/signatureHelp')))
      vim.notify('textDocument/declaration: ' .. vim.inspect(client.supports_method('textDocument/declaration')))
      vim.notify('textDocument/definition: ' .. vim.inspect(client.supports_method('textDocument/definition')))
      vim.notify('textDocument/typeDefinition: ' .. vim.inspect(client.supports_method('textDocument/typeDefinition')))
      vim.notify('textDocument/implementation: ' .. vim.inspect(client.supports_method('textDocument/implementation')))
      vim.notify('textDocument/references: ' .. vim.inspect(client.supports_method('textDocument/references')))
      vim.notify(
        'textDocument/documentHighlight: ' .. vim.inspect(client.supports_method('textDocument/documentHighlight'))
      )
      vim.notify('textDocument/documentSymbol: ' .. vim.inspect(client.supports_method('textDocument/documentSymbol')))
      vim.notify('textDocument/codeAction: ' .. vim.inspect(client.supports_method('textDocument/codeAction')))
      vim.notify('textDocument/codeLens: ' .. vim.inspect(client.supports_method('textDocument/codeLens')))
      vim.notify('textDocument/documentLink: ' .. vim.inspect(client.supports_method('textDocument/documentLink')))
      vim.notify('textDocument/documentColor: ' .. vim.inspect(client.supports_method('textDocument/documentColor')))
      vim.notify(
        'textDocument/colorPresentation: ' .. vim.inspect(client.supports_method('textDocument/colorPresentation'))
      )
      vim.notify('textDocument/formatting: ' .. vim.inspect(client.supports_method('textDocument/formatting')))
      vim.notify(
        'textDocument/rangeFormatting: ' .. vim.inspect(client.supports_method('textDocument/rangeFormatting'))
      )
      vim.notify(
        'textDocument/onTypeFormatting: ' .. vim.inspect(client.supports_method('textDocument/onTypeFormatting'))
      )
      vim.notify('textDocument/rename: ' .. vim.inspect(client.supports_method('textDocument/rename')))
      vim.notify(
        'textDocument/publishDiagnostics: ' .. vim.inspect(client.supports_method('textDocument/publishDiagnostics'))
      )
      vim.notify('textDocument/foldingRange: ' .. vim.inspect(client.supports_method('textDocument/foldingRange')))
      vim.notify('textDocument/selectionRange: ' .. vim.inspect(client.supports_method('textDocument/selectionRange')))
      vim.notify(
        'textDocument/linkedEditingRange: ' .. vim.inspect(client.supports_method('textDocument/linkedEditingRange'))
      )
      vim.notify('textDocument/moniker: ' .. vim.inspect(client.supports_method('textDocument/moniker')))
      vim.notify('textDocument/inlineValue: ' .. vim.inspect(client.supports_method('textDocument/inlineValue')))
      vim.notify('textDocument/inlayHint: ' .. vim.inspect(client.supports_method('textDocument/inlayHint')))
      vim.notify('textDocument/didOpen: ' .. vim.inspect(client.supports_method('textDocument/didOpen')))
      vim.notify('textDocument/didChange: ' .. vim.inspect(client.supports_method('textDocument/didChange')))
      vim.notify('textDocument/didClose: ' .. vim.inspect(client.supports_method('textDocument/didClose')))
      vim.notify('textDocument/willSave: ' .. vim.inspect(client.supports_method('textDocument/willSave')))
      vim.notify(
        'textDocument/willSaveWaitUntil: ' .. vim.inspect(client.supports_method('textDocument/willSaveWaitUntil'))
      )
      vim.notify('textDocument/didSave: ' .. vim.inspect(client.supports_method('textDocument/didSave')))
    end
  end,
})
textDocument/completion: true
textDocument/hover: true
textDocument/signatureHelp: false
textDocument/declaration: true
textDocument/definition: true
textDocument/typeDefinition: false
textDocument/implementation: true
textDocument/references: true
textDocument/documentHighlight: true
textDocument/documentSymbol: true
textDocument/codeAction: true
textDocument/codeLens: false
textDocument/documentLink: true
textDocument/documentColor: true
textDocument/colorPresentation: true
textDocument/formatting: false
textDocument/rangeFormatting: false
textDocument/onTypeFormatting: true
textDocument/rename: false
textDocument/publishDiagnostics: true
textDocument/foldingRange: true
textDocument/selectionRange: true
textDocument/linkedEditingRange: true
textDocument/moniker: true
textDocument/inlineValue: true
textDocument/inlayHint: false
textDocument/didOpen: true
textDocument/didChange: true
textDocument/didClose: true
textDocument/willSave: true
textDocument/willSaveWaitUntil: true
textDocument/didSave: true
ahoppen commented 1 year ago

I’m looking for a log that looks something like the following

Log ``` [Trace - 11:10:15 PM] Sending request 'initialize - (0)'. Params: { "processId": 53626, "clientInfo": { "name": "Visual Studio Code", "version": "1.77.3" }, "locale": "en", "rootPath": "/private/tmp/pck", "rootUri": "file:///private/tmp/pck", "capabilities": { "workspace": { "applyEdit": true, "workspaceEdit": { "documentChanges": true, "resourceOperations": [ "create", "rename", "delete" ], "failureHandling": "textOnlyTransactional", "normalizesLineEndings": true, "changeAnnotationSupport": { "groupsOnLabel": true } }, "configuration": true, "didChangeWatchedFiles": { "dynamicRegistration": true, "relativePatternSupport": true }, "symbol": { "dynamicRegistration": true, "symbolKind": { "valueSet": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 ] }, "tagSupport": { "valueSet": [ 1 ] }, "resolveSupport": { "properties": [ "location.range" ] } }, "codeLens": { "refreshSupport": true }, "executeCommand": { "dynamicRegistration": true }, "didChangeConfiguration": { "dynamicRegistration": true }, "workspaceFolders": true, "semanticTokens": { "refreshSupport": true }, "fileOperations": { "dynamicRegistration": true, "didCreate": true, "didRename": true, "didDelete": true, "willCreate": true, "willRename": true, "willDelete": true }, "inlineValue": { "refreshSupport": true }, "inlayHint": { "refreshSupport": true }, "diagnostics": { "refreshSupport": true } }, "textDocument": { "publishDiagnostics": { "relatedInformation": true, "versionSupport": false, "tagSupport": { "valueSet": [ 1, 2 ] }, "codeDescriptionSupport": true, "dataSupport": true }, "synchronization": { "dynamicRegistration": true, "willSave": true, "willSaveWaitUntil": true, "didSave": true }, "completion": { "dynamicRegistration": true, "contextSupport": true, "completionItem": { "snippetSupport": true, "commitCharactersSupport": true, "documentationFormat": [ "markdown", "plaintext" ], "deprecatedSupport": true, "preselectSupport": true, "tagSupport": { "valueSet": [ 1 ] }, "insertReplaceSupport": true, "resolveSupport": { "properties": [ "documentation", "detail", "additionalTextEdits" ] }, "insertTextModeSupport": { "valueSet": [ 1, 2 ] }, "labelDetailsSupport": true }, "insertTextMode": 2, "completionItemKind": { "valueSet": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 ] }, "completionList": { "itemDefaults": [ "commitCharacters", "editRange", "insertTextFormat", "insertTextMode" ] } }, "hover": { "dynamicRegistration": true, "contentFormat": [ "markdown", "plaintext" ] }, "signatureHelp": { "dynamicRegistration": true, "signatureInformation": { "documentationFormat": [ "markdown", "plaintext" ], "parameterInformation": { "labelOffsetSupport": true }, "activeParameterSupport": true }, "contextSupport": true }, "definition": { "dynamicRegistration": true, "linkSupport": true }, "references": { "dynamicRegistration": true }, "documentHighlight": { "dynamicRegistration": true }, "documentSymbol": { "dynamicRegistration": true, "symbolKind": { "valueSet": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 ] }, "hierarchicalDocumentSymbolSupport": true, "tagSupport": { "valueSet": [ 1 ] }, "labelSupport": true }, "codeAction": { "dynamicRegistration": true, "isPreferredSupport": true, "disabledSupport": true, "dataSupport": true, "resolveSupport": { "properties": [ "edit" ] }, "codeActionLiteralSupport": { "codeActionKind": { "valueSet": [ "", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" ] } }, "honorsChangeAnnotations": false }, "codeLens": { "dynamicRegistration": true }, "formatting": { "dynamicRegistration": true }, "rangeFormatting": { "dynamicRegistration": true }, "onTypeFormatting": { "dynamicRegistration": true }, "rename": { "dynamicRegistration": true, "prepareSupport": true, "prepareSupportDefaultBehavior": 1, "honorsChangeAnnotations": true }, "documentLink": { "dynamicRegistration": true, "tooltipSupport": true }, "typeDefinition": { "dynamicRegistration": true, "linkSupport": true }, "implementation": { "dynamicRegistration": true, "linkSupport": true }, "colorProvider": { "dynamicRegistration": true }, "foldingRange": { "dynamicRegistration": true, "rangeLimit": 5000, "lineFoldingOnly": true, "foldingRangeKind": { "valueSet": [ "comment", "imports", "region" ] }, "foldingRange": { "collapsedText": false } }, "declaration": { "dynamicRegistration": true, "linkSupport": true }, "selectionRange": { "dynamicRegistration": true }, "callHierarchy": { "dynamicRegistration": true }, "semanticTokens": { "dynamicRegistration": true, "tokenTypes": [ "namespace", "type", "class", "enum", "interface", "struct", "typeParameter", "parameter", "variable", "property", "enumMember", "event", "function", "method", "macro", "keyword", "modifier", "comment", "string", "number", "regexp", "operator", "decorator" ], "tokenModifiers": [ "declaration", "definition", "readonly", "static", "deprecated", "abstract", "async", "modification", "documentation", "defaultLibrary" ], "formats": [ "relative" ], "requests": { "range": true, "full": { "delta": true } }, "multilineTokenSupport": false, "overlappingTokenSupport": false, "serverCancelSupport": true, "augmentsSyntaxTokens": true }, "linkedEditingRange": { "dynamicRegistration": true }, "typeHierarchy": { "dynamicRegistration": true }, "inlineValue": { "dynamicRegistration": true }, "inlayHint": { "dynamicRegistration": true, "resolveSupport": { "properties": [ "tooltip", "textEdits", "label.tooltip", "label.location", "label.command" ] } }, "diagnostic": { "dynamicRegistration": true, "relatedDocumentSupport": false } }, "window": { "showMessage": { "messageActionItem": { "additionalPropertiesSupport": true } }, "showDocument": { "support": true }, "workDoneProgress": true }, "general": { "staleRequestSupport": { "cancel": true, "retryOnContentModified": [ "textDocument/semanticTokens/full", "textDocument/semanticTokens/range", "textDocument/semanticTokens/full/delta" ] }, "regularExpressions": { "engine": "ECMAScript", "version": "ES2020" }, "markdown": { "parser": "marked", "version": "1.1.0" }, "positionEncodings": [ "utf-16" ] }, "notebookDocument": { "synchronization": { "dynamicRegistration": true, "executionSummarySupport": true } } }, "trace": "verbose", "workspaceFolders": [ { "uri": "file:///private/tmp/pck", "name": "pck" } ] } [Trace - 11:10:16 PM] Received response 'initialize - (0)' in 836ms. Result: { "capabilities": { "textDocumentSync": { "save": { "includeText": false }, "willSaveWaitUntil": false, "change": 2, "willSave": true, "openClose": true }, "implementationProvider": true, "hoverProvider": true, "typeHierarchyProvider": true, "foldingRangeProvider": false, "referencesProvider": true, "colorProvider": true, "definitionProvider": true, "callHierarchyProvider": true, "codeActionProvider": {}, "documentSymbolProvider": true, "workspace": { "workspaceFolders": { "supported": true, "changeNotifications": true } }, "workspaceSymbolProvider": true, "documentHighlightProvider": true, "declarationProvider": true } } [Trace - 11:10:16 PM] Sending notification 'initialized'. Params: {} [Trace - 11:10:16 PM] Sending notification 'textDocument/didOpen'. Params: { "textDocument": { "uri": "file:///private/tmp/pck/Sources/pck/pck.swift", "languageId": "swift", "version": 1, "text": "// The Swift Programming Language\n// https://docs.swift.org/swift-book\nfunc foo() {\n print(\"x\")\n}" } } [Trace - 11:10:16 PM] Sending request 'textDocument/documentSymbol - (1)'. Params: { "textDocument": { "uri": "file:///private/tmp/pck/Sources/pck/pck.swift" } } ```
uhooi commented 1 year ago

I set the log level to 'TRACE' and was able to output.

:lua vim.lsp.set_log_level('TRACE')
Log ``` [TRACE][2023-06-27 11:28:36] .../lua/vim/lsp.lua:1411 "LSP[sourcekit]" "initialize_params" { capabilities = { general = { positionEncodings = { "utf-16" } }, textDocument = { callHierarchy = { dynamicRegistration = false }, codeAction = { codeActionLiteralSupport = { codeActionKind = { valueSet = { "", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" } } }, dataSupport = true, dynamicRegistration = true, isPreferredSupport = true, resolveSupport = { properties = { "edit" } } }, completion = { completionItem = { commitCharactersSupport = false, deprecatedSupport = false, documentationFormat = { "markdown", "plaintext" }, preselectSupport = false, snippetSupport = false }, completionItemKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 } }, contextSupport = false, dynamicRegistration = false }, declaration = { linkSupport = true }, definition = { dynamicRegistration = true, linkSupport = true }, documentHighlight = { dynamicRegistration = false }, documentSymbol = { dynamicRegistration = false, hierarchicalDocumentSymbolSupport = true, symbolKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 } } }, formatting = { dynamicRegistration = true }, hover = { contentFormat = { "markdown", "plaintext" }, dynamicRegistration = true }, implementation = { linkSupport = true }, inlayHint = { dynamicRegistration = true, resolveSupport = { properties = {} } }, publishDiagnostics = { relatedInformation = true, tagSupport = { valueSet = { 1, 2 } } }, rangeFormatting = { dynamicRegistration = true }, references = { dynamicRegistration = false }, rename = { dynamicRegistration = true, prepareSupport = true }, semanticTokens = { augmentsSyntaxTokens = true, dynamicRegistration = false, formats = { "relative" }, multilineTokenSupport = false, overlappingTokenSupport = true, requests = { full = { delta = true }, range = false }, serverCancelSupport = false, tokenModifiers = { "declaration", "definition", "readonly", "static", "deprecated", "abstract", "async", "modification", "documentation", "defaultLibrary" }, tokenTypes = { "namespace", "type", "class", "enum", "interface", "struct", "typeParameter", "parameter", "variable", "property", "enumMember", "event", "function", "method", "macro", "keyword", "modifier", "comment", "string", "number", "regexp", "operator", "decorator" } }, signatureHelp = { dynamicRegistration = false, signatureInformation = { activeParameterSupport = true, documentationFormat = { "markdown", "plaintext" }, parameterInformation = { labelOffsetSupport = true } } }, synchronization = { didSave = true, dynamicRegistration = false, willSave = true, willSaveWaitUntil = true }, typeDefinition = { linkSupport = true } }, window = { showDocument = { support = true }, showMessage = { messageActionItem = { additionalPropertiesSupport = false } }, workDoneProgress = true }, workspace = { applyEdit = true, configuration = true, didChangeWatchedFiles = { dynamicRegistration = true, relativePatternSupport = true }, inlayHint = { enabled = true, refreshSupport = true }, semanticTokens = { refreshSupport = true }, symbol = { dynamicRegistration = false, hierarchicalWorkspaceSymbolSupport = true, symbolKind = { valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 } } }, workspaceEdit = { resourceOperations = { "rename", "create", "delete" } }, workspaceFolders = true } }, clientInfo = { name = "Neovim", version = "0.10.0-dev+g91aeaeef6" }, initializationOptions = vim.empty_dict(), processId = 53007, rootPath = "/Users/uhooi/ghq/github.com/uhooi/Loki/LokiPackage", rootUri = "file:///Users/uhooi/ghq/github.com/uhooi/Loki/LokiPackage", trace = "off", workspaceFolders = { { name = "/Users/uhooi/ghq/github.com/uhooi/Loki/LokiPackage", uri = "file:///Users/uhooi/ghq/github.com/uhooi/Loki/LokiPackage" } } } ```
ahoppen commented 1 year ago

Yes, that’s the log. Could you enable logging, open a file, wait a minute or so, perform an edit and attach the log from that? I would like to see if neovim sends a request for inlayHints and what SourceKit-LSP replies with.

uhooi commented 1 year ago

@ahoppen Please check it. Excerpted due to heavy.

$ cat lsp.log | grep inlay
[TRACE][2023-06-27 23:16:31] .../lua/vim/lsp.lua:1411   "LSP[sourcekit]"    "initialize_params" {  capabilities = {    general = {      positionEncodings = { "utf-16" }    },    textDocument = {      callHierarchy = {        dynamicRegistration = false      },      codeAction = {        codeActionLiteralSupport = {          codeActionKind = {            valueSet = { "", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" }          }        },        dataSupport = true,        dynamicRegistration = true,        isPreferredSupport = true,        resolveSupport = {          properties = { "edit" }        }      },      completion = {        completionItem = {          commitCharactersSupport = false,          deprecatedSupport = false,          documentationFormat = { "markdown", "plaintext" },          preselectSupport = false,          snippetSupport = false        },        completionItemKind = {          valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }        },        contextSupport = false,        dynamicRegistration = false      },      declaration = {        linkSupport = true      },      definition = {        dynamicRegistration = true,        linkSupport = true      },      documentHighlight = {        dynamicRegistration = false      },      documentSymbol = {        dynamicRegistration = false,        hierarchicalDocumentSymbolSupport = true,        symbolKind = {          valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }        }      },      formatting = {        dynamicRegistration = true      },      hover = {        contentFormat = { "markdown", "plaintext" },        dynamicRegistration = true      },      implementation = {        linkSupport = true      },      inlayHint = {        dynamicRegistration = true,        resolveSupport = {          properties = {}        }      },      publishDiagnostics = {        relatedInformation = true,        tagSupport = {          valueSet = { 1, 2 }        }      },      rangeFormatting = {        dynamicRegistration = true      },      references = {        dynamicRegistration = false      },      rename = {        dynamicRegistration = true,        prepareSupport = true      },      semanticTokens = {        augmentsSyntaxTokens = true,        dynamicRegistration = false,        formats = { "relative" },        multilineTokenSupport = false,        overlappingTokenSupport = true,        requests = {          full = {            delta = true          },          range = false        },        serverCancelSupport = false,        tokenModifiers = { "declaration", "definition", "readonly", "static", "deprecated", "abstract", "async", "modification", "documentation", "defaultLibrary" },        tokenTypes = { "namespace", "type", "class", "enum", "interface", "struct", "typeParameter", "parameter", "variable", "property", "enumMember", "event", "function", "method", "macro", "keyword", "modifier", "comment", "string", "number", "regexp", "operator", "decorator" }      },      signatureHelp = {        dynamicRegistration = false,        signatureInformation = {          activeParameterSupport = true,          documentationFormat = { "markdown", "plaintext" },          parameterInformation = {            labelOffsetSupport = true          }        }      },      synchronization = {        didSave = true,        dynamicRegistration = false,        willSave = true,        willSaveWaitUntil = true      },      typeDefinition = {        linkSupport = true      }    },    window = {      showDocument = {        support = true      },      showMessage = {        messageActionItem = {          additionalPropertiesSupport = false        }      },      workDoneProgress = true    },    workspace = {      applyEdit = true,      configuration = true,      didChangeWatchedFiles = {        dynamicRegistration = true,        relativePatternSupport = true      },      inlayHint = {        refreshSupport = true      },      semanticTokens = {        refreshSupport = true      },      symbol = {        dynamicRegistration = false,        hierarchicalWorkspaceSymbolSupport = true,        symbolKind = {          valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }        }      },      workspaceEdit = {        resourceOperations = { "rename", "create", "delete" }      },      workspaceFolders = true    }  },  clientInfo = {    name = "Neovim",    version = "0.10.0-dev+g2e055e49a"  },  initializationOptions = vim.empty_dict(),  processId = 6221,  rootPath = "/Users/uhooi/ghq/github.com/uhooi/Loki/LokiPackage",  rootUri = "file:///Users/uhooi/ghq/github.com/uhooi/Loki/LokiPackage",  trace = "off",  workspaceFolders = { {      name = "/Users/uhooi/ghq/github.com/uhooi/Loki/LokiPackage",      uri = "file:///Users/uhooi/ghq/github.com/uhooi/Loki/LokiPackage"    } }}
[DEBUG][2023-06-27 23:16:31] .../vim/lsp/rpc.lua:258    "rpc.send"  {  id = 1,  jsonrpc = "2.0",  method = "initialize",  params = {    capabilities = {      general = {        positionEncodings = { "utf-16" }      },      textDocument = {        callHierarchy = {          dynamicRegistration = false        },        codeAction = {          codeActionLiteralSupport = {            codeActionKind = {              valueSet = { "", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" }            }          },          dataSupport = true,          dynamicRegistration = true,          isPreferredSupport = true,          resolveSupport = {            properties = { "edit" }          }        },        completion = {          completionItem = {            commitCharactersSupport = false,            deprecatedSupport = false,            documentationFormat = { "markdown", "plaintext" },            preselectSupport = false,            snippetSupport = false          },          completionItemKind = {            valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }          },          contextSupport = false,          dynamicRegistration = false        },        declaration = {          linkSupport = true        },        definition = {          dynamicRegistration = true,          linkSupport = true        },        documentHighlight = {          dynamicRegistration = false        },        documentSymbol = {          dynamicRegistration = false,          hierarchicalDocumentSymbolSupport = true,          symbolKind = {            valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }          }        },        formatting = {          dynamicRegistration = true        },        hover = {          contentFormat = { "markdown", "plaintext" },          dynamicRegistration = true        },        implementation = {          linkSupport = true        },        inlayHint = {          dynamicRegistration = true,          resolveSupport = {            properties = {}          }        },        publishDiagnostics = {          relatedInformation = true,          tagSupport = {            valueSet = { 1, 2 }          }        },        rangeFormatting = {          dynamicRegistration = true        },        references = {          dynamicRegistration = false        },        rename = {          dynamicRegistration = true,          prepareSupport = true        },        semanticTokens = {          augmentsSyntaxTokens = true,          dynamicRegistration = false,          formats = { "relative" },          multilineTokenSupport = false,          overlappingTokenSupport = true,          requests = {            full = {              delta = true            },            range = false          },          serverCancelSupport = false,          tokenModifiers = { "declaration", "definition", "readonly", "static", "deprecated", "abstract", "async", "modification", "documentation", "defaultLibrary" },          tokenTypes = { "namespace", "type", "class", "enum", "interface", "struct", "typeParameter", "parameter", "variable", "property", "enumMember", "event", "function", "method", "macro", "keyword", "modifier", "comment", "string", "number", "regexp", "operator", "decorator" }        },        signatureHelp = {          dynamicRegistration = false,          signatureInformation = {            activeParameterSupport = true,            documentationFormat = { "markdown", "plaintext" },            parameterInformation = {              labelOffsetSupport = true            }          }        },        synchronization = {          didSave = true,          dynamicRegistration = false,          willSave = true,          willSaveWaitUntil = true        },        typeDefinition = {          linkSupport = true        }      },      window = {        showDocument = {          support = true        },        showMessage = {          messageActionItem = {            additionalPropertiesSupport = false          }        },        workDoneProgress = true      },      workspace = {        applyEdit = true,        configuration = true,        didChangeWatchedFiles = {          dynamicRegistration = true,          relativePatternSupport = true        },        inlayHint = {          refreshSupport = true        },        semanticTokens = {          refreshSupport = true        },        symbol = {          dynamicRegistration = false,          hierarchicalWorkspaceSymbolSupport = true,          symbolKind = {            valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }          }        },        workspaceEdit = {          resourceOperations = { "rename", "create", "delete" }        },        workspaceFolders = true      }    },    clientInfo = {      name = "Neovim",      version = "0.10.0-dev+g2e055e49a"    },    initializationOptions = vim.empty_dict(),    processId = 6221,    rootPath = "/Users/uhooi/ghq/github.com/uhooi/Loki/LokiPackage",    rootUri = "file:///Users/uhooi/ghq/github.com/uhooi/Loki/LokiPackage",    trace = "off",    workspaceFolders = { {        name = "/Users/uhooi/ghq/github.com/uhooi/Loki/LokiPackage",        uri = "file:///Users/uhooi/ghq/github.com/uhooi/Loki/LokiPackage"      } }  }}
[DEBUG][2023-06-27 23:16:32] .../vim/lsp/rpc.lua:361    "rpc.receive"   {  id = 1,  jsonrpc = "2.0",  method = "client/registerCapability",  params = {    registrations = { {        id = "9CAAAAB6-32E4-4645-AB08-4799E2F78263",        method = "textDocument/inlayHint",        registerOptions = {          documentSelector = { {              language = "swift"            } },          resolveProvider = false        }      } }  }}
[TRACE][2023-06-27 23:16:32] .../lua/vim/lsp.lua:1166   "server_request"    "client/registerCapability" {  registrations = { {      id = "9CAAAAB6-32E4-4645-AB08-4799E2F78263",      method = "textDocument/inlayHint",      registerOptions = {        documentSelector = { {            language = "swift"          } },        resolveProvider = false      }    } }}
[TRACE][2023-06-27 23:16:32] ...lsp/handlers.lua:642    "default_handler"   "client/registerCapability" {  ctx = '{\n  client_id = 1,\n  method = "client/registerCapability"\n}',  result = {    registrations = { {        id = "9CAAAAB6-32E4-4645-AB08-4799E2F78263",        method = "textDocument/inlayHint",        registerOptions = {          documentSelector = { {              language = "swift"            } },          resolveProvider = false        }      } }  }}
[INFO][2023-06-27 23:19:26] .../lua/vim/lsp.lua:2033    "exit_handler"  { {    _exec_cmd = <function 1>,    _on_attach = <function 2>,    attached_buffers = { true },    cancel_request = <function 3>,    commands = {},    config = {      autostart = true,      capabilities = {        general = {          positionEncodings = { "utf-16" }        },        textDocument = {          callHierarchy = {            dynamicRegistration = false          },          codeAction = {            codeActionLiteralSupport = {              codeActionKind = {                valueSet = { "", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" }              }            },            dataSupport = true,            dynamicRegistration = true,            isPreferredSupport = true,            resolveSupport = {              properties = { "edit" }            }          },          completion = {            completionItem = {              commitCharactersSupport = false,              deprecatedSupport = false,              documentationFormat = { "markdown", "plaintext" },              preselectSupport = false,              snippetSupport = false            },            completionItemKind = {              valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }            },            contextSupport = false,            dynamicRegistration = false          },          declaration = {            linkSupport = true          },          definition = {            dynamicRegistration = true,            linkSupport = true          },          documentHighlight = {            dynamicRegistration = false          },          documentSymbol = {            dynamicRegistration = false,            hierarchicalDocumentSymbolSupport = true,            symbolKind = {              valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }            }          },          formatting = {            dynamicRegistration = true          },          hover = {            contentFormat = { "markdown", "plaintext" },            dynamicRegistration = true          },          implementation = {            linkSupport = true          },          inlayHint = {            dynamicRegistration = true,            resolveSupport = {              properties = {}            }          },          publishDiagnostics = {            relatedInformation = true,            tagSupport = {              valueSet = { 1, 2 }            }          },          rangeFormatting = {            dynamicRegistration = true          },          references = {            dynamicRegistration = false          },          rename = {            dynamicRegistration = true,            prepareSupport = true          },          semanticTokens = {            augmentsSyntaxTokens = true,            dynamicRegistration = false,            formats = { "relative" },            multilineTokenSupport = false,            overlappingTokenSupport = true,            requests = {              full = {                delta = true              },              range = false            },            serverCancelSupport = false,            tokenModifiers = { "declaration", "definition", "readonly", "static", "deprecated", "abstract", "async", "modification", "documentation", "defaultLibrary" },            tokenTypes = { "namespace", "type", "class", "enum", "interface", "struct", "typeParameter", "parameter", "variable", "property", "enumMember", "event", "function", "method", "macro", "keyword", "modifier", "comment", "string", "number", "regexp", "operator", "decorator" }          },          signatureHelp = {            dynamicRegistration = false,            signatureInformation = {              activeParameterSupport = true,              documentationFormat = { "markdown", "plaintext" },              parameterInformation = {                labelOffsetSupport = true              }            }          },          synchronization = {            didSave = true,            dynamicRegistration = false,            willSave = true,            willSaveWaitUntil = true          },          typeDefinition = {            linkSupport = true          }        },        window = {          showDocument = {            support = true          },          showMessage = {            messageActionItem = {              additionalPropertiesSupport = false            }          },          workDoneProgress = true        },        workspace = {          applyEdit = true,          configuration = true,          didChangeWatchedFiles = {            dynamicRegistration = true,            relativePatternSupport = true          },          inlayHint = {            refreshSupport = true          },          semanticTokens = {            refreshSupport = true          },          symbol = {            dynamicRegistration = false,            hierarchicalWorkspaceSymbolSupport = true,            symbolKind = {              valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }            }          },          workspaceEdit = {            resourceOperations = { "rename", "create", "delete" }          },          workspaceFolders = true        }      },      cmd = { "/usr/bin/sourcekit-lsp", "-Xswiftc", "-sdk", "-Xswiftc", "/Applications/Xcode-15.0.0-Beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.0.sdk", "-Xswiftc", "-target", "-Xswiftc", "x86_64-apple-ios17.0-simulator" },      cmd_cwd = "/Users/uhooi/ghq/github.com/uhooi/Loki/LokiPackage",      filetypes = { "swift", "c", "cpp", "objective-c", "objective-cpp" },      flags = {},      get_language_id = <function 4>,      handlers = <1>{},      init_options = vim.empty_dict(),      log_level = 2,      message_level = 2,      name = "sourcekit",      on_attach = <function 5>,      on_exit = <function 6>,      on_init = <function 7>,      root_dir = "/Users/uhooi/ghq/github.com/uhooi/Loki/LokiPackage",      settings = vim.empty_dict(),      workspace_folders = <2>{ {          name = "/Users/uhooi/ghq/github.com/uhooi/Loki/LokiPackage",          uri = "file:///Users/uhooi/ghq/github.com/uhooi/Loki/LokiPackage"        } },      <metatable> = <3>{        __tostring = <function 8>      }    },    dynamic_capabilities = {      capabilities = {        ["textDocument/inlayHint"] = { {            id = "9CAAAAB6-32E4-4645-AB08-4799E2F78263",            method = "textDocument/inlayHint",            registerOptions = {              documentSelector = { {                  language = "swift"                } },              resolveProvider = false            }          } },        ["workspace/didChangeWatchedFiles"] = { {            id = "0459CED9-2141-4155-8FB9-E7E65C345193",            method = "workspace/didChangeWatchedFiles",            registerOptions = {              watchers = { {                  globPattern = "**/*.swift",                  kind = 5                }, {                  globPattern = "**/*.cpp",                  kind = 5                }, {                  globPattern = "**/*.c",                  kind = 5                }, {                  globPattern = "**/*.cxx",                  kind = 5                }, {                  globPattern = "**/*.m",                  kind = 5                }, {                  globPattern = "**/*.mm",                  kind = 5                }, {                  globPattern = "**/*.cc",                  kind = 5                }, {                  globPattern = "**/*.S",                  kind = 5                }, {                  globPattern = "**/*.s",                  kind = 5                }, {                  globPattern = "**/*.modulemap",                  kind = 5                }, {                  globPattern = "**/*.h++",                  kind = 5                }, {                  globPattern = "**/*.ipp",                  kind = 5                }, {                  globPattern = "**/*.def",                  kind = 5                }, {                  globPattern = "**/*.h",                  kind = 5                }, {                  globPattern = "**/*.hh",                  kind = 5                }, {                  globPattern = "**/*.hpp",                  kind = 5                }, {                  globPattern = "**/*.H",                  kind = 5                }, {                  globPattern = "**/*.hp",                  kind = 5                }, {                  globPattern = "**/*.hxx",                  kind = 5                }, {                  globPattern = "**/Package.swift",                  kind = 2                }, {                  globPattern = "**/compile_commands.json",                  kind = 7                }, {                  globPattern = "**/compile_flags.txt",                  kind = 7                } }            }          } }      },      client_id = 1,      <metatable> = {        __index = {          get = <function 9>,          match = <function 10>,          new = <function 11>,          register = <function 12>,          supports = <function 13>,          supports_registration = <function 14>,          unregister = <function 15>        }      }    },    handlers = <table 1>,    id = 1,    initialized = true,    is_stopped = <function 16>,    messages = {      messages = {},      name = "sourcekit",      progress = {},      status = {}    },    name = "sourcekit",    notify = <function 17>,    offset_encoding = "utf-16",    progress = {      _idx_read = 0,      _idx_write = 0,      _items = {},      _size = 51,      pending = {},      <metatable> = {        __call = <function 18>,        __index = {          clear = <function 19>,          peek = <function 20>,          pop = <function 21>,          push = <function 22>        }      }    },    request = <function 23>,    request_sync = <function 24>,    requests = {      [200] = {        bufnr = 1,        method = "textDocument/documentHighlight",        type = "pending"      }    },    rpc = {      is_closing = <function 25>,      notify = <function 26>,      request = <function 27>,      terminate = <function 28>    },    server_capabilities = {      callHierarchyProvider = true,      codeActionProvider = vim.empty_dict(),      colorProvider = true,      completionProvider = {        resolveProvider = false,        triggerCharacters = { "." }      },      declarationProvider = true,      definitionProvider = true,      documentHighlightProvider = true,      documentSymbolProvider = true,      executeCommandProvider = {        commands = { "semantic.refactor.command" }      },      foldingRangeProvider = true,      hoverProvider = true,      implementationProvider = true,      referencesProvider = true,      textDocumentSync = {        change = 2,        openClose = true,        save = {          includeText = false        },        willSave = true,        willSaveWaitUntil = false      },      typeHierarchyProvider = true,      workspace = {        workspaceFolders = {          changeNotifications = true,          supported = true        }      },      workspaceSymbolProvider = true    },    stop = <function 29>,    supports_method = <function 30>,    workspace_did_change_configuration = <function 31>,    workspace_folders = <table 2>  } }
ahoppen commented 1 year ago

Huh, interesting, neovim doesn’t appear to send a textDocument/inlayHint request. I’m not sure why that is. Could you check with the maintainers of the LSP support in neovim why that might be? It seem to me like this should start to be debugged on the client side.

uhooi commented 1 year ago

Thanks for the confirmation! I created an Issue on Neovim. https://github.com/neovim/neovim/issues/24183

uhooi commented 1 year ago

Resolved and closed. Thank you very much.

ahoppen commented 1 year ago

Oh, that was an easy solution. Thanks for tracking it down.