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

Sometimes when using JSX Tag completion, the trailing tag termination character disappears #46704

Closed
yamachu opened this issue Nov 1, 2021 · 2 comments · Fixed by #46767
Closed
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue

Comments

@yamachu
Copy link

yamachu commented Nov 1, 2021

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

  • VS Code Version: 1.62.0-insider (Universal) Commit: ff1e16e
  • OS Version: macOS 10.15.7
  • Extension: JavaScript and TypeScript Nightly v4.5.20211031

Steps to Reproduce:

  1. Open React JSX file
  2. Write a JSX tag and select the hovered completion content (with return key)

remove-trailing-tag

related issue
microsoft/vscode#82324

@mjbvz mjbvz transferred this issue from microsoft/vscode Nov 5, 2021
@mjbvz
Copy link
Contributor

mjbvz commented Nov 5, 2021

Possibly a similar root cause to microsoft/vscode#136377

Minimal example:

import * as React from 'react';

const a = (
    <span >

    </span>;
)

The replacement span returned is:

 "replacementSpan": {
                "start": {
                    "line": 4,
                    "offset": 11
                },
                "end": {
                    "line": 4,
                    "offset": 12
                }
            },

Which ends up replacing the closing >

@mjbvz mjbvz removed their assignment Nov 5, 2021
@andrewbranch
Copy link
Member

I think we probably don’t need a replacement span at all for JSX attribute completions. The identifier that the user started to type should already automatically be set as the optionalReplacementSpan on the top-level response. Otherwise, I don’t think there’s anything to replace.

@andrewbranch andrewbranch added the Bug A bug in TypeScript label Nov 8, 2021
@andrewbranch andrewbranch added this to the TypeScript 4.5.2 milestone Nov 8, 2021
@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label Nov 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants