Skip to content

Commit

Permalink
Merge pull request #33 from desdic/20240715deprecated
Browse files Browse the repository at this point in the history
fix: Replace deprecated functions
  • Loading branch information
desdic authored Jul 15, 2024
2 parents 577701d + 83b180f commit 3a7cb48
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 17 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,7 @@ example:

## Credits

Thank you @TheSafdarAwan for PR #22
Thanks to

## TODO

* Make documentation on how to create a plugin
@TheSafdarAwan for PR #22
@costowell for PR #32
6 changes: 5 additions & 1 deletion lua/greyjoy/_extensions/cargo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ local M = {}

M.parse = function(fileinfo)
if type(fileinfo) ~= "table" then
print("[cargo] fileinfo must be a table")
vim.notify(
"fileinfo must be a table",
vim.log.levels.ERROR,
{ title = "Greyjoy cargo" }
)
return {}
end

Expand Down
6 changes: 5 additions & 1 deletion lua/greyjoy/_extensions/docker_compose.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ local M = {}

M.parse = function(fileinfo)
if type(fileinfo) ~= "table" then
print("[docker_compose] fileinfo must be a table")
vim.notify(
"fileinfo must be a table",
vim.log.levels.ERROR,
{ title = "Greyjoy docker compose" }
)
return {}
end

Expand Down
6 changes: 5 additions & 1 deletion lua/greyjoy/_extensions/generic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ local M = {}

M.parse = function(fileobj)
if type(fileobj) ~= "table" then
print("[generic] fileinfo must be a table")
vim.notify(
"fileinfo must be a table",
vim.log.levels.ERROR,
{ title = "Greyjoy generic" }
)
return {}
end

Expand Down
2 changes: 1 addition & 1 deletion lua/greyjoy/_extensions/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ local load_extension = function(name)
if not ok then
vim.notify(
"Unable to require greyjoy._extensions." .. name,
vim.lsp.log_levels.ERROR,
vim.log.levels.ERROR,
{ title = "Plugin error" }
)
return
Expand Down
6 changes: 5 additions & 1 deletion lua/greyjoy/_extensions/kitchen.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ local uv = vim.uv

M.parse = function(fileinfo)
if type(fileinfo) ~= "table" then
print("[kitchen] fileinfo must be a table")
vim.notify(
"fileinfo must be a table",
vim.log.levels.ERROR,
{ title = "Greyjoy kitchen" }
)
return {}
end

Expand Down
6 changes: 5 additions & 1 deletion lua/greyjoy/_extensions/makefile.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ local M = {}

M.parse = function(fileinfo)
if type(fileinfo) ~= "table" then
print("[makefile] fileinfo must be a table")
vim.notify(
"fileinfo must be a table",
vim.log.levels.ERROR,
{ title = "Greyjoy makefile" }
)
return {}
end

Expand Down
8 changes: 6 additions & 2 deletions lua/greyjoy/_extensions/vscode_tasks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local ok, greyjoy = pcall(require, "greyjoy")
if not ok then
vim.notify(
"This plugin requires greyjoy.nvim (https://github.com/desdic/greyjoy.nvim)",
vim.lsp.log_levels.ERROR,
vim.log.levels.ERROR,
{ title = "Plugin error" }
)
return
Expand Down Expand Up @@ -61,7 +61,11 @@ end

M.parse = function(fileinfo)
if type(fileinfo) ~= "table" then
print("[vscode_tasks] fileinfo must be a table")
vim.notify(
"fileinfo must be a table",
vim.log.levels.ERROR,
{ title = "Greyjoy vscode_tasks" }
)
return {}
end

Expand Down
10 changes: 5 additions & 5 deletions lua/greyjoy/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,13 @@ end

greyjoy.to_buffer = function(command)
local bufnr = vim.api.nvim_create_buf(false, true)
vim.api.nvim_buf_set_option(bufnr, "filetype", "greyjoy")
vim.api.nvim_set_option_value("filetype", "greyjoy", { buf = bufnr })

local append_data = function(_, data)
if data then
vim.api.nvim_buf_set_option(bufnr, "modifiable", true)
vim.api.nvim_set_option_value("modifiable", true, { buf = bufnr })
vim.api.nvim_buf_set_lines(bufnr, -1, -1, false, data)
vim.api.nvim_buf_set_option(bufnr, "modifiable", false)
vim.api.nvim_set_option_value("modifiable", false, { buf = bufnr })
end
end

Expand All @@ -178,8 +178,8 @@ greyjoy.to_buffer = function(command)
focusable = true,
}

vim.api.nvim_buf_set_option(bufnr, "modifiable", false)
vim.api.nvim_open_win(bufnr, 1, opts)
vim.api.nvim_set_option_value("modifiable", false, { buf = bufnr })
vim.api.nvim_open_win(bufnr, true, opts)

local commandstr = table.concat(command.command, " ")
local shell_command = { greyjoy.default_shell, "-c", commandstr }
Expand Down

0 comments on commit 3a7cb48

Please sign in to comment.