Our great sponsors
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
In case you didn't click on the link to intelephense, you should know that is a language server for php. If you just want to test the code I show here, you don't need the php interpreter installed, just the source code of a php project. You can use this repository: minicli, is a decent size codebase and doesn't depend on any other php libraries.
A language server is an external program that follows the Language Server Protocol. The LSP specification defines what type of messages a language server can receive, and also how it should respond. The idea here is that any tool that follows the LSP specification can communicate with a language server.
I'm going to use intelephense to show the minimal configuration needed to setup a language server in Neovim.
If we can't find the basic usage in the documentation we can go to nvim-lspconfig's github repository. In there we look for a folder called server_configurations, this contains configuration files for a bunch of language servers.
For example, intelephense can show diagnostics in real time, there is no need to save the file to get new diagnostics. But rust-analyzer, the language server for rust, can only update diagnostics after saving the file.
Here's another example: ruff-lsp, a language server for python. It describes itself as a linter and code formatter. As far as I can tell ruff-lsp does not provide code completions or semantic highlights.
Sometimes a language server can support multiple filetypes. An example of this is tsserver, the language server for javascript and typescript. In this case a filetype plugin can still work but there is an easier way to go about it.