mirror of
https://github.com/pojokcodeid/nvim-lazy.git
synced 2025-06-21 16:39:04 +02:00
fix lsp register ^& code runner config
This commit is contained in:
parent
38d2c29a95
commit
418a659142
4 changed files with 29 additions and 12 deletions
|
@ -33,6 +33,7 @@ config = {
|
||||||
unregister_lsp = opt("unregister_lsp", {}),
|
unregister_lsp = opt("unregister_lsp", {}),
|
||||||
null_ls_sources = opt("null_ls_sources", {}),
|
null_ls_sources = opt("null_ls_sources", {}),
|
||||||
whichkey = opt("whichkey", {}),
|
whichkey = opt("whichkey", {}),
|
||||||
|
coderunner = opt("coderunner", {}),
|
||||||
}
|
}
|
||||||
|
|
||||||
return config
|
return config
|
||||||
|
|
|
@ -113,3 +113,8 @@ vim.g.pcode_whichkey = {
|
||||||
},
|
},
|
||||||
["o"] = { "<cmd>SymbolsOutline<cr>", "Symbol Outline" },
|
["o"] = { "<cmd>SymbolsOutline<cr>", "Symbol Outline" },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- https://github.com/CRAG666/code_runner.nvim
|
||||||
|
vim.g.pcode_coderunner = {
|
||||||
|
javascript = "node $dir/$fileName",
|
||||||
|
}
|
||||||
|
|
|
@ -2,18 +2,27 @@ local status_ok, code_runner = pcall(require, "code_runner")
|
||||||
if not status_ok then
|
if not status_ok then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local filetype = {
|
||||||
|
java = "cd $dir && javac $fileName && java $fileNameWithoutExt",
|
||||||
|
python = "python3 -u",
|
||||||
|
typescript = "deno run",
|
||||||
|
rust = "cd $dir && rustc $fileName && $dir/$fileNameWithoutExt",
|
||||||
|
-- cpp="gcc $fileName -lstdc++ -o $fileNameWithoutExt && $fileNameWithoutExt"
|
||||||
|
cpp = "g++ $fileName -o $fileNameWithoutExt && $dir/$fileNameWithoutExt",
|
||||||
|
scss = "sass $dir/$fileName $dir/$fileNameWithoutExt.css",
|
||||||
|
}
|
||||||
|
|
||||||
|
local data_exists, runscript = pcall(require, "core.config")
|
||||||
|
if data_exists then
|
||||||
|
for _, code in pairs(runscript.coderunner) do
|
||||||
|
table.insert(filetype, code)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
code_runner.setup({
|
code_runner.setup({
|
||||||
-- put here the commands by filetype
|
-- put here the commands by filetype
|
||||||
filetype = {
|
filetype = filetype,
|
||||||
java = "cd $dir && javac $fileName && java $fileNameWithoutExt",
|
|
||||||
python = "python3 -u",
|
|
||||||
typescript = "deno run",
|
|
||||||
javascript = "node $dir/$fileName",
|
|
||||||
rust = "cd $dir && rustc $fileName && $dir/$fileNameWithoutExt",
|
|
||||||
-- cpp="gcc $fileName -lstdc++ -o $fileNameWithoutExt && $fileNameWithoutExt"
|
|
||||||
cpp = "g++ $fileName -o $fileNameWithoutExt && $dir/$fileNameWithoutExt",
|
|
||||||
scss = "sass $dir/$fileName $dir/$fileNameWithoutExt.css",
|
|
||||||
},
|
|
||||||
-- mode = "term",
|
-- mode = "term",
|
||||||
mode = "float",
|
mode = "float",
|
||||||
focus = true,
|
focus = true,
|
||||||
|
|
|
@ -27,9 +27,11 @@ end
|
||||||
local data_ok, unregis = pcall(require, "core.config")
|
local data_ok, unregis = pcall(require, "core.config")
|
||||||
if data_ok then
|
if data_ok then
|
||||||
if unregis.unregister_lsp ~= nil then
|
if unregis.unregister_lsp ~= nil then
|
||||||
for _, unreg in pairs(custom_lsp.unregister_lsp) do
|
for _, unreg in pairs(unregis.unregister_lsp) do
|
||||||
local my_index = idxOf(servers, unreg)
|
local my_index = idxOf(servers, unreg)
|
||||||
table.remove(servers, my_index)
|
if my_index ~= nil then
|
||||||
|
table.remove(servers, my_index)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue