neovim

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

dartls.lua (2044B)


      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     onlyAnalyzeProjectsWithOpenFiles = true,
     51     suggestFromUnimportedLibraries = true,
     52     closingLabels = true,
     53     outline = true,
     54     flutterOutline = true,
     55   },
     56   settings = { dart = { completeFunctionCalls = true, showTodos = true } },
     57   handlers = {
     58     -- ['dart/textDocument/publishClosingLabels'] = require 'dart-tools.lsp.labels'.handler(),
     59     ['dart/textDocument/super'] = function(_, result, ctx)
     60       local client = vim.lsp.get_client_by_id(ctx.client_id)
     61       if client then
     62         vim.lsp.util.show_document(result, client.offset_encoding)
     63       end
     64     end,
     65     ['dart/textDocument/imports'] = function(_, result, ctx)
     66       local client = vim.lsp.get_client_by_id(ctx.client_id)
     67       if client then
     68         vim.lsp.util.show_document(result, client.offset_encoding)
     69       end
     70     end,
     71   },
     72 }