Skip to content

Go-to-Definition/Find all References/… with JsxNamespacedName are not workingΒ #62123

@JulianCataldo

Description

@JulianCataldo

πŸ”Ž Search Terms

jsx namespace namespaced attribute go to definition ctrl click cmd click vscode language service

πŸ•— Version & Regression Information

Not a regression, I think.

It was made using TS 5.8.3 with this patch, near line 153122:

function getContainingObjectLiteralElementWorker(node) {
  switch (node.kind) {
    case 11 /* StringLiteral */:
    case 15 /* NoSubstitutionTemplateLiteral */:
    case 9 /* NumericLiteral */:
      if (node.parent.kind === 167 /* ComputedPropertyName */) {
        return isObjectLiteralElement(node.parent.parent) ? node.parent.parent : void 0;
      }
    // falls through
    case 80 /* Identifier */:
    case 295 /* JsxNamespacedName */:
      return isObjectLiteralElement(node.parent) && (node.parent.parent.kind === 210 /* ObjectLiteralExpression */ || node.parent.parent.kind === 292 /* JsxAttributes */) && node.parent.name === node ? node.parent : void 0;
  }
  return void 0;
}

That way, the QuickInfo/Hovers are working the same between namespace/non namespaced JSX attributes in VSCode.

Previous issue/PR with Quick Info/Hovers:

⏯ Playground Link

No response

πŸ’» Code

const Pascal = (o: {
  /**
   * Hello
   */
  'prop:foo': string
  /**
   * Bonjour
   */
  'foo': string
}) => <></>;

<Pascal prop:foo='' foo='aaa'></Pascal>

Hover while Ctrl or Cmd is pressed.
Non namespaced attribute get an additional hover, with a context span, and an underlined, clickable definition link (and peeking, etc…).

πŸ™ Actual behavior

Image Image Image Image

πŸ™‚ Expected behavior

Should behave exactly like non namespaced attributes, for every IDE wired features.

Additional information about the issue

Looks like prop and foo symbols are treated separately, and not as a whole, breaking LS features downstream.


Also, unlike the previous (now resolved) Quick Info issue, I can inject programatically Go-to-Definition via LS (Monaco TS worker or TS Plugin) on namespaced attributes:

Image

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