julia-script / julia-script/silk

Add usage-count CodeLens for variables and functions

Open
#180 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

blocked lsp new feature P3
Dominant language
TypeScript
Stars
48
Forks
0
Avg merge
4h 49m
Merged PRs (30d)
213

Description

Summary

Add LSP CodeLens usage counts for local variables, parameters, functions, and other suitable declarations.

This builds on the workspace reference product in #179. Local declarations can use current per-module semantic occurrences; top-level declarations need complete source-root reference summaries.

Scope

  • Advertise and implement textDocument/codeLens.
  • Use canonical semantic identities rather than textual name counts.
  • Count local binding and parameter references from current module/function facts.
  • Count top-level function/declaration references across closed reverse-dependent modules through #179.
  • Support codeLens/resolve so expensive workspace counts can be deferred.
  • Keep lenses coherent with the accepted document and workspace revision.
  • Define and document:
    • whether import-clause occurrences count as usages;
    • whether declarations are excluded from counts;
    • whether zero-count lenses are hidden or displayed;
    • whether local and workspace counts are presented differently.

Acceptance criteria

  • A local variable and parameter lens reports the exact semantic reference count within its scope.
  • A top-level function lens includes uses from unopened source-root modules.
  • Shadowed or same-spelled declarations do not affect each other's counts.
  • The declaration occurrence itself is not accidentally counted as a reference.
  • Stale lens resolution does not combine current text with old reference summaries.
  • Lens ordering and titles are deterministic.
  • Large files and workspaces do not eagerly recompute every global count for every request.
  • Tests cover imports/aliases, first-class callable uses, direct calls, zero usages, unsaved buffers, and closed reverse dependents.

Dependency

Blocked by the workspace reference completeness and freshness semantics in #179.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the workspace reference completeness and freshness semantics in #179, then trace the LSP entry points for textDocument/codeLens and codeLens/resolve. Define the semantic counting and revision rules from the scope, and add tests for imports, aliases, callable uses, zero usages, unsaved buffers, and closed reverse dependents.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.