revert: "fix(lsp): use buffer scheme for files not stored on disk" (#22604)

Although using `buffer://` for unsaved file buffers fixes issues with
language servers like eclipse.jdt.ls or ansible-language-server, it
breaks completion and signature help for clangd.

A regression is worse than a fix for something else, so this reverts
commit 896d672736.

The spec change is also still in dicussion, see
https://github.com/microsoft/language-server-protocol/pull/1679#discussion_r1130704886
This commit is contained in:
Mathias Fußenegger
2023-03-11 07:35:23 +01:00
committed by GitHub
parent a7cd79349c
commit 236c20795e
3 changed files with 30 additions and 70 deletions

View File

@@ -2032,12 +2032,7 @@ end
---@returns `TextDocumentIdentifier`
---@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentIdentifier
function M.make_text_document_params(bufnr)
bufnr = bufnr or 0
local uri = vim.uri_from_bufnr(bufnr)
if not uv.fs_stat(api.nvim_buf_get_name(bufnr)) then
uri = uri:gsub('^file://', 'buffer://')
end
return { uri = uri }
return { uri = vim.uri_from_bufnr(bufnr or 0) }
end
--- Create the workspace params
@@ -2070,7 +2065,7 @@ function M.make_formatting_params(options)
insertSpaces = vim.bo.expandtab,
})
return {
textDocument = M.make_text_document_params(0),
textDocument = { uri = vim.uri_from_bufnr(0) },
options = options,
}
end