From 564dd7d8db110d134987f8619c3894d2149f8956 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Wed, 10 Mar 2021 16:53:23 -0500 Subject: lsp: get_language_id (#14092) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Allow specifying a languageId for a lsp For some languages the filetype might not match the languageId the language server accepts. In these cases the config for the language server can contain a function which gets the current buffer and filetype and returns a languageId. When it isn't provided the filetype is used instead. Example: ```lua require'lspconfig'.sourcekit.setup{ get_language_id = function(bufnr, ft) return 'swift' end; } ``` Closes #13093 * lsp: Change to get_language_id Co-authored-by: Jan Dammshäuser --- runtime/doc/lsp.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'runtime/doc') diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 24f9dd7a69..6d7c3f26ef 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -799,6 +799,8 @@ start_client({config}) *vim.lsp.start_client()* See `initialize` in the LSP spec. {name} (string, default=client-id) Name in log messages. + {get_language_id} function(bufnr, filetype) -> language + ID as string. Defaults to the filetype. {offset_encoding} (default="utf-16") One of "utf-8", "utf-16", or "utf-32" which is the encoding that the LSP server expects. -- cgit