Skip to content

Automatically resolves imports for undefined terms in neovim.

License

Notifications You must be signed in to change notification settings

nmrtv/nvim-lspimport

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LSP Import

Resolves imports for undefined terms by using LSP completion API. It's primary usage is to support automatic imports for pyright language server.

lspimport.mov

Installation

Using lazy.nvim:

{ "stevanmilic/nvim-lspimport" }

Configuration

Mappings are not set by default, hence it's required to set a mapping for resolving import:

vim.keymap.set("n", "<leader>a", require("lspimport").import, { noremap = true })

Once mapping is set, jump on the line with an undefined term and execute mapping to resolve import.

Supported language servers

NOTE: In order for pyright to resolve an import, module containing it should be used in the workspace; otherwise import won't be found. Hence the auto-import feature works well in modules loaded with pre-loaded imports. Auto-imports are limited to only those symbols and modules that have been imported somehwhere else in the program.

About

Automatically resolves imports for undefined terms in neovim.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Lua 100.0%