akinsho / flutter-tools.nvim

Tools to help create flutter apps in neovim using the native lsp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LSP not found

collinsmarra opened this issue · comments

image

I am getting that error, and lsp does not work, what can I do to my config to get lsp working?
VsCode recognizes LSP, so where do I need to add to this config to get started?

-- alternatively you can override the default configs
require("flutter-tools").setup {
  ui = {
    -- the border type to use for all floating windows, the same options/formats
    -- used for ":h nvim_open_win" e.g. "single" | "shadow" | {<table-of-eight-chars>}
    border = "rounded",
    -- This determines whether notifications are show with `vim.notify` or with the plugin's custom UI
    -- please note that this option is eventually going to be deprecated and users will need to
    -- depend on plugins like `nvim-notify` instead.
    notification_style = 'native'
    --notification_style = 'native' | 'plugin'

  },
  decorations = {
    statusline = {
      -- set to true to be able use the 'flutter_tools_decorations.app_version' in your statusline
      -- this will show the current version of the flutter app from the pubspec.yaml file
      app_version = true,
      -- set to true to be able use the 'flutter_tools_decorations.device' in your statusline
      -- this will show the currently running device if an application was started with a specific
      -- device
      device = false,
      -- set to true to be able use the 'flutter_tools_decorations.project_config' in your statusline
      -- this will show the currently selected project configuration
      project_config = true,
    }
  },
  -- debugger = { -- integrate with nvim dap + install dart code debugger
  --   enabled = false,
  --   run_via_dap = false, -- use dap instead of a plenary job to run flutter apps
  --   -- if empty dap will not stop on any exceptions, otherwise it will stop on those specified
  --   -- see |:help dap.set_exception_breakpoints()| for more info
  --   exception_breakpoints = {};
  --   register_configurations = function(paths)
  --     require("dap").configurations.dart = {
  --       <put here config that you would find in .vscode/launch.json>
  --     }
  --   end,
  -- }
  --
  flutter_path = "/var/lib/snapd/snap/bin/flutter", -- <-- this takes priority over the lookup
  flutter_lookup_cmd = nil, -- example "dirname $(which flutter)" or "asdf where flutter"
  root_patterns = { ".git", "pubspec.yaml" }, -- patterns to find the root of your flutter project
  fvm = false, -- takes priority over path, uses <workspace>/.fvm/flutter_sdk if enabled
  widget_guides = {
    enabled = false,
  },
  closing_tags = {
    highlight = "ErrorMsg", -- highlight for the closing tag
    prefix = ">", -- character to use for close tag e.g. > Widget
    enabled = true -- set to false to disable
  },
  dev_log = {
    enabled = true,
    notify_errors = false, -- if there is an error whilst running then notify the user
    open_cmd = "tabedit", -- command to use to open the log buffer
  },
  dev_tools = {
    autostart = false, -- autostart devtools server if not detected
    auto_open_browser = false, -- Automatically opens devtools in the browser
  },
  outline = {
    open_cmd = "30vnew", -- command to use to open the outline buffer
    auto_open = false -- if true this will open the outline automatically when it is first populated
  },
  lsp = {
    color = { -- show the derived colours for dart variables
      enabled = false, -- whether or not to highlight color variables at all, only supported on flutter >= 2.10
      background = false, -- highlight the background
      background_color = nil, -- required, when background is transparent (i.e. background_color = { r = 19, g = 17, b = 24},)
      foreground = false, -- highlight the foreground
      virtual_text = true, -- show the highlight using virtual text
      virtual_text_str = "", -- the virtual text character to highlight
    },
    -- on_attach = on_attach,
    -- capabilities = my_custom_capabilities -- e.g. lsp_status capabilities
    --- OR you can specify a function to deactivate or change or control how the config is created
    capabilities = function(config)
      config.specificThingIDontWant = false
      return config
    end,
    -- see the link below for details on each option:
    -- https://github.com/dart-lang/sdk/blob/master/pkg/analysis_server/tool/lsp_spec/README.md#client-workspace-configuration
    settings = {
      showTodos = true,
      completeFunctionCalls = true,
      analysisExcludedFolders = {"/home/collinsm/.pub-cache/hosted/pub.dev"},
      renameFilesWithClasses = "prompt", -- "always"
      enableSnippets = true,
      updateImportsOnRename = true, -- Whether to update imports and other directives when files are renamed. Required for `FlutterRename` command.
    }
  }
}
commented

@collinsmarra I'm guessing you are somewhat new to neovim or at least using the lsp with neovim. I strongly recommend having a read through using neovim's lsp in general which is covered in nvim-lspconfig and I link to that in the intro. I think after that I also recommend ensuring you have flutter installed on your system. This is not like VScode so that vscode recognises it is not really related at all as the setup for nvim is different. You should not use/copy paste the config from the README which I have also documented there.

Apologies but there is no real team maintaining this plugin and I'm spread far to thin to walk you through this. Please have a careful read through the README as it appears you have likely not setup your environment correcty