Skip to content

Commit

Permalink
fix(lua): rename vscode lua plugin to vscode-neovim (#1356)
Browse files Browse the repository at this point in the history
  • Loading branch information
theol0403 committed Jul 29, 2023
1 parent 214aceb commit 72adf16
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 23 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,10 @@ See gif in action:
### Invoking VSCode actions from neovim

To invoke VSCode actions from Neovim, use `VSCodeNotify(command, args, ...)` or `VSCodeCall(command, args, ...)`
functions. From lua, use `require("vscode").notify(command, args, ...)` or `require("vscode").call(command, args, ...)`.
`Notify` is non-blocking, `Call` is blocking. Generally use Notify unless you really need a blocking call, such as
wanting VSCode to process a visual selection before leaving it with <kbd>Esc</kbd>.
functions. From lua, use `require("vscode-neovim").notify(command, args, ...)` or
`require("vscode-neovim").call(command, args, ...)`. `Notify` is non-blocking, `Call` is blocking. Generally use Notify
unless you really need a blocking call, such as wanting VSCode to process a visual selection before leaving it with
<kbd>Esc</kbd>.

#### Examples

Expand Down
15 changes: 15 additions & 0 deletions runtime/lua/vscode-neovim.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
local api = require("vscode-neovim.api")
local defaults = require("vscode-neovim.defaults")
local cursor = require("vscode-neovim.cursor")

local M = {}

M.notify = api.notify
M.call = api.call

M.setup = function()
defaults.setup()
cursor.setup()
end

return M
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local util = require("vscode.util")
local api = require("vscode.api")
local util = require("vscode-neovim.util")
local api = require("vscode-neovim.api")

-- this module is responsible for creating multiple cursors, triggering a visual update, and displaying the fake visual cursor
local M = {}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 0 additions & 15 deletions runtime/lua/vscode.lua

This file was deleted.

2 changes: 1 addition & 1 deletion src/main_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class MainController implements vscode.Disposable {

// These paths get called inside WSL, they must be POSIX paths (forward slashes)
const neovimPreScriptPath = path.posix.join(extensionPath, "vim", "vscode-neovim.vim");
const neovimPostScriptPath = path.posix.join(extensionPath, "runtime/lua", "vscode/force_options.lua");
const neovimPostScriptPath = path.posix.join(extensionPath, "runtime/lua", "vscode-neovim/force-options.lua");

const args = [
"-N",
Expand Down
2 changes: 1 addition & 1 deletion src/viewport_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export class ViewportManager implements Disposable, NeovimRedrawProcessable, Neo
}
const viewport = this.gridViewport.get(gridId);
if (viewport && startLine != viewport?.topline && currentLine == viewport?.line) {
this.client.executeLua("require('vscode.api').scroll_viewport(...)", [Math.max(startLine, 0), endLine]);
this.client.lua("require('vscode-neovim.api').scroll_viewport(...)", [Math.max(startLine, 0), endLine]);
}
}
}
2 changes: 1 addition & 1 deletion vim/vscode-neovim.vim
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,5 @@ augroup END


lua << EOF
require("vscode").setup()
require("vscode-neovim").setup()
EOF

0 comments on commit 72adf16

Please sign in to comment.