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

[QUESTION] Cake support in Omnisharp #1684

Closed
gep13 opened this issue Aug 4, 2017 · 19 comments
Closed

[QUESTION] Cake support in Omnisharp #1684

gep13 opened this issue Aug 4, 2017 · 19 comments

Comments

@gep13
Copy link

gep13 commented Aug 4, 2017

We the Cake Team, through the amazing work of @mholo65 have been working on adding Cake support in OmniSharp in order to provide Intellisense support within *.cake files. The necessary work to get this working are contained within these PR's:

OmniSharp/omnisharp-roslyn#932
#1681

All this seems to work, with the exception of one thing...

As part of the Cake extension for Visual Studio we provide syntax highlighting for .cake files through registering a new language, as can be seen here:

image

However, when trying to use Omnisharp through the changes in the above PR's, the only way that we have been able to get this to work is by changing the Language Mode to C#, which obviously loses the syntax highlighting that we provide.

We have been pointed at this location:

https://github.com/Microsoft/vscode/blob/master/extensions/csharp/package.json

What is required in order to get Omnisharp to "light" for .cake files, whilst still providing syntax highlighting?

@DustinCampbell
Copy link
Member

Cross posting from #1681:

Cake is really just C# script with some semantic differences, correct? If that's the case, I would proposal that the Cake Support extension doesn't provide it's own syntax highlighting, but takes advantage of C#'s. Then, the Cake Support extension would be modified to operate on the "csharp" language but only when the extension is ".cake". Thoughts?

@gep13
Copy link
Author

gep13 commented Aug 4, 2017

@DustinCampbell I am more than happy to remove the syntax highlighting from the VSCode Extension for Cake. Cake is built on C#, so obviously most things will be highlighted correctly. In the above screenshot you will see things like Task and Does being highlighted. These are parts of the DSL that Cake is providing.

@DustinCampbell
Copy link
Member

I hadn't noticed that the syntax highlighting above had colored Task and Does specially. Have you looked at the C# syntax highlighting in a more robust color theme (like the default Dark+ theme)? That has much richer colors, and you can see that function calls are highlight differently, which draws attention to top-level Task and Does functions quite nicely:

image

@bjorkstromm
Copy link
Contributor

I'd say we ditch our Cake specific highlighting and use C# default instead. But @gep13 could have last call.

This would also have to be synced with Cake Extension for VS Code.

@gep13
Copy link
Author

gep13 commented Aug 4, 2017

@DustinCampbell oh, interesting! No I hadn't seen the highlighting in that theme. In which case, I would tend to agree that we could remove the syntax highlighting from the Cake Extension for VSCode, and instead, point people at using the existing Themes.

@patriksvensson @devlead @mholo65 @agc93 thoughts?

@devlead
Copy link

devlead commented Aug 4, 2017

I'm all for deleting custom code, so if standard C# works, yes lets ditch the specific one.

@DustinCampbell
Copy link
Member

OK. I contributed this as a PR and it is now merged into VS Code: microsoft/vscode#32253.

So, Cake files will be treated as C#. We should see this show up in VS Code Insiders builds soon.

@bjorkstromm
Copy link
Contributor

Great! Thanks @DustinCampbell

@gep13 could probably start looking at removing Cake highlighting from Cake-VSCode

@gep13
Copy link
Author

gep13 commented Aug 11, 2017

@DustinCampbell sweet!

@mholo65 yip, it is on my list for over the weekend, so hopefully get to this, and get a new version of the extension out for testing.

@DustinCampbell
Copy link
Member

I forgot to update everyone here, but the latest VS Code release (1.16.1) now colorizes cake files by default (even when C# for VS Code is not installed).

@devlead
Copy link

devlead commented Oct 3, 2017

Oh nice 👍

@gep13
Copy link
Author

gep13 commented Oct 4, 2017

@DustinCampbell that is very cool! Thanks for letting us know! 😄

@DustinCampbell DustinCampbell added this to the 1.13 milestone Oct 27, 2017
@DustinCampbell
Copy link
Member

@mholo65: I've released v1.13.0-beta4, which contains the new Cake bits. However, when testing it on Windows, I got the following:

[warn]: OmniSharp.Cake.CakeProjectSystem
        Cake script service not connected. Aborting.

@bjorkstromm
Copy link
Contributor

@DustinCampbell nice! The warning you are getting is due to cake.bakery is not installed in your tools folder.

See examle in test-project https://github.com/OmniSharp/omnisharp-roslyn/blob/master/test-assets/test-projects/CakeProject/tools/packages.config

@gep13
Copy link
Author

gep13 commented Oct 29, 2017

@DustinCampbell assuming you have the latest Cake extension for VSCode, there is a new command that will help with installing that dependency.

@DustinCampbell
Copy link
Member

Ah. I need the Cake extension. thanks!

@patriksvensson
Copy link

@DustinCampbell You don't need the Cake extension, but it makes it a lot easier to install Cake.Bakery.

@DustinCampbell
Copy link
Member

I just installed the Cake extension and invoked the "Cake: install intellisense support" command. All is now well. Looks great!

I think we can close this issue now. Nice work everyone!

@gep13
Copy link
Author

gep13 commented Oct 30, 2017

@DustinCampbell that is great news!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants