orbitalquark / textadept-lsp

Language server protocol client module for Textadept.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[question] lsp works but hover not working?

LollipopFt opened this issue · comments

hi, when i hover over a text nothing appears:
image

only when i click Tools > Language Server > Show Hover Information the hover information appears there:
image

shouldn't hover information appear when i hover over text, or am i missing a setting? my settings:

buffer.use_tabs = true
buffer.tab_width = 2
buffer.eol_mode = buffer.EOL_LF
view.view_eol = true
view.view_ws = view.WS_VISIBLEALWAYS

require('elastic_tabstops')

require('ctags')
local lsp = require('lsp')
lsp.server_commands.rust = 'rust-analyzer'
require('spellcheck')

textadept and lsp version: 12.0
latest nightly version (as of 16 Jan 2023) does not work at all: lsp server immediately closes with error 101

i have read the rpc logs and there are no errors.

You're right that hover information should appear when you hover over text and hold the mouse stationary for a half-second or so. It works for me on Linux with clangd (C++ language server), so there may be something odd going on on Windows. I don't have a Windows box to test on at the moment, but I'll look into this when I have a chance.

On a side note: the LSP module is currently under heavy development, so there may be some transitory issues. The module was recently updated to support LSP version 3.17.0, which your server may not yet support. I don't know what server error 101 is for Rust.

On nightly version 17 Jan 2023, it shows this error in the [Output Buffer]

textadept\data/modules/lsp/init.lua:664: textadept\data/modules/lsp/init.lua:415: attempt to index a nil value (local 'line')

and shows this in the [LSP] buffer

Starting language server: rust-analyzer
Server exited with status 101

could i see how you set up your clangd server on textadept so i can test to see if it is a server issue or an issue in the lsp module itself? thanks!

by the way, i use eol LF files despite using windows, don't know if that may affect anything.

config:

local lsp = require('lsp')
lsp.server_commands.rust = 'rust-analyzer'
lsp.server_commands.c = 'clangd'
lsp.server_commands.cpp = 'clangd'

[Output Buffer] (for both c and cpp files):

textadept\data/modules/lsp/init.lua:664: textadept\data/modules/lsp/init.lua:212: No project root found

for rust file:

textadept\data/modules/lsp/init.lua:664: textadept\data/modules/lsp/init.lua:415: attempt to index a nil value (local 'line')

file structure:

  • for cpp:
folder
|-main.cpp
|-.clangd
  • for c:
folder
|-main.c

the language servers, both rust (rust-analyzer) and c and cpp (clangd) work in other text editors such as neovim, sublime text, lapce and helix on my computer.

the language servers now work for c and cpp files, thanks so much! i guess there is something different about the rust server then. (not sure what 'attempt to index a nil value means'). however, there is still no hover functionality for c and cpp and i still have to do Tools > Language Server > Show Hover Information.

sorry for not doing this sooner, forgot to turn on log_rpc.

Starting language server: rust-analyzer
RPC send:
{
  "params": {
    "rootUri": "file:///R:/wgpu_prac",
    "capabilities": {
      "textDocument": {
        "signatureHelp": {
          "signatureInformation": {
            "parameterInformation": {
              "labelOffsetSupport": true
            },
            "activeParameterSupport": true,
            "documentationFormat": ["plaintext"]
          }
        },
        "synchronization": {
          "didSave": true
        },
        "completion": {
          "completionItem": {
            "preselectSupport": true,
            "documentationFormat": ["plaintext"]
          },
          "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]
          }
        },
        "selectionRange": [],
        "hover": {
          "contentFormat": ["plaintext"]
        },
        "documentSymbol": {
          "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]
          }
        }
      }
    },
    "clientInfo": {
      "version": "Textadept 12.0 alpha",
      "name": "textadept"
    },
    "processId": null
  },
  "id": 1,
  "jsonrpc": "2.0",
  "method": "initialize"
}
Server exited with status 101