使用 Next.js 在 Vim Coc-tsserver 上自动导入

bru*_*uno 2 vim eslint neovim next.js typescript-eslint

我在 Neovim 上使用 coc-tsserver 来使用 Next.js 进行编程,但自动导入功能不起作用。当我尝试使用 Next 模块(例如标签)时,<Link>它可以"import Link from 'next/link'"正常识别,但是当导入行丢失时,它无法找到该模块。我已经尝试配置 tsserver 以使用外部 Eslint 包,但它仍然无法正常工作(即使yarn Eslint 包在未指定时也无法找到下一个模块)。如何在 Eslint/coc-tsserver 上自动导入 Next.js 模块?

小智 5

来自 tsserver 文档 https://github.com/neoclide/coc-tsserver

您可能需要将下面的代码添加到您的 coc-config 中

"javascript.suggest.autoImports": true, 
"typescript.suggest.autoImports": true
Run Code Online (Sandbox Code Playgroud)

:CocConfig