diff --git a/lua/lsp.lua b/lua/lsp.lua index b2dc428..6d7cbeb 100644 --- a/lua/lsp.lua +++ b/lua/lsp.lua @@ -83,6 +83,20 @@ require('mason-lspconfig').setup_handlers({ -- and will be called for each installed server that doesn't have -- a dedicated handler. function(server_name) -- default handler (optional) + + -- 2024-10-29 Solargraph shall handle ruby AND sonicpi files, add on_init according to documentation + if server_name == "solargraph" then + lspconfig[server_name].setup { + on_attach = on_attach, + config = { + on_init = function(client) + require('sonicpi').lsp_on_init(client, { server_dir = '/opt/sonic-pi/app/server' }) + end + }, + filetypes = { 'ruby', 'sonicpi' }, + } + end + if server_name == 'ts_ls' then -- taken from https://github.com/vuejs/language-tools -- If you are using mason.nvim, you can get the ts_plugin_path like this diff --git a/lua/plugins.lua b/lua/plugins.lua index ecf20dc..22daadf 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -448,17 +448,32 @@ require("lazy").setup({ }, -- -- Live Coding: sonic-pi music programming - -- { - -- 'magicmonty/sonicpi.nvim', - -- -- broken if used here, setup called further below - -- -- config = function() - -- -- require('sonicpi').setup() - -- -- end, - -- dependencies = { - -- 'hrsh7th/nvim-cmp', - -- 'kyazdani42/nvim-web-devicons' - -- }, - -- }, + { + 'magicmonty/sonicpi.nvim', + -- broken if used here, setup called further below + config = function() + require('sonicpi').setup({ + server_dir = '/opt/sonic-pi/app/server', + lsp_diagnostics = true, + mappings = { + { 'n', 'd', ':SonicPiStartDaemon', { desc = 'Sonic Pi: start daemon' } }, + { 'n', 's', require('sonicpi.remote').stop, { desc = 'Sonic Pi: stop' } }, + { 'i', '', require('sonicpi.remote').stop, { desc = 'Sonic Pi: stop' } }, + { 'n', 'r', require('sonicpi.remote').run_current_buffer, { desc = 'Sonic Pi: run' } }, + { 'i', '', require('sonicpi.remote').run_current_buffer, { desc = 'Sonic Pi: run' } }, + { 'n', 'R', ':SonicPiSendBuffer', { desc = 'Sonic Pi: send buffer' } }, + { 'i', '', ':SonicPiSendBuffer', { desc = 'Sonic Pi: send buffer' } }, + -- // TODO.2024-10-29 implement sending of tree-sitter node + { 'n', '', function() end, { desc = 'Sonic Pi: send current' } }, + }, + single_file = true, + }) + end, + dependencies = { + 'hrsh7th/nvim-cmp', + 'kyazdani42/nvim-web-devicons' + }, + }, -- easy term on a shortcut { @@ -487,17 +502,3 @@ require("lazy").setup({ end, }, }) - --- require('sonicpi').setup({ --- server_dir = '/opt/sonic-pi/app/server', --- mappings = { --- { 'n', 'd', ':SonicPiStartDaemon', { desc = 'Sonic Pi: start daemon' } }, --- { 'n', 's', require('sonicpi.remote').stop, { desc = 'Sonic Pi: stop' } }, --- { 'i', '', require('sonicpi.remote').stop, { desc = 'Sonic Pi: stop' } }, --- { 'n', 'r', require('sonicpi.remote').run_current_buffer, { desc = 'Sonic Pi: run' } }, --- { 'i', '', require('sonicpi.remote').run_current_buffer, { desc = 'Sonic Pi: run' } }, --- { 'n', 'R', ':SonicPiSendBuffer', { desc = 'Sonic Pi: send buffer' } }, --- { 'i', '', ':SonicPiSendBuffer', { desc = 'Sonic Pi: send buffer' } }, --- }, --- single_file = true, --- })