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

Making the library language-agnostic #278

Open
LPeter1997 opened this issue Jul 12, 2024 · 2 comments
Open

Making the library language-agnostic #278

LPeter1997 opened this issue Jul 12, 2024 · 2 comments
Labels
Feedback Needed Further information is requested

Comments

@LPeter1997
Copy link

Hey, this looks like a lovely library, than you for easing the pain of setting up design-time builds!

We are working on a new .NET language, Draco and we'd love to use this library to extract references for example for our language server. Unfortunately from what I gathered, the library has only the 3 main .NET langs hardcoded for command parsing: C#, VB and F#, so we can't exactly extract that data for a custom language.

Is there any chance for this limitation to be eliminated? While I didn't dig deep into the library, I imagine we'd need to introduce an interface like so:

interface ICommandParser
{
    // Lang name tag, optional
    string Language { get; }

    // Returns true, if this parser can handle the compiler that's being invoked. Replaces ProcessFscCommandLine, ProcessCscCommandLine, ...
    bool IsLanguageCompilerInvocation(object sender, BuildMessageEventArgs e);

    // Replaces Compiler.CommandLine.Parse
    CompilerCommand Parse(DirectoryInfo? baseDir, string commandLine);
}

And then have a collection of these language parsers, AnalyzerManager or AnalyzerManagerOptions looks like an OK place for this. By default, the existing languages (C#, VB and F#) would have an implementation for this interface, but consumers of the package could implement this interface for any language they'd want.

Let me know what you think!

@phmonte
Copy link
Owner

phmonte commented Jul 31, 2024

Hello @LPeter1997 , I don't see any problems, this limitation exists because we use msbuild, as you said, it is necessary to implement the equivalent methods for other languages.

@phmonte
Copy link
Owner

phmonte commented Sep 8, 2024

@LPeter1997 have you seen Corniel's implementation? Do you think it makes sense to you?

@phmonte phmonte added the Feedback Needed Further information is requested label Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feedback Needed Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants