Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lsp-imenu don't show method args #436

Closed
myrgy opened this issue Oct 1, 2018 · 5 comments
Closed

lsp-imenu don't show method args #436

myrgy opened this issue Oct 1, 2018 · 5 comments

Comments

@myrgy
Copy link

myrgy commented Oct 1, 2018

Hi all,

Previously I had similar issue #329, which were caused by imenu settings, but seems like imenu was changes and now I can't seem arguments.

In case of C++ it's possible to have a bunch of methods with different arguments. In that case imenu is useless because I can't use it for navigation.
Could you please help me to adjust this behaviour.

Thank you in advance!

(I use lsp + ccls)

@MaskRay , seems like imenu results depend from cursor position. Is it desired behavior or a bug?
(when cursor is on the method - then I have only one result in imenu)

@MaskRay
Copy link
Member

MaskRay commented Oct 7, 2018

In hierarchical document symbol support of ccls,

https://github.com/maskray/ccls/blob/master/src/messages/textDocument_documentSymbol.cc#L131

          ds.name = def->Name(false); // foo
          ds.detail = def->Name(true); // ns::foo but no arguments
  • on ccls's side, detail may include function arguments if some initialization option is provided, e.g. documentSymbol.verboseDetail (bikeshedding on the name welcomed)
  • in lsp-imenu.el, name is used to create imenu entries. it may be useful to have an option to switch to detail

@myrgy
Copy link
Author

myrgy commented Oct 7, 2018

@MaskRay , thank you for answer!

@yyoncho
Copy link
Member

yyoncho commented Dec 20, 2018

@MaskRay I might be missing something but here it is what I see as a ccls output(no detail). Jdt ls response is at the bottom

<<<< ccls:17743
{
  "jsonrpc": "2.0",
  "id": 985,
  "result": [
    {
      "name": "fn1",
      "detail": "fn1",
      "kind": 12,
      "range": {
        "start": {
          "line": 6,
          "character": 0
        },
        "end": {
          "line": 9,
          "character": 1
        }
      },
      "selectionRange": {
        "start": {
          "line": 6,
          "character": 4
        },
        "end": {
          "line": 6,
          "character": 7
        }
      },
      "children": []
    },
    {
      "name": "fn",
      "detail": "fn",
      "kind": 12,
      "range": {
        "start": {
          "line": 2,
          "character": 0
        },
        "end": {
          "line": 4,
          "character": 1
        }
      },
      "selectionRange": {
        "start": {
          "line": 2,
          "character": 4
        },
        "end": {
          "line": 2,
          "character": 6
        }
      },
      "children": []
    },
    {
      "name": "main",
      "detail": "main",
      "kind": 12,
      "range": {
        "start": {
          "line": 11,
          "character": 0
        },
        "end": {
          "line": 20,
          "character": 1
        }
      },
      "selectionRange": {
        "start": {
          "line": 11,
          "character": 4
        },
        "end": {
          "line": 11,
          "character": 8
        }
      },
      "children": []
    }
  ]
}
<<<< jdtls:17462
{
  "jsonrpc": "2.0",
  "id": 996,
  "result": [
    {
      "name": "com.dap.demo.projectb",
      "kind": 4,
      "range": {
        "start": {
          "line": 0,
          "character": 0
        },
        "end": {
          "line": 0,
          "character": 30
        }
      },
      "selectionRange": {
        "start": {
          "line": 0,
          "character": 0
        },
        "end": {
          "line": 0,
          "character": 30
        }
      },
      "detail": "",
      "deprecated": false
    },
    {
      "name": "App",
      "kind": 5,
      "range": {
        "start": {
          "line": 2,
          "character": 0
        },
        "end": {
          "line": 28,
          "character": 1
        }
      },
      "selectionRange": {
        "start": {
          "line": 5,
          "character": 13
        },
        "end": {
          "line": 5,
          "character": 16
        }
      },
      "detail": "",
      "deprecated": false,
      "children": [
        {
          "name": "name(String, Integer)",
          "kind": 6,
          "range": {
            "start": {
              "line": 6,
              "character": 2
            },
            "end": {
              "line": 8,
              "character": 3
            }
          },
          "selectionRange": {
            "start": {
              "line": 6,
              "character": 14
            },
            "end": {
              "line": 6,
              "character": 18
            }
          },
          "detail": " : void",
          "deprecated": false,
          "children": []
        },
        {
          "name": "name(String, Integer, Integer)",
          "kind": 6,
          "range": {
            "start": {
              "line": 10,
              "character": 2
            },
            "end": {
              "line": 12,
              "character": 3
            }
          },
          "selectionRange": {
            "start": {
              "line": 10,
              "character": 14
            },
            "end": {
              "line": 10,
              "character": 18
            }
          },
          "detail": " : void",
          "deprecated": false,
          "children": []
        },
        {
          "name": "name(int, Integer, Integer)",
          "kind": 6,
          "range": {
            "start": {
              "line": 14,
              "character": 2
            },
            "end": {
              "line": 16,
              "character": 3
            }
          },
          "selectionRange": {
            "start": {
              "line": 14,
              "character": 14
            },
            "end": {
              "line": 14,
              "character": 18
            }
          },
          "detail": " : void",
          "deprecated": false,
          "children": []
        },
        {
          "name": "namexxxxxx(int, Integer, Integer, Integer)",
          "kind": 6,
          "range": {
            "start": {
              "line": 18,
              "character": 2
            },
            "end": {
              "line": 19,
              "character": 3
            }
          },
          "selectionRange": {
            "start": {
              "line": 18,
              "character": 14
            },
            "end": {
              "line": 18,
              "character": 24
            }
          },
          "detail": " : void",
          "deprecated": false,
          "children": []
        },
        {
          "name": "name(boolean, Integer, Integer)",
          "kind": 6,
          "range": {
            "start": {
              "line": 21,
              "character": 2
            },
            "end": {
              "line": 27,
              "character": 3
            }
          },
          "selectionRange": {
            "start": {
              "line": 21,
              "character": 14
            },
            "end": {
              "line": 21,
              "character": 18
            }
          },
          "detail": " : void",
          "deprecated": false,
          "children": []
        }
      ]
    }
  ]
}

@MaskRay
Copy link
Member

MaskRay commented Dec 20, 2018

With DocumentSymbol[], the qualified name can be inferred from the hierarchy, so I think ds->detail = def->Named(true); (qualified name) might not be useful. Just changed ccls to use ds->detail = def->detailed_name (qualified name with args)`.

@yyoncho
Copy link
Member

yyoncho commented Dec 20, 2018

Assuming this to be fixed. @myrgy if you hit the same issue with some other server please file a bug in the server's repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants