Skip to content

Commit 4044d85

Browse files
revert: "fix(ui): use rest_nvim_result filetype for all panes (fix #424)"
This reverts commit 3327656.
1 parent 313004e commit 4044d85

File tree

7 files changed

+10
-16
lines changed

7 files changed

+10
-16
lines changed

lua/rest-nvim/commands.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ local rest_command_tbl = {
100100
},
101101
run = {
102102
impl = function(args, opts)
103-
if vim.bo.filetype ~= "http" then
103+
if vim.bo.filetype ~= "http" or vim.b.__rest_no_http_file then
104104
vim.notify(
105105
"`:Rest run` can be only called from http file",
106106
vim.log.levels.ERROR,

lua/rest-nvim/logger.lua

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99

1010
local logger = {}
1111

12-
---@type fun(...)
12+
---@type fun(any)
1313
function logger.trace(_) end
14-
---@type fun(...)
14+
---@type fun(any)
1515
function logger.debug(_) end
16-
---@type fun(...)
16+
---@type fun(any)
1717
function logger.info(_) end
18-
---@type fun(...)
18+
---@type fun(any)
1919
function logger.warn(_) end
20-
---@type fun(...)
20+
---@type fun(any)
2121
function logger.error(_) end
2222

2323
local default_log_path = vim.fn.stdpath("log") --[[@as string]]

lua/rest-nvim/ui/result.lua

+4-6
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,10 @@ end
2020
---@param buffer integer
2121
---@param filetype string
2222
local function syntax_highlight(buffer, filetype)
23-
logger.debug("syntax_highlight", buffer, filetype)
2423
local lang = vim.treesitter.language.get_lang(filetype)
25-
logger.debug("found tree-sitter language:", lang)
2624
local ok = pcall(vim.treesitter.start, buffer, lang)
27-
logger.debug("ok:", ok)
28-
if not lang or not ok then
25+
if not ok then
2926
vim.bo[buffer].syntax = filetype
30-
logger.debug("set syntax to", vim.bo[buffer].syntax)
3127
end
3228
end
3329

@@ -65,7 +61,9 @@ local panes = {
6561
end
6662
-- HACK: `vim.treesitter.foldexpr()` finds fold based on filetype not registered parser of
6763
-- current buffer
68-
syntax_highlight(self.bufnr, "rest_nvim_result")
64+
vim.bo[self.bufnr].filetype = "http"
65+
vim.b[self.bufnr].__rest_no_http_file = true
66+
-- syntax_highlight(self.bufnr, "http")
6967
local lines = render_request(data.request)
7068
if data.response then
7169
logger.debug(data.response.status)

plugin/rest-nvim.lua

-1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,5 @@ vim.g.rest_nvim_deps = rest_nvim_deps
7272

7373
require("rest-nvim.autocmds").setup()
7474
require("rest-nvim.commands").setup()
75-
vim.treesitter.language.register("http", "rest_nvim_result")
7675

7776
vim.g.loaded_rest_nvim = true

queries/rest_nvim_result/folds.scm

-1
This file was deleted.

queries/rest_nvim_result/highlights.scm

-1
This file was deleted.

queries/rest_nvim_result/injections.scm

-1
This file was deleted.

0 commit comments

Comments
 (0)