cucumber / language-service

Cucumber Language Service
MIT License
12 stars 22 forks source link

Support for Cucumber in .NET #25

Closed Issafalcon closed 2 years ago

Issafalcon commented 2 years ago

🤔 What's the problem you're trying to solve?

I'm currently working on a plugin for Neovim that adds some of the niceties back in to the .NET developer workflow, building on top of the features already offered by the omnisharp-lsp and DAP. One of the things that keeps me going back to Visual Studio, is the lack of support for .feature files and the step definitions in .NET when writing Specflow tests. For all other things, I have a clear idea how I can implement what I need in the plugin, but the Cucumber problem doesn't have a satisfying solution I can think of (bar writing or extending the vim-cucumber plugin, which kind of defeats the purpose of building on top of existing language servers).

✨ What's your proposed solution?

Some of the great features offered by this language-service and the cucumber_language_server would make working with Cucumber in .NET so much better outside of Visual Studio, so adding support for C# / .NET would be great

⛏Have you considered any alternatives or workarounds?

vim-cucumber - https://github.com/tpope/vim-cucumber. Forking and extending this, or implementing my own plugin specifically to implement the features offered by the cucumber_language_server but for C#. However, extending the language service and the cucumber LSP seems a much better solution.

Additional context

I would be happy to contribute to get this support included in the project

aslakhellesoy commented 2 years ago

Hi @Issafalcon thanks for offfering to help!

The language-specific code is in the tree-sitter directory. Currently only Java and TypeScript is supported.

I suggest you start by adding a new test for C# in ExpressionBuilder.test.ts.

You'll have to familiarise yourself with TreeSitter. The TreeSitter playground is very useful for experimenting with TreeSitter queries.

Issafalcon commented 2 years ago

Thanks @aslakhellesoy , no problem.

I'll take a look at tree-sitter (been meaning to learn how to write queries for other plugin ideas I have). I'm away for the next couple of weeks, but after that, I should have some free time.

aslakhellesoy commented 2 years ago

👍🏻

Issafalcon commented 2 years ago

Hi @aslakhellesoy. I've forked the repo and added what I think is required for the csharp queries (https://github.com/Issafalcon/language-service/tree/feature/csharp-support). However, I can't seem to build .wasm files that are loadable by the TS Parser. I thought it was just the c-sharp wasm file that wasn't working, but the ExpressionBuilder run via the tests also fail to load other wasm files after I overwrite them with ones I have built locally.

Following the installation of emscripten https://emscripten.org/docs/getting_started/downloads.html#platform-notes-installation-instructions-sdk to use the latest version of emsdk to create the WASM images.

Activating the emsdk produces the following:

Setting the following tools as active:
   node-14.18.2-64bit
   releases-upstream-d463a5c58ef01678f32b151ab444582e72e75951-64bit

Next steps:
- To conveniently access emsdk tools from the command line,
  consider adding the following directories to your PATH:
    /home/issafalcon/repos/emsdk
    /home/issafalcon/repos/emsdk/node/14.18.2_64bit/bin
    /home/issafalcon/repos/emsdk/upstream/emscripten

Don't suppose you have come across something similar? Or if you know how to correctly build the wasm files, you can point me in the right direction?

aslakhellesoy commented 2 years ago

Hi @Issafalcon great to hear you're making progress. Could you please submit a pull request against this repo so we can start giving feedback? You can mark it as draft if you feel it's not ready.

FYI: I'm going to be away for a week

Issafalcon commented 2 years ago

Sounds good. I've linked the draft PR @aslakhellesoy .