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.

Category: Enquiry · Compare: Find in Project, symbols mode (EK9 IDE) - no direct IntelliJ / VS Code equivalent: Find Usages starts from ONE symbol

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

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

ArgumentTypeRequiredWhat it is
caseSensitivebooleanDefault true.
filestringScope: this one file. Omit file and module for the whole workspace.
kindsarray 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 | variablesKinds to find: single kinds and/or the groups constructs, members, variables. Default all.
matchstring: exact | contains | regexexact (whole name, default), contains (anywhere in the name), or regex (Java, against the name).
maxSymbolsintegerDefault 200, max 2000. The answer is the first maxSymbols symbols; a cut one says truncated:true and moreSymbols (how many more).
modulestringScope: every file of this module.
namestringyesThe name pattern - matched against symbol NAMES, never comments or Strings.
renameTostringAlso return renameRequest - the ek9_rename_symbol arguments renaming every symbol found. Nothing is applied.
sourceLinesbooleanGive each site its source line (text). Default false.
usesarray of string: declared | read | writtenWhich sites: declared, read, written. Default all three.
verbositystring: full | summary | nonefull (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.