DCD icon indicating copy to clipboard operation
DCD copied to clipboard

Allow find usages of symbol names

Open stonemaster opened this issue 11 years ago • 1 comments

The server/client should be enhanced to allow to find all usages of the symbol under the cursor. Filenames and locations could then be returned by the server to allow plugins in the supported editors which highlight the usages.

stonemaster avatar Sep 10 '13 20:09 stonemaster

Since #202 seems to be closed whitout being resolved and the author of the proposed solution no longer there, I thought if I could come up with some solution for this since I really want this feature.

To do the lookup of all usings one could simply grep for the symbol on the source directory root and return the file it is found in, once it is found. the file has to be parsed if the referenced symbol of the parsed file matches the original file, it would result in one usage. alias declerations have to be searched for too and also be counted. (Or they might be excluded using a config parameter) This does work for not work for code mixins and for symbols that are indirectly used in templates. however.

Grepping should be sufficiently fast on Linux for most usecases. Using the linux kernel as codebase on an ssd time rg -l intel . 0,188s As far as I understand it should be the consecutive parsing of the source that will be slow. But if a symbol is used 10 times in 10 different files, parsing 10 files should be relative slow.

SjoerdNijboer avatar Dec 12 '19 22:12 SjoerdNijboer