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

IntelliSense not working for all .cake files in workspace #168

Closed
KatoStoelen opened this issue Dec 14, 2021 · 5 comments · Fixed by #169
Closed

IntelliSense not working for all .cake files in workspace #168

KatoStoelen opened this issue Dec 14, 2021 · 5 comments · Fixed by #169
Labels
Milestone

Comments

@KatoStoelen
Copy link

cake-vscode v2.0.0
Cake.Bakery v0.9.2

I was previously using cake-bakery.portable via Chocolatey to get IntelliSense working for .cake files. Worked like a charm until recently. I suspect it stopped working around the launch of cake-vscode v2.0.0. Hence, I tried to get the "Enable IntelliSense automatically in the Cake VS Code extension" feature working, without any luck.

In my workspace, I have two .cake files:

  • the main build script /build/build.cake
  • a utility script /build/utils/pretty-output.cake.

When Omnisharp is starting, I get an error while loading /build/build.cake. However, the utility script loads just fine:

[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in 'c:\path\to\workspace'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Found 2 Cake files.
[info]: OmniSharp.Cake.Services.CakeScriptService
        Using Cake.Bakery at c:\Users\[username]\.vscode\extensions\cake-build.cake-vscode-2.0.0\Cake.Bakery\tools\Cake.Bakery.exe
[fail]: OmniSharp.Cake.CakeProjectSystem
        c:\path\to\workspace\build\build.cake will be ignored due to an following error
System.IO.FileNotFoundException: Cake is not installed. Path  does not exist.
   at OmniSharp.Cake.CakeProjectSystem.GetProject(CakeScript cakeScript, String filePath) in D:\a\1\s\src\OmniSharp.Cake\CakeProjectSystem.cs:line 281
   at OmniSharp.Cake.CakeProjectSystem.AddCakeFile(String cakeFilePath) in D:\a\1\s\src\OmniSharp.Cake\CakeProjectSystem.cs:line 125
[info]: OmniSharp.Cake.CakeProjectSystem
        Added Cake project 'c:\path\to\workspace\build\utils\pretty-output.cake' to the workspace.

Seems like CakeScript.Host.AssemblyPath is empty (or null?) for /build/build.cake.

One other thing I noticed with cake-vscode v2.0.0 (could probably be created as a separate issue), is that when omnisharp.json already exists, it is not updated with path to Cake.Bakery. Resulting in the error: Could not initialize Cake script service. Aborting.

A workaround was to delete/rename omnisharp.json, delete Cake.Bakery from cake-vscode extension directory and launch VS Code. This resulted in a new omnisharp.json file with bakeryPath set.

@gep13
Copy link
Member

gep13 commented Dec 14, 2021

@KatoStoelen sorry to hear that you are having problems!

Are you able to provide a small sample repository that shows the problem that you are having? That would be the quickest way to try to get to the bottom of this problem.

Thanks!

@KatoStoelen
Copy link
Author

Was able to find the culprit. Seems that Cake.Git v2.0.0 is causing this to happen. Tested previous versions of Cake.Git and some other addins, and the CakeProjectSystem was able to load the file without errors.

I can create an issue for Cake.Git instead.

The error message seems a bit off though.

@gep13
Copy link
Member

gep13 commented Dec 14, 2021

A working (or in this case, not working) example showing the problem would still be required though. Perhaps best to keep the issue here until we decide what needs to be done to rectify this.

@KatoStoelen
Copy link
Author

I'm too trigger happy it seems (already created another issue) 😬

Steps to reproduce:

  1. Create a new .cake file in any folder
  2. Add the following addin directive to the file (the only content needed)
    #addin "nuget:?package=Cake.Git&version=2.0.0"
  3. Open the folder in VS Code with cake-vscode 2.0.0 and Cake.Bakery 0.9.2
  4. Observe the OmniSharp Log:
    [fail]: OmniSharp.Cake.CakeProjectSystem
            path\to\folder\your.cake will be ignored due to an following error
    System.IO.FileNotFoundException: Cake is not installed. Path  does not exist.
        at OmniSharp.Cake.CakeProjectSystem.GetProject(CakeScript cakeScript, String filePath) in D:\a\1\s\src\OmniSharp.Cake\CakeProjectSystem.cs:line 281
        at OmniSharp.Cake.CakeProjectSystem.AddCakeFile(String cakeFilePath) in D:\a\1\s\src\OmniSharp.Cake\CakeProjectSystem.cs:line 125

@gep13 gep13 transferred this issue from cake-build/cake-vscode Dec 15, 2021
nils-a added a commit to nils-a/bakery that referenced this issue Jan 5, 2022
devlead added a commit that referenced this issue Mar 29, 2022
(#168) do not load dlls under runtimes
@devlead devlead added this to the 0.10.0 milestone Mar 29, 2022
@devlead devlead added the Bug label Mar 29, 2022
@cake-build-bot
Copy link

🎉 This issue has been resolved in version 0.10.0 🎉

The release is available on:

Your GitReleaseManager bot 📦🚀

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

Successfully merging a pull request may close this issue.

4 participants