-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to import coq #11
Comments
coq imports itself when your package manager loads it. dont worry, it does like almost zero work and just registers two functions to the global scope, one to start the program when you call |
humm im not familiar with
and yeah the snippet template showing is intentional, some snippets do not have names and only their snippet body. Its probably best to show it imo, so you know what each one does. |
Same issue here with |
Are you sure |
OH I will need to investigate that, I assumed all plugin managers called |
I will do that tomorrow probably, i have no brain cells left for tonight, and I promise my mom id go to Ikea with her, so tomorrow night, sorry about delay |
@ms-jpq Ok i checked it. I added some print statements
Somehow someway this is the order. It was not because packer lazy loading it (I think) because packer does not lazy load unless there are additional loading conditions are there. In my case I don't have any conditions. |
@ms-jpq Did you try putting every variable and function into a table and return the table? local M = {}
M.config = default_config
function M.init(config)
...
end
return M
and then calling via lua require("iswap").init()
command ... should work. For some reason also I dont understand the usage of luaeval and how it interacts with luaeval. My guess is that you try to use |
Investigating this as well, seems like Best thing is to not lazy load it and just load it on demand, then you have the -- load with packer
use {'neovim/nvim-lspconfig'}
use {'ms-jpq/coq_nvim'}
...
-- somewhere after packer have loaded lspconfig and coq
lsp.<server>.setup(coq.lsp_ensure_capabilities(<your config>))
|
I think @creativenull has got this? I will try it later after IKEA and put it in the docs. @matu3ba I actually need let s:top_level = resolve(expand('<sfile>:p:h:h')) I need the absolute path of |
plenary.nvim (intended to be eventually nvim lua std) has a convenient parent method and Unfortunately there is still no git library or anything in plenary for getting the git_root (which would be a clearner solution). plenary.nvim is already used by telescope, so using it as dependency would not be too much of an additional dependency. nvim-lspconfig uses inside utils.lua are hacky search reverse 100 times until you find a |
oh wtf, |
Pretty sure when calling |
@ms-jpq I tried to remove print(api.nvim_eval("expand('<sfile>:p:h:h')"))
print(api.nvim_eval("expand('<sfile>:p:h')"))
print(api.nvim_eval("expand('<sfile>:p')"))
> /home/s1n7ax/.config/nvim
> /home/s1n7ax/.config/nvim/plugin
> /home/s1n7ax/.config/nvim/plugin/packer_compiled.lua So you are going to need that |
yeah thank you for the help, ive been testing this and its tricky. because |
Ok i think I got it vim.schedule(function ()
local lsp = require "lspconfig"
require("packer").loader("coq_nvim coq.artifacts")
lsp.<server>.setup(require("coq")().lsp_ensure_capabilities(<stuff...>))
end) had to read packers code to figure it out |
I guess you don't need to manually load if it is being accessed in the next event loop and it is a dependency. This works for me use {
'kabouzeid/nvim-lspinstall',
run = function()
require('nvim.plugins.lspinstall').install_servers()
end,
requires = {
{'neovim/nvim-lspconfig'}
},
}
use {
'neovim/nvim-lspconfig',
config = function() require('nvim.plugins.lsp') end,
requires = {
{'ms-jpq/coq_nvim', branch = 'coq'},
{'ms-jpq/coq.artifacts', branch = 'artifacts'},
},
} vim.schedule(function()
vim.cmd('COQnow')
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup(coq.lsp_ensure_capabilities({
on_attach = on_attach_callback,
}))
end
end) |
thanks @s1n7ax I will add your comment to the readme. |
I dont think unless you want that of course |
O_o It won't start unless I add |
0.o ok maybe use my manual load method haha, I guess ill remove ur comment to reduce confusion. oh and everybody please update your repo or else my snippet wont work. |
I don't know if I didn't update properly or if the issue only addressed Packer, but I still get the nil value problem. I am using Plugged. |
Oh ok nevermind, I thought it only affected |
FWIW packer does not lazy load by default. One of the main differences between it and other solutions is that it uses vim's native packages feature
In the specific case of this plugin I think the issue is that unlike other I think a better solution would be to just return the function script_path()
local str = debug.getinfo(2, "S").source:sub(2)
return str:match("(.*/)")
end
print(script_path()) to get the location of the file that the function was called from (source) So the coq module should do something more like local coq = {}
function coq.setup()
local start_location = ... -- derive this with the above snippet
... -- other stuff
end
function coq.lsp_function_thing()
-- logic here
end
return coq -- rather than return function() ... end |
its done. I will close this issue. If things still don't work, please re-open it. |
In the readme it shows following snippet.
Apparently
require('coq')
is a function and what needs to be passed in to the function?The text was updated successfully, but these errors were encountered: