Skip to content

Commit

Permalink
Merge pull request #4 from primalmotion/lsp-diagnostics
Browse files Browse the repository at this point in the history
new: added lsp_diagnostics to enable LSP diagnostics
  • Loading branch information
magicmonty authored Apr 14, 2024
2 parents 0b66e4e + 65098b3 commit 9204aec
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ The default configuration is as follows, you can override it with your own setti
```lua
require('sonicpi').setup({
server_dir = "", -- It will try to find the SonicPi server
lsp_diagnostics = false -- enable LSP diagnostics
mappings = {
{ 'n', '<leader>s', require('sonicpi.remote').stop, default_mapping_opts },
{ 'i', '<M-s>', require('sonicpi.remote').stop, default_mapping_opts },
Expand Down
4 changes: 3 additions & 1 deletion lua/sonicpi/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ M.setup = function(opts)

local options = require('sonicpi.opts')
options.server_dir = vim.trim(server_dir)
options.lsp_diagnostics = opts.lsp_diagnostics

M.setup_cmp()
M.setup_treesitter()
Expand All @@ -131,9 +132,10 @@ M.lsp_on_init = function(client, opts)
end

if client.name == 'solargraph' and vim.api.nvim_buf_get_option(0, 'filetype') == 'sonicpi' then
local diagnostics = (opts and opts.lsp_diagnostics) or require('sonicpi.opts').lsp_diagnostics
local cfg = client.config.settings.solargraph
client.config.settings.single_file_support = true
cfg.diagnostics = false
cfg.dagnostics = diagnostics
cfg.reporters = { 'typecheck', 'update_errors' }

cfg.include = cfg.include or {}
Expand Down
1 change: 1 addition & 0 deletions lua/sonicpi/opts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ local default_mapping_opts = { noremap = true, silent = true, buffer = 0 }

return {
server_dir = '',
lsp_diagnostics = false,
cmp_source = {
keywords = {
synths = {},
Expand Down

0 comments on commit 9204aec

Please sign in to comment.