From cf51aa4842f683e36eed9901bcc4f530f5014b2b Mon Sep 17 00:00:00 2001 From: Ade Attwood Date: Thu, 28 Nov 2024 18:06:56 +0000 Subject: [PATCH] feat(vim): add the deno lsp to the config This is a bit tricky due to the filetype of deno being typescript. The typescript server automatically starts on this filetype. For now this looks in the root of the project to see if there is a deno.json or package.json. Based on this, it will pick what one to use. --- site-modules/core/files/vim/plugin/lsp.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/site-modules/core/files/vim/plugin/lsp.lua b/site-modules/core/files/vim/plugin/lsp.lua index a2ca0ab..68122c0 100644 --- a/site-modules/core/files/vim/plugin/lsp.lua +++ b/site-modules/core/files/vim/plugin/lsp.lua @@ -3,11 +3,16 @@ local lspconfig = require "lspconfig" local workspace_library = vim.api.nvim_get_runtime_file("lua", true) table.insert(workspace_library, os.getenv "HOME" .. "/Code/src/github.com/AdeAttwood/Configz/definitions/configz.lua") +local function has_file(file) + return vim.fn.filereadable(vim.fn.getcwd() .. "/" .. file) == 1 +end + local servers = { -- Language servers for the day to day web development, could probably think -- about loosing the html and css one and living with typescript, rescript -- and emmet - tsserver = {}, + ts_ls = { enabled = has_file("tsconfig.json") }, + denols = { enabled = has_file("deno.json") or has_file("deno.jsonc") }, html = {}, cssls = {}, marksman = {},