bricelam / T4Language

Adds basic language support for .tt files to Visual Studio.
Other
37 stars 3 forks source link

Add a Language Server (LSP) #3

Open bricelam opened 2 years ago

bricelam commented 2 years ago

I'll never have time for this, but it would be amazing if we could add a Language Server for T4 that delegates to the C# language server inside control blocks. (This is essentially how the Razor editor works.)

We'd map blocks of the T4 file to blocks of preprocessed C# class files to light up full C# support.

This would also enable full IntelliSense support for T4 Directive names and arguments.

Basic features

Advanced features

AraHaan commented 1 year ago

I agree, I think it would be good to have.

bricelam commented 1 year ago

So I'm actually gonna dig into this as part of the hackathon this week. You can watch my sanity slowly deteriorate using the feature/lsp branch. 😉

AraHaan commented 1 year ago

You mean your sanity slowly become that on the level of roslyn dev?

bricelam commented 1 year ago

Hmm, it looks like by just having a language server, you lose some features: ☹️

I've re-implemented word-based completion inside the language server, but the other features will also need to be addressed before releasing anything from this branch.

AraHaan commented 1 year ago

Wait why is that so? Seems like just adding a language server provides a downgrade. Let's complain to the roslyn repository about it.

bricelam commented 1 year ago

It's due to the interaction between two (built-in) Visual Studio extensions. I was previously only using the TextMate one. It provides syntax highlighting, basic completion (snippets and word-based), and reference highlighting. When a language server is present, the LanguageServer extension takes over completion and reference highlighting (so it can call into the language server). Ideally, if a language server didn't declare these capabilities, it would fallback to the TextMate implementation, but it doesn't. (And I get why--it's hard to do.) It would also be nice if the TextMate snippets completion could coexist with the language server completion so it didn't have to re-implement it.

bricelam commented 1 year ago

Reopening per PR #27