You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is an issue with the way coc handles the languageId, at the moment one can only have one hard coded predefined language id that is sent to all running servers, g:coc_filetype_map is not very useful either in this regard, since it is also global for all clients. However this is a problem, because there are scertain servers such as https://github.com/spring-projects/sts4/blob/992a7c742838a381443a5a86ed0327523b1f3086/vscode-extensions/vscode-spring-boot/lib/Main.ts#L25-L30. Which require a very specific name for the languageId send for the document, we can not simply override yml or yaml in this case because that will break other language servers where the ft is expected to be yml.
Proposition
There should be way to define a custom langugeId resolver per client, so that we can send the correct value for that specific client only. And not affect the globlal ft system.
Other solutions
Below is an example of how neovim does it, each client has the ability to be configured with a custom callback which will be invoked (where needed) to obtain the languge id on the fly or fallback to the default filetype if no callback for get_languge_id was provided.
functionClient:_text_document_did_open_handler(bufnr)
changetracking.init(self, bufnr)
ifnotvim.tbl_get(self.server_capabilities, 'textDocumentSync', 'openClose') thenreturnendifnotapi.nvim_buf_is_loaded(bufnr) thenreturnendlocalfiletype=vim.bo[bufnr].filetypelocalparams= {
textDocument= {
version=0,
uri=vim.uri_from_bufnr(bufnr),
languageId=self.get_language_id(bufnr, filetype),
text=lsp._buf_get_full_text(bufnr),
},
}
self.notify(ms.textDocument_didOpen, params)
lsp.util.buf_versions[bufnr] =params.textDocument.version-- Next chance we get, we should re-do the diagnosticsvim.schedule(function()
-- Protect against a race where the buffer disappears-- between `did_open_handler` and the scheduled function firing.ifapi.nvim_buf_is_valid(bufnr) thenlocalnamespace=lsp.diagnostic.get_namespace(self.id)
vim.diagnostic.show(namespace, bufnr)
endend)
end
The text was updated successfully, but these errors were encountered:
Describe the bug
There is an issue with the way coc handles the
languageId
, at the moment one can only have one hard coded predefined language id that is sent toall
running servers, g:coc_filetype_map is not very useful either in this regard, since it is also global for all clients. However this is a problem, because there are scertain servers such as https://github.com/spring-projects/sts4/blob/992a7c742838a381443a5a86ed0327523b1f3086/vscode-extensions/vscode-spring-boot/lib/Main.ts#L25-L30. Which require a very specific name for thelanguageId
send for the document, we can not simply overrideyml
oryaml
in this case because that will break other language servers where the ft is expected to beyml
.Proposition
There should be way to define a custom langugeId resolver per client, so that we can send the correct value for that specific client only. And not affect the globlal ft system.
Other solutions
Below is an example of how neovim does it, each client has the ability to be configured with a custom callback which will be invoked (where needed) to obtain the languge id on the fly or fallback to the default filetype if no callback for
get_languge_id
was provided.From neovim core
The text was updated successfully, but these errors were encountered: