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

Can we add a symbol kind filter to Symbols::loadItems? #1600

Closed
lanza opened this issue Mar 2, 2020 · 3 comments
Closed

Can we add a symbol kind filter to Symbols::loadItems? #1600

lanza opened this issue Mar 2, 2020 · 3 comments

Comments

@lanza
Copy link

lanza commented Mar 2, 2020

The Symbols class implements the CocList symbols command. It queries the server for all symbols that match a query string and gets an array back of SymbolInformations. loadItems then transforms the SymbolInformation to a displayable format. This code is used:

    for (let s of symbols) {
      let kind = getSymbolKind(s.kind)
      let file = URI.parse(s.location.uri).fsPath
      if (isParentFolder(workspace.cwd, file)) {
        file = path.relative(workspace.cwd, file)
      }
      items.push({
        label: `${s.name} [${kind}]\t${file}`,
        filterText: `${s.name}`,
        location: s.location,
        data: { original: s, kind: s.kind, file, score: score(input, s.name) }
      })
    }

I think it would be a nice feature to offer

let kind = getSymbolKind(s.kind)
if (context.options.matchkind !== kind) {
    continue;
}

so that the user could do CocList symbols --kind=class etc.

@chemzqm chemzqm closed this as completed in d4dd5b3 Mar 3, 2020
@chemzqm
Copy link
Member

chemzqm commented Mar 3, 2020

Use :CocList -I symbols -kind class

@lanza
Copy link
Author

lanza commented Mar 3, 2020

Thank you!

@wolloda
Copy link

wolloda commented Apr 25, 2022

I understand that :CocList -I symbols -kind [method, function] is not possible -- is there a way to somehow join outputs of
:CocList -I symbols -kind method and :CocList -I symbols -kind function and search both at the same time?

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