Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Cannot locate component (goto definition) in a React project #570

@carlbolduc

Description

@carlbolduc

With the following code:

import React from "react";
import OtherComponent from "./OtherComponent";

const MainComponent = props => {
  return (
    <tr>
      <td>{props.item.date}</td>
      <td>{props.item.description}</td>
      <td style={{ textAlign: "center" }}>
        <OtherComponent onClick={() => props.doStuff()} />
      </td>
    </tr>
  );
};

export default MainComponent;

Calling xref-find-definitions using M-. (goto definition) in Emacs will go to the second line of the file (import OtherComponent from "./OtherComponent";) instead of actually going to the file where OtherComponent is defined.

Trying the same thing with typescript-language-server will go to the file where OtherComponent is defined.

More details about this issue can be found here:
joaotavora/eglot#243

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions