Skip to content

VS2015 code editor for TypeScript shows all the references incorrectly #8118

Closed

Description

TypeScript Version: 1.8.9 (Visual Studio 2015)

I have a problem of finding all references (uses) for imported declaration of an interface or class
into a module.

For example i have a dialog module: dialog.ts (in any other module the same behaviour)
https://github.com/BBGONE/JRIApp/blob/master/FRAMEWORK/CLIENT/addins/ui/jriapp_ui/dialog.ts

it contains
Code

import { ITemplate, ITemplateEvents, IApplication, IVoidPromise, IEditable, IBaseObject,
    TEventHandler, ISelectableProvider, IDeferred } from "jriapp_core/shared";
import * as langMOD from "jriapp_core/lang";
import { BaseObject } from "jriapp_core/object";
import { Utils as utils, DomUtils as dom, ERROR } from "jriapp_utils/utils";
import { bootstrap } from "jriapp_core/bootstrap";
import { ViewModel } from "jriapp_parts/mvvm";

Actual behavior:

When i click in VS2015 code editor with right button on imported class or interface or variable
and select "Find all references" in the menu it finds all the references for imported variable in the whole project !

P.S. - Stange but for
import * as langMOD from "jriapp_core/lang";

if i click on langMOD to find refences for it then it produces correct result- for the references to langMOD in the current module.
But for all other imported parts which use {} to import them. The result is references in the whole project.

Expected behavior:

Show only the references in the current module

Activity

  1. mhegazy commented on Apr 19, 2016

    @mhegazy
    Contributor

    with find-all-references we try to find them all when possible. For import * as langMOD from "jriapp_core/lang"; langMOD really means one thing, and it is local to this module, and cannot be accessed outside. but import { ViewModel } from "jriapp_parts/mvvm"; ViewModel can both mean the local name ViewModel and the name of the export ViewModule in "jriapp_parts/mvvm", so we show both. if that was renamed, i.e. import { ViewModel as localViewModel } from "jriapp_parts/mvvm"; then localViewModel would be local only.

    the other aspect here is rename. Rename is built on find-all-references, we would want to make sure that starting with a working state, when your rename ViewModle you get to another working state, and not some of your imports are invalid.

  2. mhegazy commented on Apr 20, 2016

    @mhegazy
    Contributor

    I think there is a part here that we need to fix, namely renaming something in a declaration file. if the module declaration is coming from a declaration file, renaming the import should not rename the export, as this is meaningless, we should rename the local import.

    related to #7458 and #8213.

  3. mhegazy commented on Apr 20, 2016

    @mhegazy
    Contributor

    Filed a new issue for it in #8227

  4. locked and limited conversation to collaborators on Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    By DesignDeprecated - use "Working as Intended" or "Design Limitation" instead

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions