Skip to content

Language service should be able to find variable references inside of strings #25

Closed

Description

@daviwil

This affects references/occurrences finding and variable renaming. An example from Kirk:

function Write-Item($itemCount)
{
    $i = 1

    while ($i -le $itemCount)
    {
        $str = "Output ${i}"
        Write-Output $str
        $i = $i + 1
    }
}

If you attempt to rename the variable $i, the instance inside of the output string does not get renamed.

Activity

  1. modified the milestones: 0.3.0, on Dec 31, 2015
  2. TylerLeonhardt commented on Jan 17, 2018

    @TylerLeonhardt
    Member

    I believe this is working now but I don't quite know how to "rename" unless you mean through the search menu.

  3. daviwil commented on Jan 17, 2018

    @daviwil
    ContributorAuthor

    I think rename may be broken for us now since the LSP got new message types for performing renames. However, I think finding/renaming variables in strings did work the last time I tried it.

  4. removed this from the milestone on Aug 17, 2021
  5. andyleejordan commented on Jun 15, 2026

    @andyleejordan
    Member

    Resolved in the v3.8.0 symbol rewrite (#1984) — variable references inside expandable strings are now visited and indexed (SymbolVisitor.VisitVariableExpression). Closing as completed.


    Drafted by GitHub Copilot (Claude Opus 4.8) at Andy Jordan (@andyleejordan)'s request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions