-
Notifications
You must be signed in to change notification settings - Fork 420
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
Further improvements to CSX support #760
Conversation
var cancellationSource = new CancellationTokenSource(TimeSpan.FromMilliseconds(request.Timeout)); | ||
var metadataDocument = await _metadataHelper.GetDocumentFromMetadata(document.Project, symbol, cancellationSource.Token); | ||
if (metadataDocument != null) | ||
try |
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.
sorry this change got in by accident, will revert
@@ -62,8 +62,7 @@ public Task<Document> GetDocumentFromMetadata(Project project, ISymbol symbol, C | |||
|
|||
var service = _csharpMetadataAsSourceService.CreateInstance(temporaryDocument.Project.LanguageServices); | |||
var method = _csharpMetadataAsSourceService.GetMethod(AddSourceToAsync); | |||
|
|||
return method.Invoke<Task<Document>>(service, new object[] { temporaryDocument, topLevelSymbol, cancellationToken }); | |||
return method.Invoke<Task<Document>>(service, new object[] {temporaryDocument, topLevelSymbol, cancellationToken}); |
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.
Did you mean to indent here?
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.
no 😧
CreateCsxProject(csxPath); | ||
var csxFileName = Path.GetFileName(csxPath); | ||
var project = ProjectInfo.Create( | ||
id: ProjectId.CreateNewId(Guid.NewGuid().ToString()), |
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.
I don't think you need to create a new Guid for this. ProjectId.Create()
already does that. The debugName
parameter is to give it something human-readable for debugging. (ref)
Logger.LogError($"{csxPath} will be ignored due to the following error:", ex.ToString()); | ||
Logger.LogError(ex.ToString()); | ||
Logger.LogError(ex.InnerException?.ToString() ?? "No inner exception."); | ||
_logger.LogError(0, ex, $"{csxPath} will be ignored due to an following error"); |
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.
We've got an extension method that allows you to call LogError without needing to pass an event ID now.
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.
I love all of the red! 😄
All kinds of awesome |
thanks, pushed the mentioned changes - should be good to go now |
This is a follow up PR to the large work we did in #659
In that PR we removed custom scripting code and focused on "standard" Roslyn scripting.
In this PR, we take it a step further and introduce suggestions from Tomas (#659 (comment)) on how to approach CSX projects (which have no project system after all). So what we do here, is we move away from the current model of "project-per-file" to a "project-per-entry-file" model (a project is created only for a top-level CSX file and all its #load dependencies are delegated to Roslyn's
ScriptSourceResolver
- we never manually specify project-to-project relationships anymore).This has some terrific results for us:
#r
references or#load
directives and we pick them up in real time#load
per project are now supported (in the past, due to our "project-per-file" model, only 1 was allowed - this is because a submission compilation can only have one project reference)Fixes #227 and #689 - two most important issues we have for CSX at the moment.
Here is the behavior demo for "real time"
#load
:And "real time"
#r
: