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

Use Rosyln Language Server for C# parsing and analysis #4300

Open
timabell opened this issue Feb 9, 2025 · 2 comments
Open

Use Rosyln Language Server for C# parsing and analysis #4300

timabell opened this issue Feb 9, 2025 · 2 comments

Comments

@timabell
Copy link

timabell commented Feb 9, 2025

I'm creating this as a place to gather knowledge that could potentially be put into the documentation or the tool itself if anyone can get it to work.

I attempted to analyse c# files with the CSharperParser built in to gtoolkit, but ran into issue #4298 - this approach seems like it's always going to be a challenge as the c# language specifications continue to evolve rapidly, and maintaining an independent parser of c# like that will be difficult to keep updated.

There was a suggestion to go via xml with https://github.com/srcML/srcML - but I don't fancy that much.

Another possibility might be to connect to the rosyln language server provided by microsoft, as this powers vscode's c# support, and will therefore be kept up to date with new releases of c#. I have not yet figured out how to do this, contributions here most welcome. I will add any useful knowledge I find here. So far I have found:

@girba
Copy link
Member

girba commented Feb 9, 2025

There exists already support for LSP. We have several connections already (e.g., Rust, Python, CSS). Take a look at subclasses of GtLSPModel from the GToolkit4LSP package.

@timabell
Copy link
Author

timabell commented Feb 9, 2025

Unless anyone has already done this, it seems the first step might be to clone GtLSPRustModel into a new class called something like GtLSPCsharpModel and update the downloadExecutable to download from https://github.com/SofusA/roslyn-language-server/releases/latest instead of the rust one.

Image

I've already downloaded that manually and got it running (though I did run into SofusA/roslyn-language-server#97 and have to switch to a newer OS)

That would then allow a Pharo snippet like this

GtLSPCsharpModel downloadExecutable.

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

No branches or pull requests

2 participants