summaryrefslogtreecommitdiff
path: root/ftplugin/dart.lua
blob: f9b68e9de9e4bb68523073672a7c55b343d63bd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
O.formatters.filetype["dart"] = {
  function()
    return {
      exe = O.lang.dart.formatter.exe,
      args = O.lang.dart.formatter.args,
      stdin = not (O.lang.dart.formatter.stdin ~= nil),
    }
  end,
}

require("formatter.config").set_defaults {
  logging = false,
  filetype = O.formatters.filetype,
}
if require("lv-utils").check_lsp_client_active "dartls" then
  return
end

require("lspconfig").dartls.setup {
  cmd = { "dart", O.lang.dart.sdk_path, "--lsp" },
  on_attach = require("lsp").common_on_attach,
  init_options = {
    closingLabels = false,
    flutterOutline = false,
    onlyAnalyzeProjectsWithOpenFiles = false,
    outline = false,
    suggestFromUnimportedLibraries = true,
  },
}