lewis6991 / impatient.nvim

Improve startup time for Neovim
MIT License
1.19k stars 28 forks source link

attempt to perform arithmetic on field 'exec' (a nil value) #30

Closed yujinyuz closed 3 years ago

yujinyuz commented 3 years ago

When I use

require('impatient').enable_profile()

I get an error

packer.nvim: Error running config for nvim-lspconfig: ...ck/packer/start/impatient.nvim/lua/impatient/profile.lua:148: attempt to perform arithmetic on field 'exec' (a nil value)

I don't have this proble with

require('impatient')
lewis6991 commented 3 years ago

I don't get this error. You need to provide more details.

megalithic commented 3 years ago

Samesies; I'm getting this only for enable_profile();

I'm very simply calling the following, from my init.lua at the root of my nvim:

local ok, impatient = pcall(require, "impatient")
if ok then
  impatient.enable_profile()
end

Same error as @yujinyuz

yujinyuz commented 3 years ago

I don't get the errors anymore but I get this message

impatient: [error] dependency config/lsp of workspace does not have profile results. Results will be inaccurate
impatient: [error] dependency packer_compiled of workspace does not have profile results. Results will be inaccurate

What should I do in order to resolve this?

This is what have

-- Load globals
require('globals')
-- Make `vim.keymap` available
require('utils._keymap_port')
-- Load global helpers
require('utils')
require('packer_compiled')
require('impatient').enable_profile()
-- Load options
require('options')
-- Load plugins last
require('plugins')

Is this right?

lewis6991 commented 3 years ago

From the README:

impatient needs to be setup before any other lua plugin is loaded so it is recommended you add the following near the start of your init.vim.

Yet in your config you are requiring several modules before impatient.

Move impatient to the top.

yujinyuz commented 3 years ago

@lewis6991 I tried moving require('impatient').enable_profile() to the top but still getting the same error

lewis6991 commented 3 years ago

The error happens because there is a require happening before impatient is loaded.

yujinyuz commented 3 years ago

Can't seem to figure out why. I've already moved the require('impatient').enable_profile() to the top most of my init.lua but I'm still getting the same error.

I'll just remove the .enable_profile() for now and will try to investigate further

lewis6991 commented 3 years ago

I did some more tweaks with https://github.com/lewis6991/impatient.nvim/commit/561b86e5602def047010d451c3e7977a65982788 and it will hopefully fix the issue you are seeing.