aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorSt8Razor <themist3@gmail.com>2024-02-29 01:13:53 -0500
committerGitHub <noreply@github.com>2024-02-29 14:13:53 +0800
commit078410f504997bf491a04309453137f3c4c72cd1 (patch)
tree17bd3c07c942d23584e529c9ad56f664f4151661 /lua
parentdocs: update server_configurations.md (diff)
downloadnvim-lspconfig-078410f504997bf491a04309453137f3c4c72cd1.tar
nvim-lspconfig-078410f504997bf491a04309453137f3c4c72cd1.tar.gz
nvim-lspconfig-078410f504997bf491a04309453137f3c4c72cd1.tar.bz2
nvim-lspconfig-078410f504997bf491a04309453137f3c4c72cd1.tar.lz
nvim-lspconfig-078410f504997bf491a04309453137f3c4c72cd1.tar.xz
nvim-lspconfig-078410f504997bf491a04309453137f3c4c72cd1.tar.zst
nvim-lspconfig-078410f504997bf491a04309453137f3c4c72cd1.zip
feat: add delphilsp support (#3034)
* feat: add delphilsp support * fix: move lsp config file change notification to on_attach --------- Co-authored-by: Michael Ribnitski <St8Razor@users.noreply.github.com>
Diffstat (limited to 'lua')
-rw-r--r--lua/lspconfig/server_configurations/delphi_ls.lua49
1 files changed, 49 insertions, 0 deletions
diff --git a/lua/lspconfig/server_configurations/delphi_ls.lua b/lua/lspconfig/server_configurations/delphi_ls.lua
new file mode 100644
index 00000000..bd02d6fa
--- /dev/null
+++ b/lua/lspconfig/server_configurations/delphi_ls.lua
@@ -0,0 +1,49 @@
+local util = require 'lspconfig.util'
+
+return {
+ default_config = {
+ cmd = { 'DelphiLSP.exe' },
+ filetypes = { 'pascal' },
+ root_dir = util.root_pattern '*.dpr',
+ single_file_support = false,
+ },
+ docs = {
+ description = [[
+Language server for Delphi from Embarcadero.
+https://marketplace.visualstudio.com/items?itemName=EmbarcaderoTechnologies.delphilsp
+
+Note, the '*.delphilsp.json' file is required, more details at:
+https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Using_DelphiLSP_Code_Insight_with_Other_Editors
+
+Below, you'll find a sample configuration for the lazy manager.
+When on_attach is triggered, it signals DelphiLSP to load settings from a configuration file.
+Without this step, DelphiLSP initializes but remains non-functional:
+
+```lua
+"neovim/nvim-lspconfig",
+lazy = false,
+config = function()
+ local capabilities = require("cmp_nvim_lsp").default_capabilities()
+ local lspconfig = require("lspconfig")
+
+ lspconfig.delphi_ls.setup({
+ capabilities = capabilities,
+
+ on_attach = function(client)
+ local lsp_config = vim.fs.find(function(name)
+ return name:match(".*%.delphilsp.json$")
+ end, { type = "file", path = client.config.root_dir, upward = false })[1]
+
+ if lsp_config then
+ client.config.settings = { settingsFile = lsp_config }
+ client.notify("workspace/didChangeConfiguration", { settings = client.config.settings })
+ else
+ vim.notify_once("delphi_ls: '*.delphilsp.json' config file not found")
+ end
+ end,
+ })
+end,
+```
+]],
+ },
+}