Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arrow functions in js/ts not recognized as functions in breadcrumbs #45478

Closed
w-cantin opened this issue Aug 8, 2021 · 2 comments
Closed

Arrow functions in js/ts not recognized as functions in breadcrumbs #45478

w-cantin opened this issue Aug 8, 2021 · 2 comments
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug

Comments

@w-cantin
Copy link

w-cantin commented Aug 8, 2021

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.59.0
  • OS Version: Windows 10

Steps to Reproduce:

  1. Create a javascript file with this content:
    let myArrowFunc = () => {console.log("Arrow func here")}
  2. Wait for the breadcrumbs to load properly and hover over the myArrowFunc. It is showing as an object and not a function.

Arrowfunctions are currently treated as an object (SymbolKind 12) in javascript and typescript instead of a function (SymbolKind 11). I am writing a plugin that requests the symbol provider given by VSCode and navigates the symbols found. It needs to treat functions differently than simple object declarations.

Arrow functions are used a lot in classes for example and the following code would treat the arrow function myArrowFunc differently from the function regularMethod even though they are both methods of the class SomeClass.

class SomeClass {
  myArrowFunc = (val) => {
    console.log("Arrow method");
  }

  regularMethod() {
    console.log("Regular method")
  }
}

Here is what the breadcrumbs show for myArrowFunc and regularMethod. They should both be of the same type.

image

image

Thank you

@jrieken jrieken assigned mjbvz and unassigned jrieken Aug 16, 2021
@mjbvz mjbvz transferred this issue from microsoft/vscode Aug 16, 2021
@mjbvz
Copy link
Contributor

mjbvz commented Aug 16, 2021

Duplicate of #25062

myArrowFunc is being listed as a property, which is correct. We've run into issues in the past when trying to be more clever and show it as a function instead

@mjbvz mjbvz removed their assignment Aug 16, 2021
@RyanCavanaugh RyanCavanaugh added the Working as Intended The behavior described is the intended behavior; this is not a bug label Aug 17, 2021
@typescript-bot
Copy link
Collaborator

This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug
Projects
None yet
Development

No branches or pull requests

5 participants