DEV Community

Discussion on: Neovim LSP to replace VSCode

Collapse
 
voyeg3r profile image
Sérgio Araújo

It would be great adding a safe call at each plugin setting like this:

local cmp_status_ok, cmp = pcall(require, "cmp")
if not cmp_status_ok then
    return
end
Enter fullscreen mode Exit fullscreen mode

Just in case the call fail, we just get a return without trying to read the rest of config file, the same for the packer config:

-- Use a protected call so we don't error out on first use
local status_ok, packer = pcall(require, "packer")
if not status_ok then
    return
end
Enter fullscreen mode Exit fullscreen mode
Collapse
 
voyeg3r profile image
Sérgio Araújo

By the way pcall it is, if I am not wrong, the same as a try catch statement.

Collapse
 
casonadams profile image
Cason Adams

Great suggestion. I updated the git repo. Not sure if I should update this post or not. I am thinking no. And hopefully most people just go look at the source repo.

Thread Thread
 
kchawla_pi profile image
Kshitij Chawla

I always add an update to my posts. A lot of new devs rely on good blogs to get started.