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

TS 4.5.0-dev.20211029: JSX attrbutes not showing in intellisense #136377

Closed
markusjohnsson opened this issue Oct 29, 2021 · 12 comments
Closed

TS 4.5.0-dev.20211029: JSX attrbutes not showing in intellisense #136377

markusjohnsson opened this issue Oct 29, 2021 · 12 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug typescript Typescript support issues upstream-issue-linked This is an upstream issue that has been reported upstream verified Verification succeeded
Milestone

Comments

@markusjohnsson
Copy link

Bug Report

πŸ”Ž Search Terms

jsx tsx props attributes intellisense not working after newline

πŸ•— Version & Regression Information

  • This changed between versions 4.4.4 and 4.5.0-dev.20211029

⏯ Playground Link

Sorry, cannot use JSX in playground.

πŸ’» Code

function MyComponent({ a, b }: { a: number; b: string; }) {
    return <div/>;
}

function Foo() {
    return <div>
        <MyComponent
                  (invoke intellisense here)
        />
    </div>
}

πŸ™ Actual behavior

In 4.5.0-dev.20211029, JSX/TSX props/attributes are not displayed in intellisense completion after a newline.

same line works:
image

after newline, does not work:
image

πŸ™‚ Expected behavior

JSX/TSX props/attributes

4.4.4:
both works:
image

image

@a-tarasyuk
Copy link

I checked the provided example and it looks like the completion works Playground. Are there any additional steps to reproduce this issue?

/cc @andrewbranch

@DanielRosenwasser
Copy link
Member

It repros locally on an insiders VS Code, so I assume that when an editor supports snippet completions (the playground doesn't AFAIK) then we're doing something wrong.

@andrewbranch
Copy link
Member

Ah indeed, this looks like a VS Code bug. I can repro in VS Code, but the TS Server log looks as expected:

{
  "seq": 0,
  "type": "response",
  "command": "completionInfo",
  "request_seq": 231,
  "success": true,
  "body": {
    "isGlobalCompletion": false,
    "isMemberCompletion": true,
    "isNewIdentifierLocation": false,
    "entries": [
      {
        "name": "a",
        "kind": "JSX attribute",
        "kindModifiers": "",
        "sortText": "11",
        "insertText": "a={$1}",
        "replacementSpan": {
          "start": {
            "line": 11,
            "offset": 7
          },
          "end": {
            "line": 11,
            "offset": 8
          }
        },
        "isSnippet": true
      },
      {
        "name": "b",
        "kind": "JSX attribute",
        "kindModifiers": "",
        "sortText": "11",
        "insertText": "b=\"$1\"",
        "replacementSpan": {
          "start": {
            "line": 11,
            "offset": 7
          },
          "end": {
            "line": 11,
            "offset": 8
          }
        },
        "isSnippet": true
      },
      {
        "name": "key",
        "kind": "JSX attribute",
        "kindModifiers": "declare,optional",
        "sortText": "12",
        "insertText": "key={$1}",
        "replacementSpan": {
          "start": {
            "line": 11,
            "offset": 7
          },
          "end": {
            "line": 11,
            "offset": 8
          }
        },
        "isSnippet": true
      }
    ]
  }
}

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Oct 29, 2021

Nice, I'll defer to Andrew's investigation - @mjbvz can you transfer this to the VS Code side? I don't have permissions to do so.

@markusjohnsson
Copy link
Author

I've pushed my repro here: https://github.com/markusjohnsson/ts-46576

@andrewbranch
Copy link
Member

Just verified that our response on a single-line and on the split-line locations looks basically identical, so yeah, I think VS Code is just incorrectly filtering these out for some reason?

@typescript-bot
Copy link

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

@markusjohnsson
Copy link
Author

Was this ever transferred to the vscode tracker?

@mjbvz mjbvz self-assigned this Nov 3, 2021
@mjbvz mjbvz transferred this issue from microsoft/TypeScript Nov 3, 2021
@mjbvz mjbvz reopened this Nov 3, 2021
@mjbvz mjbvz added this to the November 2021 milestone Nov 3, 2021
@andrewbranch
Copy link
Member

@markusjohnsson thanks for the reminder ☝️

@mjbvz
Copy link
Collaborator

mjbvz commented Nov 5, 2021

@andrewbranch I believe the root cause is that ts now returns a replacementSpan in this example:

  "insertText": "b=\"$1\"",
            "replacementSpan": {
                "start": {
                    "line": 9,
                    "offset": 9
                },
                "end": {
                    "line": 9,
                    "offset": 10
                }
            },

Do you know why this span is being returned? It seems to map to the closing / in /> which seems incorrect

We probably need to fix this for November VS Code release (start of December)

@mjbvz mjbvz added bug Issue identified by VS Code Team member as probable bug typescript Typescript support issues labels Nov 5, 2021
@mjbvz mjbvz added the upstream-issue-linked This is an upstream issue that has been reported upstream label Nov 10, 2021
@andrewbranch
Copy link
Member

@mjbvz the fix for this is in the 4.5 branch now πŸ‘

@mjbvz
Copy link
Collaborator

mjbvz commented Nov 15, 2021

Thanks @andrewbranch! Closing as fixed upstream

@mjbvz mjbvz closed this as completed Nov 15, 2021
@roblourens roblourens added the verified Verification succeeded label Dec 2, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Dec 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug typescript Typescript support issues upstream-issue-linked This is an upstream issue that has been reported upstream verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

7 participants