From ceda366985c21cf956ae61a6b9ddc8ab7efd4507 Mon Sep 17 00:00:00 2001 From: Mohammed Elwardi Fadeli <34474472+FoamScience@users.noreply.github.com> Date: Sun, 9 Jan 2022 17:33:23 +0100 Subject: feat: add OpenFOAM language server (#1643) --- lua/lspconfig/server_configurations/foam_ls.lua | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 lua/lspconfig/server_configurations/foam_ls.lua (limited to 'lua') diff --git a/lua/lspconfig/server_configurations/foam_ls.lua b/lua/lspconfig/server_configurations/foam_ls.lua new file mode 100644 index 00000000..f10964be --- /dev/null +++ b/lua/lspconfig/server_configurations/foam_ls.lua @@ -0,0 +1,32 @@ +local util = require 'lspconfig.util' +local bin_name = 'foam-ls' +local cmd = { bin_name, '--stdio' } + +if vim.fn.has 'win32' == 1 then + cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } +end + +return { + default_config = { + cmd = cmd, + filetypes = { 'foam', 'OpenFOAM' }, + root_dir = function(fname) + return util.search_ancestors(fname, function(path) + if util.path.exists(util.path.join(path, 'system', 'controlDict')) then + return path + end + end) + end, + }, + docs = { + package_json = 'https://raw.githubusercontent.com/FoamScience/foam-language-server/master/package.json', + description = [[ +https://github.com/FoamScience/foam-language-server + +`foam-language-server` can be installed via `npm` +```sh +npm install -g foam-language-server +``` +]], + }, +} -- cgit v1.2.3-70-g09d2