Code Monkey home page Code Monkey logo

Comments (4)

stevearc avatar stevearc commented on August 24, 2024

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.

from aerial.nvim.

taiwbi avatar taiwbi commented on August 24, 2024

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:

Screenshot from 2024-02-21 13-07-42

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"
  } }

from aerial.nvim.

stevearc avatar stevearc commented on August 24, 2024

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.

from aerial.nvim.

taiwbi avatar taiwbi commented on August 24, 2024

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.

from aerial.nvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.