neovim

Personal neovim configuration files
git clone git://gtms.dev/neovim
Log | Files | Refs

dartls.lua (1955B)


      1 local capabilities = {
      2   textDocument = {
      3     hover = {
      4       dynamicRegistration = false
      5     },
      6     inlayHint = {
      7       dynamicRegistration = false
      8     },
      9     rename = {
     10       dynamicRegistration = false,
     11     },
     12     codeAction = {
     13       dynamicRegistration = false
     14     },
     15     rangeFormatting = {
     16       dynamicRegistration = false
     17     },
     18     formatting = {
     19       dynamicRegistration = false
     20     },
     21     definition = {
     22       dynamicRegistration = false
     23     }
     24   },
     25   workspace = {
     26     workspaceEdit = { documentChanges = true },
     27     fileOperations = { willRename = true }
     28   },
     29 }
     30 
     31 return {
     32   -- cmd = { --
     33   --   'docker', 'run', '--rm', '-i',
     34   --   '-v', string.format('.:%s', root_dir),
     35   --   '-w', root_dir,
     36   --   '-p', '10000:10000',
     37   --   'dart:3.4.0', 'dart', 'language-server', '--protocol=lsp', '--diagnostic-port=10000',
     38   --   -- '--instrumentation-log-file=/tmp/dart-plugin-log',
     39   -- },
     40   -- cmd = vim.lsp.rpc.connect('localhost', 10000),
     41   cmd = { --
     42     'dart',
     43     'language-server',
     44     '--protocol=lsp',
     45     '--port=10000',
     46     -- '--instrumentation-log-file=/tmp/dart-plugin-log',
     47   },
     48   capabilities = vim.tbl_deep_extend('force', vim.lsp.protocol.make_client_capabilities(), capabilities),
     49   init_options = {
     50     closingLabels = true,
     51     outline = false,
     52     flutterOutline = false,
     53   },
     54   settings = { dart = { completeFunctionCalls = true, showTodos = true } },
     55   handlers = {
     56     ['dart/textDocument/publishClosingLabels'] = require 'dart-tools.lsp.labels'.handler(),
     57     ['dart/textDocument/super'] = function(_, result, ctx)
     58       local client = vim.lsp.get_client_by_id(ctx.client_id)
     59       if client then
     60         vim.lsp.util.show_document(result, client.offset_encoding)
     61       end
     62     end,
     63     ['dart/textDocument/imports'] = function(_, result, ctx)
     64       local client = vim.lsp.get_client_by_id(ctx.client_id)
     65       if client then
     66         vim.lsp.util.show_document(result, client.offset_encoding)
     67       end
     68     end,
     69   },
     70 }