FuelLabs / sway.vim

Vim syntax file for Sway.
Apache License 2.0
18 stars 11 forks source link

Pass initialization options from the client to the server. #6

Closed JoshuaBatty closed 1 year ago

JoshuaBatty commented 1 year ago

@sdankel noticed in #2 that the init_options are being ignored when passed through to the server, as below:

if not configs.sway_lsp then
   configs.sway_lsp = {
     default_config = {
       cmd = {'forc-lsp'},
       filetypes = {'sway'},
       -- This was missing!
       on_attach = on_attach,
       --  These are ignored for some reason :(
       --  init_options = {
       --  logging = { level = 'trace' },
       --  inlayHints = { maxLength = 25, renderColons = true, typeHints = true },
       --  trace = { trace = true, server = 'messages' }
       },
       root_dir = function(fname)
         return lspconfig.util.find_git_ancestor(fname)
       end;
       settings = {};
     };
   }
 end

We should dig a bit harder to identify what part of the pipeline is failing to either pass or accept these arguments.

sdankel commented 1 year ago

This configuration worked:

       init_options = {
         logging = { level = 'trace' },
         inlayHints = { maxLength = 25, renderColons = true, typeHints = true },
         trace = {},
         debug = { showCollectedTokensAsWarnings = 'off' }
       },

It looks like all of the fields in the initialization options must be present or else the config is ignored.

Additionally, I noticed that TraceConfig is currently ignored. We might want to remove it if it's replaced by the LoggingConfig

sdankel commented 1 year ago

We may also want to make the configs optional, if we want to allow passing partial init config.