ayamir / nvimdots

A well configured and structured Neovim.
BSD 3-Clause "New" or "Revised" License
2.84k stars 455 forks source link

Symbol outline doesn't work properly in python files and C files #1058

Closed Qejun closed 8 months ago

Qejun commented 8 months ago

Version confirmation

Following prerequisites

Not a user config issue

Neovim version

nvim0.9.4

Operating system/version

win10

Terminal name/version

Windows terminal

$TERM environment variable

No response

Branch info

main (Default/Latest)

Fetch Preferences

SSH (use_ssh = true)

How to reproduce the issue

Symbol outline doesn't work properly in python files and C files,I wonder where to start with this problem 屏幕截图 2023-11-09 080019

Expected behavior

In a lua file, the symbol outline correctly displays the hierarchical structure of the content

屏幕截图 2023-11-09 080714

Actual behavior

In python files and C files, everything is displayed on the same level when navigating with symbol outline 屏幕截图 2023-11-09 080019

Additional information

No response

Qejun commented 8 months ago
屏幕截图 2023-11-09 093816

I changed python's lsp and now it works correctly. Change python-lsp-server to pyright in lua/modules/configs/completion/mason.lua However, there is still no way to solve the c file.Do you have any recommended c language server?

CharlesChiuGit commented 8 months ago

ys, the syntax tree is generated from treesitter and lsp. glad to see u try out different lsp on python first.

for c/c++ part, what c lsp r u using now? what c lsp have u tried?

Jint-lzxy commented 8 months ago

Hmm, I think this is more of an "upstream support" issue. Below are some results of trying to communicate with pylsp and clangd via json-rpc (correct me if im wrong 😃):

{"detail":"int","kind":22,"name":"TK_AND","range":{"end":{"character":24,"line":8},"start":{"character":1,"line":8}},"selectionRange":{"end":{"character":7,"line":8},"start":{"character":1,"line":8}}},

Qejun commented 8 months ago

ys, the syntax tree is generated from treesitter and lsp. glad to see u try out different lsp on python first.

for c/c++ part, what c lsp r u using now? what c lsp have u tried?

I'm using clangd now

Jint-lzxy commented 8 months ago

I'm using clangd now

Have u defined a compilation database in ur project root directory?

Qejun commented 8 months ago

I'm using clangd now

Have u defined a compilation database in ur project root directory?

I used compile_flags.txt, in the root directory image clangd can only display function names, not variable names image

Jint-lzxy commented 8 months ago

clangd can only display function names, not variable names

AFAIK this feature hasn't been implemented yet. More info: https://github.com/clangd/clangd/issues/616.

CharlesChiuGit commented 8 months ago

@Qejun can u try out the latest pr to see if it works for u?