Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option node_context #21

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Added option node_context #21

wants to merge 4 commits into from

Conversation

mkonig
Copy link

@mkonig mkonig commented Jan 17, 2022

Adding an option that adds context by nodes in addition to context by lines.
Example:

def myfunc():
  if var = number:
    if other = that:    
      print("yes")   <- Cursor is here

If node_context = 1, then both if would be highlighted.
If node_context = 0, then only the inner if would be highlighted.
if node_context = 2, then the whole function woudl be highlighted.

@denstiny
Copy link

For c/CPP have no effect

@mkonig
Copy link
Author

mkonig commented Feb 17, 2022

Hi

I had to tsplayground to find how the elements for a language are named.
For example for cpp ts uses function_definition.
If you use expand, then you can define whice elements of a language should be used to expand.

This is my current setup. It does not include cpp.

require'twilight'.setup{
dimming = {
alpha = 0.1,
},
expand = {
"function",
-- "if_expression",
-- python/pyright
"while_statement",
"if_statement",
"for_statement",
"function_definition",
"class_definition",
-- yml
"document",
-- lua
"function_declaration",
"while_statement",
"if_statement",
},
exclude = { "zsh", "markdown", "help", "asciidoc", "conf", "sh", "vim" },
context = 0,
node_context = 2,
treesitter = true,
}

@denstiny
Copy link

你好

我必须到 tsplayground 才能找到一种语言的元素是如何命名的。 例如对于 cpp ts 使用 function_definition。 如果您使用扩展,那么您可以定义一种语言的哪些元素应该用于扩展。

这是我目前的设置。 它不包括 cpp。

需要'暮光'.setup{ 调光 = { 阿尔法 = 0.1, }, 展开 = { “功能”, -- "if_expression", --python/pyright "while_statement", "if_statement", "for_statement", "函数定义", “类定义”, - yml “文档”, - 拿 "function_declaration", "while_statement", "if_statement", }, exclude = { "zsh", "markdown", "help", "asciidoc", "conf", "sh", "vim" }, context = 0, node_context = 2, treesitter = true, }

I think I succeeded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants