csharp-tree-sitter icon indicating copy to clipboard operation
csharp-tree-sitter copied to clipboard

Linux support

Open Daniel15 opened this issue 1 year ago • 8 comments

What would it take to make this library work on Linux? Unfortunately I'm not very familiar with C or C++ development so I can't really tell how much work needs to be done.

Daniel15 avatar Apr 06 '24 20:04 Daniel15

Is the project alive? Linux/MacOS support is still extremely awaited.

rodion-m avatar Sep 16 '24 12:09 rodion-m

I have just ported the csharp binding to linux, and it works well in my project. However, I don’t have working Windows or macOS environments, so I haven't been able to test if anything has broken on those platforms.

Here’s an example of the output when running the code on Linux:

$ dotnet run -files tree-sitter/tree-sitter-cpp/test/highlight/names.cpp
The node type is primitive_type, symbol is int
The node type is identifier, symbol is main
The node type is (, symbol is (
The node type is ), symbol is )
The node type is parameter_list, symbol is ()
done!

Please let me know if it works well on other platforms, and I’ll be happy to submit a pull request.

Undefined01 avatar Nov 29 '24 08:11 Undefined01

is:open is:issue linked:pr updated:<2024-11-20

0958436455sarayut avatar Dec 20 '24 14:12 0958436455sarayut

I have just ported the csharp binding to linux, and it works well in my project. However, I don’t have working Windows or macOS environments, so I haven't been able to test if anything has broken on those platforms.

Here’s an example of the output when running the code on Linux:

$ dotnet run -files tree-sitter/tree-sitter-cpp/test/highlight/names.cpp
The node type is primitive_type, symbol is int
The node type is identifier, symbol is main
The node type is (, symbol is (
The node type is ), symbol is )
The node type is parameter_list, symbol is ()
done!

Please let me know if it works well on other platforms, and I’ll be happy to submit a pull request.

Hi, I compiled your pull on MacOS, it works. But testing on my project, code failed.(The parent of TSNode is_null() always return true). I suspect there maybe some compile pack-size issue or data structure mismatch. Still looking into it.

ifshuaishuai avatar Jan 08 '25 03:01 ifshuaishuai

It turns out -O3 have bugs, -O0 works. Maybe some bug deep in tree-sitter not the binding.

ifshuaishuai avatar Jan 09 '25 14:01 ifshuaishuai

$ dotnet run -files tree-sitter/tree-sitter-cpp/test/highlight/names.cpp The node type is primitive_type, symbol is int The node type is identifier, symbol is main The node type is (, symbol is ( The node type is ), symbol is ) The node type is parameter_list, symbol is () done!

0958436455sarayut avatar Jan 10 '25 04:01 0958436455sarayut

$ dotnet run -files tree-sitter/tree-sitter-cpp/test/highlight/names.cpp The node type is primitive_type, symbol is int The node type is identifier, symbol is main The node type is (, symbol is ( The node type is ), symbol is ) The node type is parameter_list, symbol is () done!

0958436455sarayut avatar Jan 10 '25 04:01 0958436455sarayut

I have just ported the csharp binding to linux, and it works well in my project. However, I don’t have working Windows or macOS environments, so I haven't been able to test if anything has broken on those platforms.

@Undefined01 , rregarding the tests of your fork on Windows, it won’t work because the original Makefile was written for nmake, which uses a different syntax.

The first line of the Makefile you created generates a syntax error in nmake.

I also tried installing GnuWin32.Make using Winget, but it doesn't work either because Makefile.Windows, which was simply renamed, still contains nmake syntax.

In my opinion, the best approach at this point would be to maintain separate Makefiles and use the -f option to specify which one to run. Perhaps someone can propose a more elegant solution later.

GuilhermeAlecrim7K avatar Feb 16 '25 18:02 GuilhermeAlecrim7K