Skip to content

Autocomplete after -> in PHP (intelephense) #2234

@jannes-io

Description

@jannes-io

Feature Description

Hi there, I'm migrating over from nvim-cmp, and there when I entered -> it would immediately suggest all the options. While using blink.cmp it does not.

I'm using a heavily modified version of neovim kickstart. But here are the relevant bits and pieces:

plugins/autocomplete.lua

{
  { -- Autocompletion
    'saghen/blink.cmp',
    event = 'VimEnter',
    version = '1.*',
    dependencies = {
      {
        'L3MON4D3/LuaSnip',
        version = 'v2.*',
        build = 'make install_jsregexp',
      },
      'folke/lazydev.nvim',
    },
    opts = {
      keymap = {
        preset = 'super-tab',
      },

      appearance = {
        nerd_font_variant = 'mono',
      },

      completion = {
        autocomplete = true,
        trigger_on_insert_enter = true,
        documentation = { auto_show = false, auto_show_delay_ms = 250 },
      },

      sources = {
        default = { 'lsp', 'path', 'snippets', 'lazydev' },
        providers = {
          lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 },
        },
      },

      snippets = { preset = 'luasnip' },
      fuzzy = { implementation = 'prefer_rust' },
      signature = { enabled = true },
    },
  },
  {
    'neovim/nvim-lspconfig',
    dependencies = {
      { 'mason-org/mason.nvim', opts = {} },
      'mason-org/mason-lspconfig.nvim',
      'WhoIsSethDaniel/mason-tool-installer.nvim',
      { 'j-hui/fidget.nvim', opts = {} },
      'saghen/blink.cmp',
    },
    config = function()
      -- ....
      local servers = {
        -- PHP
        intelephense = {
          filetypes = { 'php' },
          init_options = {
            licenceKey = 'REDACTED',
          },
        },
      }

      -- ...
      local capabilities = require('blink.cmp').get_lsp_capabilities()
      require('mason-lspconfig').setup {
        ensure_installed = {},
        automatic_installation = false,
        handlers = {
          function(server_name)
            local server = servers[server_name] or {}
            server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
            vim.lsp.config(server_name, server)
            vim.lsp.enable(server_name)
          end,
        },
      }
    end,
  }
}

It does work in JavaScript when typing . it will immediately show suggestions. But in PHP, when I type $this->,... nothing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions