ek9_find_symbols
Answers first: symbolCount, symbolNames, withinNames (Type.method each belongs to), siteCount, byKind, byUse, sites as file.ek9:LINE - then each symbol (kind, within, declaredAt, renameable, counts) with its declared/read/written sites.
When to use it
Which symbols are NAMED like X, of which kinds, and where each is declared / read / written - one call: {name:'productId', kinds:['loop_variable']}. Pre-flight for a pattern rename (renameTo), a naming audit (kinds:['variables'], name:'tmp'), or 'is anything still reading X' after an edit.
When not to use it
- Every use of ONE symbol you can already name, with call structure, inferred-type uses and property writes by any route (alias, view, impure method) -
ek9_query_references(symbol:'Type.member'). - Text in comments and Strings -
ek9_search_text. - Where a construct is declared, by name or prefix -
ek9_find_constructs_by_name(lighter). - Applying a rename -
ek9_rename_symbol(this tool only prepares the request).
Details
A name matches by 'match': exact (the whole name, default), contains, or regex (Java, tested against the name - anchor it yourself). caseSensitive defaults true; otherCaseNames lists what ignoring case would add. kinds take single kinds (class ... loop_variable) and the group words constructs / members / variables; default all. uses keeps only the declared / read / written sites and drops a symbol left with none. 'written' is the name assigned (':', ':=', '=', ':=?') or a mutating operator ('+=', ':=:', '++', ...) at that site - not the property write-site analysis (that is ek9_query_references). Scope: file, module (every file of it), or neither for the workspace; a symbol declared outside the scope but used in it is found with its in-scope sites. Built-ins are never returned. A construct carries fullyQualifiedName (module::Name); a member or variable carries within ('Order', 'OrderProcessor.processOrder'). Answers from the LAST compile: filesWithErrors lists the searched files that did not compile clean - names in their broken parts may be missing. Lines are 1-based, columns 0-based. renameTo returns renameRequest (the ek9_rename_symbol arguments, dryRun:true, the first symbol plus alsoRename) with each new name as the IDE gives it ('Count'->'Total' turns itemCount into itemTotal; regex may use $1); operators and constructors, and names left unchanged, are in renameSkipped.
Arguments
| Argument | Type | Required | What it is |
|---|---|---|---|
caseSensitive | boolean | Default true. | |
file | string | Scope: this one file. Omit file and module for the whole workspace. | |
kinds | array of string: class | record | trait | component | function | abstract_function | enumeration | type | text | service | program | application | property | method | operator | constructor | parameter | return | local | loop_variable | guard | capture | constant | constructs | members | variables | Kinds to find: single kinds and/or the groups constructs, members, variables. Default all. | |
match | string: exact | contains | regex | exact (whole name, default), contains (anywhere in the name), or regex (Java, against the name). | |
maxSymbols | integer | Default 200, max 2000. The answer is the first maxSymbols symbols; a cut one says truncated:true and moreSymbols (how many more). | |
module | string | Scope: every file of this module. | |
name | string | yes | The name pattern - matched against symbol NAMES, never comments or Strings. |
renameTo | string | Also return renameRequest - the ek9_rename_symbol arguments renaming every symbol found. Nothing is applied. | |
sourceLines | boolean | Give each site its source line (text). Default false. | |
uses | array of string: declared | read | written | Which sites: declared, read, written. Default all three. | |
verbosity | string: full | summary | none | full (default): each symbol with its sites; summary: each symbol without its sites; none: the headline alone. |
Recorded calls
Real calls, recorded against small projects and checked on every build - a changed answer fails it. 3 of the 9 recorded are shown.
Case sensitive other case names
Request
{
"kinds" : [ "members" ],
"match" : "contains",
"name" : "count"
}
Response
{
"basis" : "last compile",
"byKind" : { },
"byUse" : { },
"fileCount" : 0,
"filesWithErrors" : [ ],
"meta" : {
"serverMs" : "<timing>"
},
"nextStep" : "caseSensitive:false also finds itemCount",
"note" : "No property/method/operator/constructor named containing 'count' in the workspace (from the last compile).",
"otherCaseNames" : [ "itemCount" ],
"siteCount" : 0,
"sites" : [ ],
"status" : "not-found",
"symbolCount" : 0,
"symbols" : [ ]
}
Case insensitive no other case
Request
{
"caseSensitive" : false,
"kinds" : [ "members" ],
"match" : "contains",
"name" : "count"
}
Response
{
"basis" : "last compile",
"byKind" : {
"property" : 1
},
"byUse" : {
"declared" : 1
},
"fileCount" : 1,
"filesWithErrors" : [ ],
"meta" : {
"serverMs" : "<timing>"
},
"siteCount" : 1,
"sites" : [ "orders.ek9:8" ],
"status" : "ok",
"symbolCount" : 1,
"symbolNames" : [ "itemCount" ],
"symbols" : [ {
"anchor" : {
"column" : 6,
"file" : "orders.ek9",
"line" : 8
},
...
Cut short here: 19 more lines. The whole recorded call.
Max symbols more
Request
{
"maxSymbols" : 1,
"name" : "productId",
"verbosity" : "summary"
}
Response
{
"basis" : "last compile",
"byKind" : {
"property" : 1
},
"byUse" : {
"declared" : 1,
"read" : 1,
"written" : 1
},
"fileCount" : 1,
"filesWithErrors" : [ ],
"meta" : {
"serverMs" : "<timing>"
},
"moreSymbols" : 2,
"siteCount" : 3,
"sites" : [ "orders.ek9:7", "orders.ek9:12", "orders.ek9:15" ],
"status" : "ok",
"symbolCount" : 1,
"symbolNames" : [ "productId" ],
"symbols" : [ {
"anchor" : {
"column" : 6,
...
Cut short here: 17 more lines. The whole recorded call.