mirror of
https://github.com/LunarVim/LunarVim.git
synced 2025-08-28 13:58:27 +02:00
service was a good idea, thank you tasty
This commit is contained in:
parent
e2f7cce3c5
commit
3ee44cb393
3 changed files with 14 additions and 13 deletions
|
@ -57,8 +57,8 @@ lvim = {
|
||||||
}
|
}
|
||||||
|
|
||||||
local schemas = nil
|
local schemas = nil
|
||||||
local common_on_attach = require("lsp.utils").common_on_attach
|
local common_on_attach = require("lsp.service").common_on_attach
|
||||||
local common_capabilities = require("lsp.utils").common_capabilities()
|
local common_capabilities = require("lsp.service").common_capabilities()
|
||||||
local status_ok, jsonls_settings = pcall(require, "nlspsettings.jsonls")
|
local status_ok, jsonls_settings = pcall(require, "nlspsettings.jsonls")
|
||||||
if status_ok then
|
if status_ok then
|
||||||
schemas = jsonls_settings.get_default_schemas()
|
schemas = jsonls_settings.get_default_schemas()
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
local utils = require "utils"
|
local utils = require "utils"
|
||||||
|
local service = require "lsp.service"
|
||||||
local lsp_config = {}
|
local lsp_config = {}
|
||||||
|
|
||||||
function lsp_config.config()
|
function lsp_config.config()
|
||||||
|
@ -13,18 +14,10 @@ function lsp_config.config()
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
local function no_formatter_on_attach(client, bufnr)
|
|
||||||
if lvim.lsp.on_attach_callback then
|
|
||||||
lvim.lsp.on_attach_callback(client, bufnr)
|
|
||||||
end
|
|
||||||
require("lsp.utils").lsp_highlight_document(client)
|
|
||||||
client.resolved_capabilities.document_formatting = false
|
|
||||||
end
|
|
||||||
|
|
||||||
function lsp_config.setup(lang)
|
function lsp_config.setup(lang)
|
||||||
local lang_server = lvim.lang[lang].lsp
|
local lang_server = lvim.lang[lang].lsp
|
||||||
local provider = lang_server.provider
|
local provider = lang_server.provider
|
||||||
if require("utils").check_lsp_client_active(provider) then
|
if utils.check_lsp_client_active(provider) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -49,13 +42,13 @@ function lsp_config.setup(lang)
|
||||||
|
|
||||||
if utils.is_table(method) then
|
if utils.is_table(method) then
|
||||||
if utils.has_value(method, format_method) then
|
if utils.has_value(method, format_method) then
|
||||||
lang_server.setup.on_attach = no_formatter_on_attach
|
lang_server.setup.on_attach = service.no_formatter_on_attach
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if utils.is_string(method) then
|
if utils.is_string(method) then
|
||||||
if method == format_method then
|
if method == format_method then
|
||||||
lang_server.setup.on_attach = no_formatter_on_attach
|
lang_server.setup.on_attach = service.no_formatter_on_attach
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -98,6 +98,14 @@ function M.common_on_attach(client, bufnr)
|
||||||
lsp_highlight_document(client)
|
lsp_highlight_document(client)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M.no_formatter_on_attach(client, bufnr)
|
||||||
|
if lvim.lsp.on_attach_callback then
|
||||||
|
lvim.lsp.on_attach_callback(client, bufnr)
|
||||||
|
end
|
||||||
|
lsp_highlight_document(client)
|
||||||
|
client.resolved_capabilities.document_formatting = false
|
||||||
|
end
|
||||||
|
|
||||||
function M.common_capabilities()
|
function M.common_capabilities()
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
Loading…
Add table
Add a link
Reference in a new issue