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

Move to Omnisharp lib 0.18.x #1376

Merged
merged 13 commits into from
Nov 4, 2020

Conversation

TylerLeonhardt
Copy link
Member

No description provided.

@TylerLeonhardt TylerLeonhardt changed the title WIP Move to Omnisharp lib 0.18.x Oct 28, 2020
@TylerLeonhardt TylerLeonhardt marked this pull request as ready for review October 28, 2020 21:29
options.Receiver = new DapReceiver();
options.LoggerFactory = _loggerFactory;
ILogger logger = options.LoggerFactory.CreateLogger("DebugOptionsStartup");
options.WithSerializer(new DapProtocolSerializer());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line won't be needed for 0.18.2

Copy link

@david-driscoll david-driscoll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, let me know if you have more questions!

Copy link
Contributor

@rjmholt rjmholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, hmm, it didn't post my review when I wrote it... Ok now it's posting

};
}

public Task<SetExceptionBreakpointsResponse> Handle(SetExceptionBreakpointsArguments request, CancellationToken cancellationToken)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this method currently return successfully? What will the behaviour be if someone tries to set an exception breakpoint? Will it just silently do nothing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've not changed the code. Just moved it to a different space. There isn't a SupportsExceptionBreakpoints capability so we have to handle this message... but it seems like it just silently does nothing... very odd.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://microsoft.github.io/debug-adapter-protocol/specification#arrow_left-initialized-event
frontend sends a ‘setExceptionBreakpoints’ request if one or more ‘exceptionBreakpointFilters’ have been defined (or if ‘supportsConfigurationDoneRequest’ is not defined or false)

Comment on lines 118 to 132
.OnInitialize(async (server, request, cancellationToken) => {
var breakpointService = server.GetService<BreakpointService>();
// Clear any existing breakpoints before proceeding
await breakpointService.RemoveAllBreakpointsAsync().ConfigureAwait(false);
})
.OnInitialized((server, request, response, cancellationToken) => {
response.SupportsConditionalBreakpoints = true;
response.SupportsConfigurationDoneRequest = true;
response.SupportsFunctionBreakpoints = true;
response.SupportsHitConditionalBreakpoints = true;
response.SupportsLogPoints = true;
response.SupportsSetVariable = true;

return Task.CompletedTask;
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the difference between these? Which of them handles the Initialize request?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added comments in a few places to explain what we're doing here... it's a bit confusing. @david-driscoll says it's cause we're weird 😛

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming things is hard... so I just stuck with the protocol naming for the events.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to do some more documentation on how things work, it's on my list.

// sending configuration requests
_jsonRpcServer.SendNotification(EventNames.Initialized);
_debugStateService.ServerStarted.SetResult(true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on this, it looks like this could be a TaskCompletionSource<bool> (that way no allocation is needed to set the value of true)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed.

.OnInitialize(async (server, request, cancellationToken) => {
var breakpointService = server.GetService<BreakpointService>();
// Clear any existing breakpoints before proceeding
await breakpointService.RemoveAllBreakpointsAsync().ConfigureAwait(false);
})
// The OnInitialized delegate gets run right before the server responds to the _Initialize_ request:
// https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Initialize

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@TylerLeonhardt TylerLeonhardt merged commit b243fe3 into PowerShell:master Nov 4, 2020
@TylerLeonhardt TylerLeonhardt deleted the testing-rename branch November 4, 2020 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants