neovim/runtime/lua/vim/lsp
Justin M. Keyes 67b2ed1004 fix(gx): visual selection, expand env vars
---
Rejected experiment: move vim.ui.open() to vim.env.open()

Problem:
`vim.ui` is where user-interface "providers" live, which can be
overridden. It would also be useful to have a "providers" namespace for
platform-specific features such as "open", clipboard, python, and the other
providers listed in `:help providers`. We could overload `vim.ui` to
serve that purpose as the single "providers" namespace, but
`vim.ui.nodejs()` for example seems awkward.

Solution:
`vim.env` currently has too narrow of a purpose. Overload it to also be
a namespace for `vim.env.open`.

diff --git a/runtime/lua/vim/_meta.lua b/runtime/lua/vim/_meta.lua
index 913f1fe20348..17d05ff37595 100644
--- a/runtime/lua/vim/_meta.lua
+++ b/runtime/lua/vim/_meta.lua
@@ -37,8 +37,28 @@ local options_info = setmetatable({}, {
   end,
 })

-vim.env = setmetatable({}, {
-  __index = function(_, k)
+vim.env = setmetatable({
+  open = setmetatable({}, {
+      __call = function(_, uri)
+        print('xxxxx'..uri)
+        return true
+      end,
+      __tostring = function()
+        local v = vim.fn.getenv('open')
+        if v == vim.NIL then
+          return nil
+        end
+        return v
+      end,
+    })
+  },
+  {
+  __index = function(t, k, ...)
+    if k == 'open' then
+      error()
+      -- vim.print({...})
+      -- return rawget(t, k)
+    end
     local v = vim.fn.getenv(k)
     if v == vim.NIL then
       return nil
2023-07-04 23:45:35 +02:00
..
types feat(scripts): add lsp_types.lua (#23750) 2023-06-07 12:32:39 +01:00
_dynamic.lua feat(lsp): initial support for dynamic capabilities (#23681) 2023-05-28 07:51:28 +02:00
_snippet.lua feat(lua): vim.tbl_contains supports general tables and predicates (#23040) 2023-04-14 10:39:57 +02:00
_watchfiles.lua perf(lsp): reduce polling handles for workspace/didChangeWatchedFiles (#23500) 2023-06-14 12:40:11 +02:00
buf.lua fix(lsp): revert change to buf.clear_references() #24238 2023-07-04 05:30:31 -07:00
codelens.lua fix(lsp): lint warnings, default offset_encoding #24046 2023-07-01 03:42:37 -07:00
diagnostic.lua fix(diagnostic): use correct field name for tags (#22835) 2023-03-31 11:23:19 +01:00
handlers.lua fix(gx): visual selection, expand env vars 2023-07-04 23:45:35 +02:00
health.lua feat(lua): rename vim.loop -> vim.uv (#22846) 2023-06-03 12:06:00 +02:00
inlay_hint.lua fix(lsp): fix attempt to call non existent function (#24212) 2023-06-30 13:42:58 +02:00
log.lua fix(lsp): lint warnings, default offset_encoding #24046 2023-07-01 03:42:37 -07:00
protocol.lua fix(lsp): lint warnings, default offset_encoding #24046 2023-07-01 03:42:37 -07:00
rpc.lua fix(lsp): lint warnings, default offset_encoding #24046 2023-07-01 03:42:37 -07:00
semantic_tokens.lua feat(lua): rename vim.loop -> vim.uv (#22846) 2023-06-03 12:06:00 +02:00
sync.lua docs(lsp): change type annotations from number → integer (#22510) 2023-03-07 07:17:52 +01:00
tagfunc.lua fix(lsp): Jump to tag locations reliably when :ltag is used (#22750) 2023-03-23 08:27:53 +01:00
types.lua refactor(lsp): extract common execute command functionality (#24065) 2023-06-20 18:36:18 +02:00
util.lua fix(lsp): revert change to buf.clear_references() #24238 2023-07-04 05:30:31 -07:00