treesitter-unit icon indicating copy to clipboard operation
treesitter-unit copied to clipboard

Tested in this language

Open ayoubelmhamdi opened this issue 2 years ago • 6 comments

for view language that supports now treesitter-unit, I add this table for fill later.

ayoubelmhamdi avatar Sep 11 '21 20:09 ayoubelmhamdi

Hi @ayoubelmhamdi ,

Thank you very much for this PR, really appreciated!

But I'm not sure if we should put this information in the README as this list can be outdated pretty fast. Thus, I'd prefer to just provide a link to this list: https://github.com/nvim-treesitter/nvim-treesitter#supported-languages

What do you think?

Thanks and best regards, David

David-Kunz avatar Sep 12 '21 06:09 David-Kunz

I think, not all languages work better like demo for example with Lua: sumneko_lua lsp:

function aaa()
[cursor 1]  -- test 1 at column 0
  -- [cursor 2] test 12 at comumn 4
  a=9
end

in cursor 1: if I use viu will select all function like vau in cursor 2: if I use viu will select line like ^v$ also, I tested with dartls but did not work properly!

ayoubelmhamdi avatar Sep 12 '21 13:09 ayoubelmhamdi

Hi @ayoubelmhamdi ,

I've tested it with lua and it works equally good as in JavaScript.

If I define this function

function aaa()
  -- test 1 at column 0
  -- [cursor 2] test 12 at comumn 4
  a=9
end

Then viu will select the whole function if my cursor is before any sub unit (as expected). If I place my cursor on a sub unit (e.g. the comment), then only the sub unit is selected.

But you're right about Dart, the treesitter definitions are a bit weird (the function signature is on another leaf as the function body). I'm afraid that will be impossible to fix (without having language-specific coding).

Thank you for testing, then I guess we should include that list!

Thanks and best regards, David

David-Kunz avatar Sep 12 '21 14:09 David-Kunz

But one small question: There's still Dart inside your list, shouldn't we remove it?

David-Kunz avatar Sep 12 '21 14:09 David-Kunz

in Lua: if cursor at 0
i think, viu should be like vi{ not va{

ayoubelmhamdi avatar Sep 12 '21 15:09 ayoubelmhamdi

in Lua: if cursor at 0 i think, viu should be like vi{ not va{

u is not really a bracket-like object. It's more like a paragraph object, so it should behave more like dip and dap, right?

Best regards, David

David-Kunz avatar Sep 12 '21 15:09 David-Kunz