From 63b810c9d8543bfcbee0367554e97cb97d1c14e6 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Tue, 6 Feb 2024 12:30:02 +0100 Subject: docs: small fixes (#27213) Co-authored-by: Matthieu Coudron <886074+teto@users.noreply.github.com> --- runtime/lua/vim/uri.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'runtime/lua/vim/uri.lua') diff --git a/runtime/lua/vim/uri.lua b/runtime/lua/vim/uri.lua index 2dc817c5c1..038aa8acfb 100644 --- a/runtime/lua/vim/uri.lua +++ b/runtime/lua/vim/uri.lua @@ -10,14 +10,14 @@ local tohex = require('bit').tohex local URI_SCHEME_PATTERN = '^([a-zA-Z]+[a-zA-Z0-9.+-]*):.*' local WINDOWS_URI_SCHEME_PATTERN = '^([a-zA-Z]+[a-zA-Z0-9.+-]*):[a-zA-Z]:.*' local PATTERNS = { - ---RFC 2396 - ---https://tools.ietf.org/html/rfc2396#section-2.2 + -- RFC 2396 + -- https://tools.ietf.org/html/rfc2396#section-2.2 rfc2396 = "^A-Za-z0-9%-_.!~*'()", - ---RFC 2732 - ---https://tools.ietf.org/html/rfc2732 + -- RFC 2732 + -- https://tools.ietf.org/html/rfc2732 rfc2732 = "^A-Za-z0-9%-_.!~*'()[]", - ---RFC 3986 - ---https://tools.ietf.org/html/rfc3986#section-2.2 + -- RFC 3986 + -- https://tools.ietf.org/html/rfc3986#section-2.2 rfc3986 = "^A-Za-z0-9%-._~!$&'()*+,;=:@/", } -- cgit From 9beb40a4db5613601fc1a4b828a44e5977eca046 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Thu, 15 Feb 2024 17:16:04 +0000 Subject: feat(docs): replace lua2dox.lua Problem: The documentation flow (`gen_vimdoc.py`) has several issues: - it's not very versatile - depends on doxygen - doesn't work well with Lua code as it requires an awkward filter script to convert it into pseudo-C. - The intermediate XML files and filters makes it too much like a rube goldberg machine. Solution: Re-implement the flow using Lua, LPEG and treesitter. - `gen_vimdoc.py` is now replaced with `gen_vimdoc.lua` and replicates a portion of the logic. - `lua2dox.lua` is gone! - No more XML files. - Doxygen is now longer used and instead we now use: - LPEG for comment parsing (see `scripts/luacats_grammar.lua` and `scripts/cdoc_grammar.lua`). - LPEG for C parsing (see `scripts/cdoc_parser.lua`) - Lua patterns for Lua parsing (see `scripts/luacats_parser.lua`). - Treesitter for Markdown parsing (see `scripts/text_utils.lua`). - The generated `runtime/doc/*.mpack` files have been removed. - `scripts/gen_eval_files.lua` now instead uses `scripts/cdoc_parser.lua` directly. - Text wrapping is implemented in `scripts/text_utils.lua` and appears to produce more consistent results (the main contributer to the diff of this change). --- runtime/lua/vim/uri.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'runtime/lua/vim/uri.lua') diff --git a/runtime/lua/vim/uri.lua b/runtime/lua/vim/uri.lua index 038aa8acfb..7660dc42e7 100644 --- a/runtime/lua/vim/uri.lua +++ b/runtime/lua/vim/uri.lua @@ -1,4 +1,4 @@ ----TODO: This is implemented only for files currently. +-- TODO: This is implemented only for files currently. -- https://tools.ietf.org/html/rfc3986 -- https://tools.ietf.org/html/rfc2732 -- https://tools.ietf.org/html/rfc2396 @@ -116,7 +116,6 @@ end ---Gets the buffer for a uri. ---Creates a new unloaded buffer if no buffer for the uri already exists. --- ---@param uri string ---@return integer bufnr function M.uri_to_bufnr(uri) -- cgit From 0190771713241b10872b9e2118e16ea4e4b2d1a0 Mon Sep 17 00:00:00 2001 From: Ilia Choly Date: Wed, 28 Feb 2024 04:50:53 -0500 Subject: fix(lua): remove uri fragment from file paths (#27647) Problem: Some LSP servers return `textDocument/documentLink` responses containing file URIs with line/column numbers in the fragment. `vim.uri_to_fname` returns invalid file names for these URIs. Solution: Remove the URI fragment from file URIs. --- runtime/lua/vim/uri.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'runtime/lua/vim/uri.lua') diff --git a/runtime/lua/vim/uri.lua b/runtime/lua/vim/uri.lua index 7660dc42e7..b4e4098b91 100644 --- a/runtime/lua/vim/uri.lua +++ b/runtime/lua/vim/uri.lua @@ -104,6 +104,10 @@ function M.uri_to_fname(uri) if scheme ~= 'file' then return uri end + local fragment_index = uri:find('#') + if fragment_index ~= nil then + uri = uri:sub(1, fragment_index - 1) + end uri = M.uri_decode(uri) --TODO improve this. if is_windows_file_uri(uri) then -- cgit