Comments (3)
nvimlsp-config support
For this plugin, I'm taking a quick look at all references to io
, vim.cmd
, vim.fn
, vim.loop
, and vim.lsp
to see what it uses.
io
open
- ignore (ONLY USED INscripts/docgen.lua
)lines
- inject- used in
util.lua
andvala_ls.lua
where the util uses it ininsert_package_json
used bystylelint_lsp.lua
andeslint.lua
- used in
vim.fn
executable
- injectexpand
- ignore (I think it's safe to ignore this one? Unless my concern about buffer/file names is valid)exepath
- inject- used by
config.lua
(not a server) on a server config's command to resolve the full path of the executable
- used by
filereadable
- injectgetcwd
- injectgetenv
- injectgetpid
- inject- Should this be the pid of the distant server? It is used used in
omnisharp.lua
with--hostPID
- Should this be the pid of the distant server? It is used used in
glob
- injecthas
- inject- Caveat here is that we only need it for the situation where
vim.fn.has('win32')
is used since that implies Windows on the remote machine
- Caveat here is that we only need it for the situation where
isdirectory
- ignore (ONLY USED INtest/minimal_init.lua
)jobstart
- injectreaddir
- injectstdpath
- inject (detect remote OS and use appropriate vim stdpath?)- Seems to be used for specifying logging path for an option with the
vdmj.lua
config - Used for part of the command for
powershell_es.lua
- Seems to be used for specifying logging path for an option with the
system
- ignore (ONLY USED INtest/minimal_init.lua
)
vim.loop
cwd
- injectfs_mkdtemp
- ignore (ONLY USED INscripts/docgen.lua
)fs_realpath
- injectfs_stat
- injectnew_timer
- ignoreos_homedir
- injectos_uname
- inject
vim.lsp
start_client
- inject
There's a bunch of others for vim.lsp
, but we only care about start_client
since that's what we need to wrap. Everything else does not touch the filesystem, spawn processes, etc to my knowledge. There are also a lot of calls to vim.api
to get buffer names. My only concern there is if the plugin won't trigger start_client
because of the distant://{ID}@
prefix on buffers. If that's the case, we'd need to overwrite buffer name retrieval as well.
For vim.cmd
, I'm trying to see if any vimscript commands that do IO/processes are being invoked. If so, we'd have to replace cmd
, parse the string, and detect that. If that's the case, this would be a deal-breaker. From skimming the source code, I don't see anything like that, it's just used to set autocommands or invoke :edit
for zk.lua
when running :ZkNew
.
from distant.nvim.
nvim-dap support
For this plugin, I'm taking a quick look at all references to io
, vim.cmd
, vim.fn
, and vim.loop
to see what it uses. It does make one call to vim.lsp.util
, which isn't important.
io
lines
- ignore (used to read a local.vscode/launch.json
to extend with entries)open
- ignore (used for logging of DAP, which we want locally)stderr
- ignore (used to set neovim stderr for tests)stdout
- ignore (used to set neovim stdout for tests)
vim.fn
getcwd
- ignore (used to look up.vscode/launch.json
relative to local machine cwd)delete
- ignore (ONLY USED INtests/debugpy_spec.lua
)getpid
- ignore (returns neovim pid used to filter it out from a list of processes)has
- inject- Caveat here is that we only need it for the situation where
vim.fn.has('linux')
andvim.fn.has('linux')
are used since that implies Linux on the remote machine
- Caveat here is that we only need it for the situation where
input
- ignorejobstart
- injectmkdir
- ignore (used for logging of DAP, which we want locally)stdpath
- ignore (used for logging of DAP, which we want locally)system
- inject (used to retrieve process information to know which process to debug)trim
- ignore
vim.loop
fs_stat
- ignore (used to examine local.vscode/launch.json
)getaddrinfo
- inject- used to resolve a host; if it fails, they return the unresolved host
new_tcp
- inject- used to connect to spawned processes (servers?) that I'm assuming expose a TCP port for debug purposes
new_timer
- ignore
-os_uname
- ignore (used to figure out path separator for logging)spawn
- inject- used to spawn an external terminal
- used to spawn a server executable
- used to spawn a session from an adapter
version
- ignorewalk
- ignore (ONLY USED INtests/run_server.lua
)
For vim.cmd
, I'm trying to see if any vimscript commands that do IO/processes are being invoked. If so, we'd have to replace cmd
, parse the string, and detect that. If that's the case, this would be a deal-breaker. From skimming the source code, I don't see anything like that, it's just used to set autocommands, invoke commands like :DapProgressUpdate
, edit a preview window (:pedit
), or perform window manipulation.
In terms of gotchas, the new_tcp
is the toughest one if we ignore the mix of needing and not needing IO based on reading a local VSCode configuration or writing log files. This is where distant would need to support TCP forwarding similar to SSH where we could run it and it forwards tcp traffic between the local machine and remote machine.
from distant.nvim.
From the two examples above, this is clearly quite complex and I don't think the automatic injection will be feasible unless we do something like one of these options:
- Exclude based on the origin of the call to the function (e.g. you can say to ignore originating from
log.lua
), and let the origin be configurable. You would detect the origin usingdebug.getinfo()
and see if where we come from:function traceback () local level = 1 while true do local info = debug.getinfo(level, "Sl") if not info then break end if info.what == "C" then -- is a C function? print(level, "C function") else -- a Lua function print(string.format("[%s]:%d", info.short_src, info.currentline)) end level = level + 1 end end
- Support turning on & off injection explicitly, still struggling when one plugin needs it remote and another needs it local
- (most likely) Inject with a function where the injection happens, the function is invoked, and then the injection is undone. This would let you wrap calls to other plugin methods in a way that still supports distant. It just means that you have to do the injection more explicitly versus the seamless method.
from distant.nvim.
Related Issues (20)
- Incorrect version no longer caught with `:Distant` HOT 1
- Unrecognised subcommand 'client' HOT 4
- Fails to connect to known host with wrong distant command on the server side HOT 2
- Unwatch deleted file & renamed file HOT 1
- Buffer name already exists for external file change HOT 1
- Upcoming neovim 0.10 will break usage of `tbl_islist` HOT 1
- DistantLaunch Failed HOT 1
- How to install distant.nvim v3.0? HOT 2
- DistantInstall failed - attempt to compare string with nil HOT 3
- DistantLaunch error "vim/_editor.lua:0: Vim:Failed to start manager" HOT 8
- 0.3 error when using Telescope "Cancellation failed because no search found" HOT 6
- Default UI color scheme is pink HOT 3
- Unable to use `:DistantInstall` from binary or source HOT 6
- Running `distant` returns GLIBC error HOT 5
- Plugin commands not found by neovim HOT 2
- Improve plugin load speed
- cannot establish the connection with the remote machine HOT 23
- Support ProxyJump in ssh config HOT 1
- Rewrite plugin for v0.3 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from distant.nvim.