Skip to content

Commit

Permalink
refactor: enable vscode-neovim.lua to accept an array of strings (#1930)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiyaowong committed May 2, 2024
1 parent a74faab commit 8becac6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,14 @@ export class MainController implements vscode.Disposable {

this.disposables.push(
vscode.commands.registerCommand("_getNeovimClient", () => this.client),
vscode.commands.registerCommand("vscode-neovim.lua", async (lua) => {
if (!lua) {
vscode.commands.registerCommand("vscode-neovim.lua", async (code: string | string[]) => {
const luaCode = typeof code === "string" ? code : code.join("\n");
if (!luaCode.length) {
window.showWarningMessage("No lua code provided");
return;
}
try {
await this.client.lua(lua);
await this.client.lua(luaCode);
} catch (e) {
logger.error(e instanceof Error ? e.message : e);
}
Expand Down

0 comments on commit 8becac6

Please sign in to comment.