Closed taiwbi closed 4 months ago
I am very skeptical that the LSP is returning items in a hierarchy, when LSP servers do that we display the symbols in a hierarchy.
First, double check that your LSP server is up-to-date, then run :LspInfo
to confirm that only intelephense is attached to your buffer. Then, run the following code (preferably on a small sample file):
local bufnr = vim.api.nvim_get_current_buf()
local params = { textDocument = vim.lsp.util.make_text_document_params(bufnr) }
local client = vim.lsp.get_active_clients({ bufnr = bufnr })[1]
client.request("textDocument/documentSymbol", params, function(err, result, ctx, config)
vim.print(result)
end, bufnr)
This should print some output (which you can see with :messages
), which will allow us to see the raw data that the server is actually giving us.
I'm not really familiar with how LSP works but based on this output I think LSP is fine...
This is the code I tested it on with the aerial outline near:
And this is the output of the code:
{ {
kind = 5,
location = {
range = {
["end"] = {
character = 1,
line = 30
},
start = {
character = 6,
line = 2
}
},
uri = "file:///home/mahdi/Documents/aerial/main.php"
},
name = "Calculator"
}, {
containerName = "Calculator",
kind = 7,
location = {
range = {
["end"] = {
character = 16,
line = 5
},
start = {
character = 9,
line = 5
}
},
uri = "file:///home/mahdi/Documents/aerial/main.php"
},
name = "$result"
}, {
containerName = "Calculator",
kind = 9,
location = {
range = {
["end"] = {
character = 3,
line = 11
},
start = {
character = 18,
line = 8
}
},
uri = "file:///home/mahdi/Documents/aerial/main.php"
},
name = "__construct"
}, {
containerName = "Calculator",
kind = 6,
location = {
range = {
["end"] = {
character = 3,
line = 17
},
start = {
character = 18,
line = 14
}
},
uri = "file:///home/mahdi/Documents/aerial/main.php"
},
name = "add"
}, {
containerName = "add",
kind = 13,
location = {
range = {
["end"] = {
character = 26,
line = 14
},
start = {
character = 22,
line = 14
}
},
uri = "file:///home/mahdi/Documents/aerial/main.php"
},
name = "$num"
}, {
containerName = "Calculator",
kind = 6,
location = {
range = {
["end"] = {
character = 3,
line = 23
},
start = {
character = 18,
line = 20
}
},
uri = "file:///home/mahdi/Documents/aerial/main.php"
},
name = "subtract"
}, {
containerName = "subtract",
kind = 13,
location = {
range = {
["end"] = {
character = 31,
line = 20
},
start = {
character = 27,
line = 20
}
},
uri = "file:///home/mahdi/Documents/aerial/main.php"
},
name = "$num"
}, {
containerName = "Calculator",
kind = 6,
location = {
range = {
["end"] = {
character = 3,
line = 29
},
start = {
character = 18,
line = 26
}
},
uri = "file:///home/mahdi/Documents/aerial/main.php"
},
name = "getResult"
}, {
kind = 13,
location = {
range = {
["end"] = {
character = 5,
line = 33
},
start = {
character = 0,
line = 33
}
},
uri = "file:///home/mahdi/Documents/aerial/main.php"
},
name = "$calc"
} }
This is using the deprecated SymbolInformation structure for the symbols, which cannot provide a hierarchy. From the spec:
SymbolInformation[]
which is a flat list of all symbols found in a given text document. Then neither the symbol’s location range nor the symbol’s container name should be used to infer a hierarchy.
Allegedly Intelephense migrated off of that to DocumentSymbol in 2019 (source). You could try filing an issue with Intelephense asking if they could update their document symbol provider, but there's nothing aerial can do about this.
Oh, I thought the containerName
in every single block is the parent of that symbol.
Anyway thank you so much for your response and the time you spent on this issue, I appreciate it so much.
Neovim version (nvim -v)
v0.9.5
Operating system/version
Fedora Linux 39
Output of :AerialInfo
Describe the bug
I installed intelephense as my LSP server on Neovim, I have treesitter as well for my code highlighting. When aerial uses LSP for outlining the code, I don't see any indentation on symbols outline:
However it's fine if I prioritize treesitter over lsp, it works fine. I don't want to do that because treesitter only shows functions and classes :(
I though it might be LSP problem but intelephense works fine on other editors.
What is the severity of this bug?
tolerable (can work around it)
Steps To Reproduce
I use AstroNvim for my base setup so...
Expected Behavior
It would be great if aerial shows the hierarchical of the symbols, like this:
Minimal example file
No response
Minimal init.lua
No response
Additional context
No response