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

lsp: completions in jsx props, the value is set to "$1" or {$1} #15367

Closed
luke-john opened this issue Jul 31, 2022 · 3 comments · Fixed by #16274
Closed

lsp: completions in jsx props, the value is set to "$1" or {$1} #15367

luke-john opened this issue Jul 31, 2022 · 3 comments · Fixed by #16274
Assignees
Labels
bug Something isn't working lsp related to the language server

Comments

@luke-john
Copy link

Describe the bug

When autocompleting props in jsx the prop is set to have the value;

  • for props which accept functions {$1}
  • and for props which accept strings "$1".

Note: This consistently seems to occur for props which accept a function or string value, but not for props which accept a boolean value.

To Reproduce

  1. Create a tsx file (extension ends in .tsx
  2. Either import React -- or set a custom jsx factory and import that
  3. Write some jsx
  4. In the jsx start writing a property which accepts a string or function value and use the autocomplete.

Expected behaviour

The prop is set to have the value;

  • for props which accept functions {}
  • and for props which accept strings ""

Current behaviour

The prop is set to have the value;

  • for props which accept functions {$1}
  • and for props which accept strings "$1"

Screenshots

jsx-props-autocomplete-repro

Versions

  • vscode
    Version: 1.69.2 (Universal)
    Commit: 3b889b090b5ad5793f524b5d1d39fda662b96a2a
    Date: 2022-07-18T16:12:57.074Z (1 wk ago)
    Electron: 18.3.5
    Chromium: 100.0.4896.160
    Node.js: 16.13.2
    V8: 10.0.139.17-electron.0
    OS: Darwin x64 20.6.0
  • deno
    % deno --version
    deno 1.24.1 (release, x86_64-apple-darwin)
    v8 10.4.132.20
    typescript 4.7.4
  • extension v3.13.1
@kitsonk kitsonk transferred this issue from denoland/vscode_deno Aug 1, 2022
@kitsonk kitsonk changed the title When autocompleting props in jsx the value is set to "$1" or {$1} lsp: completions in jsx props, the value is set to "$1" or {$1} Aug 1, 2022
@kitsonk kitsonk added bug Something isn't working lsp related to the language server labels Aug 1, 2022
@kitsonk
Copy link
Contributor

kitsonk commented Aug 1, 2022

we updated our completions to be more current with the current state of play, and I think we are handling the return from the TypeScript language server 100% correctly.

@kitsonk kitsonk closed this as completed Aug 1, 2022
@kitsonk kitsonk reopened this Aug 1, 2022
@kitsonk
Copy link
Contributor

kitsonk commented Aug 1, 2022

ooops, only meant to comment, not close...

@kitsonk
Copy link
Contributor

kitsonk commented Sep 29, 2022

There are several auto completions and quick fixes coming from the language server that appear to require some sort of argument interpolation, where what comes back is "$1" or {$1}. It seems the language server (tsc) is sending it back and it is up to the client to interpolate some variables. When the code was adapted from vscode and the built in language server it seems like we might have missed that piece of the puzzle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lsp related to the language server
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants