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

nimsuggest command line option to search for symbol declaration #104

Open
timotheecour opened this issue Aug 23, 2018 · 0 comments
Open

Comments

@timotheecour
Copy link
Member

as show here: how to reliably search where a symbol is declared using cmd line? - Nim forum there's currently no way to seach reliably for public symbol declarations (eg enum members, field names, but possibly other declarations too) or even non-public procs/types/etc using textual search grep/nimgrep/rg

So we need to make nimsuggest work for that basic use case of searching for symbol declaration.
I need a command line way to search for symbol declarations, not just an IDE integration (IDE integration alone makes it hard to pipe to other commands / tools)

it could be:

# simplest first
nimsuggest --search --nameregex:'foo\w+bar' --filepattern=<glob pattern, eg using ripgrep's syntax>

# more featureful:
nimsuggest --search --type:decl --kind:macro,proc --nameregex:'foo\w+bar' --filepattern=<glob pattern, eg using ripgrep's syntax>
with:
--type:[usage|declaration|definition]
--kind:[iterator|proc|template|macro|method|type|func]

related

Note

  • if use case above is doable today from cmd line, please kindly show the command I need to run on cmd line to search, say, for a proc named 'foo\w+bar' in a set of files (eg as specified by multiple search paths)
  • public symbols are not enough; we should also allow searching for private symbols; eg use cases: searching in large files (with complex conditional compilation for eg) or when using include instead of import (in which case symbol may be declared in another file)

scratch below

$ nimsuggest --stdin board.nim
usage: sug|con|def|use|dus|chk|mod|highlight|outline|known file.nim[;dirtyfile.nim]:line:col

Unfortunately not for all options it is clear what they mean, I had to ask Araq some years ago for it, but can not really remember details. But NimSuggest generally works fine and reliable, I am using it in my NEd editor for years. Well, when syntax is too wrong it may crash, for example when I load a Ruby file to convert it to Nim it may crash. I had a private local version of NEd which even did syntax highlighting based on nimsuggest, was working fine and nice, but CPU load was high, so I am not using that, as plain regexp highlighting offered by GtkSourceView is not bad.

@krux02 krux02 changed the title [nimsuggest] command line option to search for symbol declaration nimsuggest command line option to search for symbol declaration Oct 28, 2018
@narimiran narimiran transferred this issue from nim-lang/Nim Mar 28, 2019
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

1 participant