WIP per project lsp

main
spike 2 years ago
parent 9ed0bc830d
commit 96ff0ce5d6

@ -1,30 +0,0 @@
-- helper module for setting custom lsp settings per project
-- will be used for setting autostart of lspclient per projects
local autocmd = vim.api.nvim_create_autocmd
local augroup = vim.api.nvim_create_augroup
local augroup_name = "spike_lsp"
local function per_project_file()
local cwd = vim.fn.getcwd()
-- TODO:
-- check if there is a custom .nvim-lsp file in dir
-- read custom lsp config from file in table format
-- clean merge it ? with local template config to avoid random vars
-- setup local callback functions automatically called if certain settings
-- are present.
end
augroup( augroup_name ,{})
autocmd({"BufReadPre"},{
group = augroup_name,
pattern = "*",
callback = per_project_file,
})
autocmd({"DirChanged"},{
group = augroup_name,
pattern = "window",
callback = per_project_file
})

@ -0,0 +1,50 @@
-- helper module for setting custom lsp settings per project
-- will be used for setting autostart of lspclient per projects
local ok, Path = pcall(require, "plenary.path")
if not ok then
print("plenary required !")
end
-- local scandir = require("")
local pp = require("spike.perproject")
local autocmd = vim.api.nvim_create_autocmd
local augroup = vim.api.nvim_create_augroup
local augroup_name = "spike_lsp"
local custom
local function per_project_file()
local cwd = Path.new(vim.fn.getcwd())
local pp_dir = cwd:joinpath(pp.base_dirname)
if pp_dir:is_dir() then
print(pp_dir)
else
-- print("no " .. pp.base_dirname)
end
-- TODO:
-- check if there is a custom .nvim-lsp dir in working dir
-- each file inside .nvim-lsp represent a active option if
-- it is present
-- example
-- workingDir/
-- .perproject/
-- lsp.autostart --> autostart lsp for this project
end
per_project_file()
augroup( augroup_name ,{}) -- automatically clears prev group commands
autocmd({"BufReadPre"},{
group = augroup_name,
pattern = "*",
callback = per_project_file,
})
autocmd({"DirChanged"},{
group = augroup_name,
pattern = "window",
callback = per_project_file
})
Loading…
Cancel
Save