-
Notifications
You must be signed in to change notification settings - Fork 417
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
Cake support #932
Merged
Merged
Cake support #932
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
a651d6a
Adds OmniSharp.Cake project and Cake project system
bjorkstromm d9cd7a6
Project System now loads Cake files
bjorkstromm a1bcaba
Remove Cake.Core dependency
bjorkstromm 054ecf9
Use Cake Configuration
bjorkstromm 3fec513
Adds Buffer handlers for Cake
bjorkstromm 3635771
Added more services
bjorkstromm ec9af89
Adds context model to Cake
bjorkstromm e6225ac
Fix hostObjectType loading for Cake
bjorkstromm c46a223
Update dependencies
bjorkstromm fa78f27
Remove target netstandard1.6
bjorkstromm b4b9b3f
Use IAssemblyLoader
bjorkstromm 5c6760e
Use TargetFramework instead of TargetFrameworks
bjorkstromm 392c2b8
Add DocumentationProvider
bjorkstromm 6f66afa
Reorder request handlers
bjorkstromm e78d168
Refactor Cake Script Service
bjorkstromm 063fe25
Fix line number translations to work when a cake file is loaded.
bjorkstromm 55b6b27
Cache references and using and react on changes
bjorkstromm f207ceb
Find Cake.Bakery if path contains version
bjorkstromm f616e2e
Fix translation of lines for requests and responses
bjorkstromm e7b24c4
Added unit test project and fixed some translations.
bjorkstromm 3f61d56
Support method and property aliases in gotodefinition handler.
bjorkstromm 7299149
Git ignore launchSettings.json
bjorkstromm 7340b9f
Git ignore Rider stuff
bjorkstromm 753ebfe
Initial tests for Cake handlers.
bjorkstromm 6d99493
Catch any exception when parsing configuration.
bjorkstromm a295267
Use package versions from packages.props
bjorkstromm 65518ba
Handle incremental changes.
bjorkstromm cdd109a
Merge branch 'master' into feature/cake
david-driscoll e126ff4
Address code review comments.
bjorkstromm 54c3bab
Merge branch 'master' into feature/cake
DustinCampbell e2dd7df
Make Cake Bakery resolution case insensitive
bjorkstromm a6194f6
Update Cake.Scripting and Bakery versions
bjorkstromm 9fecd07
Add mono wrapper for executing bakery
bjorkstromm eb02fde
Fix LineIndexHelper and tests on Linux/OSX
bjorkstromm f6afebf
Add gotodefinition tests.
bjorkstromm e0cdfa5
Update to release bits of Cake.Scripting and Bakery
bjorkstromm 50ad596
CakeConfiguration was never used.
bjorkstromm 04825e0
Enhance compilation options usage in project system.
bjorkstromm 48a2e73
Removed some magic integers.
bjorkstromm 8a59058
Added MIT License for code copied from Cake repo
bjorkstromm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
using System.Runtime.CompilerServices; | ||
|
||
[assembly: InternalsVisibleTo("OmniSharp.Cake.Tests")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using System.Collections.Generic; | ||
using System.Collections.Immutable; | ||
using Microsoft.CodeAnalysis; | ||
using Microsoft.CodeAnalysis.Scripting; | ||
|
||
namespace OmniSharp.Cake | ||
{ | ||
internal class CachingScriptMetadataResolver : MetadataReferenceResolver | ||
{ | ||
private static readonly Dictionary<string, ImmutableArray<PortableExecutableReference>> DirectReferenceCache = new Dictionary<string, ImmutableArray<PortableExecutableReference>>(); | ||
private static readonly Dictionary<string, PortableExecutableReference> MissingReferenceCache = new Dictionary<string, PortableExecutableReference>(); | ||
private static readonly MetadataReferenceResolver DefaultRuntimeResolver = ScriptMetadataResolver.Default; | ||
|
||
public override bool Equals(object other) | ||
{ | ||
return DefaultRuntimeResolver.Equals(other); | ||
} | ||
|
||
public override int GetHashCode() | ||
{ | ||
return DefaultRuntimeResolver.GetHashCode(); | ||
} | ||
|
||
public override bool ResolveMissingAssemblies => DefaultRuntimeResolver.ResolveMissingAssemblies; | ||
|
||
public override PortableExecutableReference ResolveMissingAssembly(MetadataReference definition, AssemblyIdentity referenceIdentity) | ||
{ | ||
if (MissingReferenceCache.TryGetValue(referenceIdentity.Name, out var result)) | ||
{ | ||
return result; | ||
} | ||
|
||
result = DefaultRuntimeResolver.ResolveMissingAssembly(definition, referenceIdentity); | ||
if (result != null) | ||
{ | ||
MissingReferenceCache[referenceIdentity.Name] = result; | ||
} | ||
|
||
return result; | ||
} | ||
|
||
public override ImmutableArray<PortableExecutableReference> ResolveReference(string reference, string baseFilePath, MetadataReferenceProperties properties) | ||
{ | ||
var key = $"{reference}-{baseFilePath}"; | ||
if (DirectReferenceCache.TryGetValue(key, out var result)) | ||
{ | ||
return result; | ||
} | ||
|
||
result = DefaultRuntimeResolver.ResolveReference(reference, baseFilePath, properties); | ||
if (result.Length > 0) | ||
{ | ||
DirectReferenceCache[key] = result; | ||
} | ||
|
||
return result; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace OmniSharp.Cake | ||
{ | ||
internal class CakeContextModel | ||
{ | ||
public CakeContextModel(string filePath) | ||
{ | ||
Path = filePath; | ||
} | ||
|
||
public string Path { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace OmniSharp.Cake | ||
{ | ||
internal class CakeContextModelCollection | ||
{ | ||
public CakeContextModelCollection(IEnumerable<CakeContextModel> projects) | ||
{ | ||
Projects = projects; | ||
} | ||
|
||
public IEnumerable<CakeContextModel> Projects { get; } | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should either of these caches be case-insensitive on the key?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dunno, this was copy-pasted-with-pride from what used to be in OmniSharp.Script. Let’s ask @filipw?