I have a Neovim config that i use for C/C++, Python, Assembly, Rust and PHP, and in all of those the LSP's are working - highlights, coloring, autocomplete, all the things - except in Asm and PHP. I won't bother with Asm for now since I expect that to be a mountain of headaches, but why's Intelephense not working?
I installed Intelephense both with Mason.nvim and with npm, but neither are working. So, here's my Lua:
-- lsp.lua
local lsp_zero = require('lsp-zero')
lsp_zero.on_attach(function(client, bufnr)
-- see :help lsp-zero-keybindings
-- to learn the available actions
lsp_zero.default_keymaps({buffer = bufnr})
end)
-- here you can setup the language servers
require("mason").setup()
require('lspconfig').clangd.setup({}) -- C/C++ LSP
require('lspconfig').lua_ls.setup({}) -- Lua LSP
require('lspconfig').pylsp.setup({}) -- Python LSP
require('lspconfig').tsserver.setup({}) -- Javascript/Typescript LSP
require('lspconfig').html.setup({}) -- HTML LSP
require('lspconfig').cssls.setup({}) -- CSS LSP
require('lspconfig').intelephense.setup({}) -- PHP Intelephense please work
-- Autocompletion
local cmp = require('cmp')
local cmp_action = require('lsp-zero').cmp_action()
cmp.setup({
mapping = cmp.mapping.preset.insert({
-- `Tab` key to confirm completion
['<Tab>'] = cmp.mapping.confirm({select = false}),
-- Ctrl+Space to trigger completion menu
['<C-Space>'] = cmp.mapping.complete(),
-- Navigate between snippet placeholder
['<C-f>'] = cmp_action.luasnip_jump_forward(),
['<C-b>'] = cmp_action.luasnip_jump_backward(),
-- Scroll up and down in the completion documentation
['<C-u>'] = cmp.mapping.scroll_docs(-4),
['<C-d>'] = cmp.mapping.scroll_docs(4),
})
})
-- packer.lua
vim.cmd [[packadd packer.nvim]]
return require("packer").startup(function(use)
use "wbthomason/packer.nvim" -- packer self-import
use {
'nvim-telescope/telescope.nvim', tag = '0.1.5',
-- or , branch = '0.1.x',
requires = { {'nvim-lua/plenary.nvim'} }
} -- fuzzy finder
use {
'nvim-lualine/lualine.nvim',
requires = { 'nvim-tree/nvim-web-devicons', opt = true }
} -- lualine
use({
"folke/tokyonight.nvim",
config = function()
vim.cmd("colorscheme tokyonight")
end
}) -- tokyonight
use {
'nvim-treesitter/nvim-treesitter',
run = function()
local ts_update = require('nvim-treesitter.install').update({ with_sync = true })
ts_update()
end
} -- treesitter
use("mbbill/undotree") -- undotree
use("theprimeagen/harpoon") -- harpoon
use("CRAG666/code_runner.nvim") -- coderunner
use {
'VonHeikemen/lsp-zero.nvim',
branch = 'v3.x',
requires = {
--- Uncomment the two plugins below if you want to manage the language servers from neovim
{'williamboman/mason.nvim'},
{'williamboman/mason-lspconfig.nvim'},
-- LSP Support
{'neovim/nvim-lspconfig'},
-- Autocompletion
{'hrsh7th/nvim-cmp'},
{'hrsh7th/cmp-nvim-lsp'},
{'L3MON4D3/LuaSnip'},
}
} -- LSP
end)
