neoclide / coc-tsserver

Tsserver extension for coc.nvim that provide rich features like VSCode for javascript & typescript
MIT License
1.05k stars 68 forks source link

Prevent coc-fix-current from importing React #288

Closed jstewart-fractal closed 3 years ago

jstewart-fractal commented 3 years ago

Is there a way to prevent coc-fix-current from importing React?

I'm trying to use coc-fix-current to import the component under the cursor. Unfortunately, it's importing React instead:

import React from 'react';

If I then run coc-fix-current again, it'll import the component under the cursor.

The problem is that I'm using React 17, and it's no longer necessary to import React (unless you're explicitly using it). In fact, after it's imported, it's immediately flagged as an unused import.

I'd like for it to be smarter about this, skip the React import step, and import the component on the first attempt.

chemzqm commented 3 years ago

Should be problem of your language server, checkout https://github.com/neoclide/coc.nvim/wiki/Debug-language-server#using-output-channel