-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add better python specific handling and use env var for debug mode
- Loading branch information
1 parent
40384fb
commit a937b97
Showing
10 changed files
with
446 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,16 @@ | ||
local Path = require("plenary.path") | ||
local json = require "vendor.json" | ||
|
||
local dev = {} | ||
|
||
local debug = false | ||
local debug_path = '~/vim-biscuits.log' | ||
|
||
dev.console_log = function (the_string) | ||
if debug then | ||
Path:new(debug_path):write(the_string..'\n', 'a') | ||
end | ||
Path:new(debug_path):write(json.encode(the_string)..'\n', 'a') | ||
end | ||
|
||
dev.clear_log = function () | ||
if debug then | ||
Path:new(debug_path):write('', 'w') | ||
end | ||
Path:new(debug_path):write('', 'w') | ||
end | ||
|
||
return dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
local ts_utils = require('nvim-treesitter.ts_utils') | ||
local utils = require("nvim-biscuits.utils") | ||
|
||
local language = {} | ||
|
||
language.should_decorate = function (ts_node, text, bufnr) | ||
local should_decorate = true | ||
return should_decorate | ||
end | ||
|
||
language.transform_text = function (ts_node, text, bufnr) | ||
|
||
-- Dev.console_log("Node") | ||
-- Dev.console_log(ts_node) | ||
|
||
local start_line, start_col, end_line, end_col = ts_utils.get_node_range(ts_node) | ||
local parent_start_line, parent_start_col, parent_end_line, parent_end_col = ts_utils.get_node_range(ts_node:parent()) | ||
if parent_start_line == start_line - 1 then | ||
start_line = parent_start_line | ||
start_col = parent_start_col | ||
end_line = parent_end_line | ||
end_col = parent_end_col | ||
end | ||
|
||
local lines = vim.api.nvim_buf_get_lines(bufnr, start_line, start_line+1, false) | ||
local text = lines[1] | ||
|
||
-- text = html.transform_text(ts_node, text) | ||
return utils.trim(text) | ||
end | ||
|
||
return language |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.