I reordered the code in a more clean an organized way. Also this improves a lot the emacs startup time again, bucause after some updates it becomes a bit slow with the old configuration, so i did it again in a new way.
I will no longer maintain the lsp-mode config just now, eglot is better for me and just fits really well with my necesities.