@codingame/monaco-vscode-debug-service-override 2.0.3 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/debug.js +3 -1
- package/package.json +3 -3
- package/vscode/src/vs/workbench/contrib/debug/browser/callStackView.js +3 -3
- package/vscode/src/vs/workbench/contrib/debug/browser/debug.contribution.js +47 -3
- package/vscode/src/vs/workbench/contrib/debug/browser/debugActionViewItems.js +7 -3
- package/vscode/src/vs/workbench/contrib/debug/browser/debugCommands.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.js +18 -7
- package/vscode/src/vs/workbench/contrib/debug/browser/debugConsoleQuickAccess.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorActions.js +36 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorContribution.js +137 -121
- package/vscode/src/vs/workbench/contrib/debug/browser/debugHover.js +34 -5
- package/vscode/src/vs/workbench/contrib/debug/browser/debugMemory.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/debugProgress.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/debugService.js +106 -38
- package/vscode/src/vs/workbench/contrib/debug/browser/debugSession.js +123 -56
- package/vscode/src/vs/workbench/contrib/debug/browser/debugSessionPicker.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/debugTaskRunner.js +8 -7
- package/vscode/src/vs/workbench/contrib/debug/browser/debugToolBar.js +43 -19
- package/vscode/src/vs/workbench/contrib/debug/browser/debugViewlet.js +2 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/disassemblyView.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/loadedScriptsView.js +2 -2
- package/vscode/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/repl.js +18 -8
- package/vscode/src/vs/workbench/contrib/debug/browser/replFilter.js +1 -1
- package/vscode/src/vs/workbench/contrib/debug/browser/replViewer.js +2 -2
- package/vscode/src/vs/workbench/contrib/debug/browser/variablesView.js +87 -36
- package/vscode/src/vs/workbench/contrib/debug/browser/watchExpressionsView.js +45 -6
- package/vscode/src/vs/workbench/contrib/debug/browser/welcomeView.js +9 -3
- package/vscode/src/vs/workbench/contrib/debug/common/debugStorage.js +4 -4
- package/vscode/src/vs/workbench/contrib/debug/browser/baseDebugView.js +0 -204
- package/vscode/src/vs/workbench/contrib/debug/common/replModel.js +0 -287
|
@@ -10,6 +10,7 @@ import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
|
|
|
10
10
|
import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
11
11
|
import { deepClone, equals } from 'vscode/vscode/vs/base/common/objects';
|
|
12
12
|
import Severity from 'vscode/vscode/vs/base/common/severity';
|
|
13
|
+
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
13
14
|
import { generateUuid } from 'vscode/vscode/vs/base/common/uuid';
|
|
14
15
|
import { isCodeEditor } from 'vscode/vscode/vs/editor/browser/editorBrowser';
|
|
15
16
|
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
@@ -25,16 +26,18 @@ import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/
|
|
|
25
26
|
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity';
|
|
26
27
|
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
27
28
|
import { IWorkspaceTrustRequestService } from 'vscode/vscode/vs/platform/workspace/common/workspaceTrust';
|
|
28
|
-
import {
|
|
29
|
+
import { IViewDescriptorService } from 'vscode/vscode/vs/workbench/common/views';
|
|
30
|
+
import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService';
|
|
29
31
|
import { AdapterManager } from './debugAdapterManager.js';
|
|
30
32
|
import { DEBUG_CONFIGURE_COMMAND_ID, DEBUG_CONFIGURE_LABEL } from './debugCommands.js';
|
|
31
33
|
import { ConfigurationManager } from './debugConfigurationManager.js';
|
|
32
34
|
import { DebugMemoryFileSystemProvider } from './debugMemory.js';
|
|
33
35
|
import { DebugSession } from './debugSession.js';
|
|
34
36
|
import { DebugTaskRunner } from './debugTaskRunner.js';
|
|
35
|
-
import { CALLSTACK_VIEW_ID, DEBUG_MEMORY_SCHEME, CONTEXT_DEBUG_TYPE, CONTEXT_DEBUG_STATE, CONTEXT_HAS_DEBUGGED, CONTEXT_IN_DEBUG_MODE, CONTEXT_DEBUG_UX, CONTEXT_BREAKPOINTS_EXIST, CONTEXT_DISASSEMBLY_VIEW_FOCUS, getStateLabel, debuggerDisabledMessage, VIEWLET_ID, REPL_VIEW_ID } from 'vscode/vscode/vs/workbench/contrib/debug/common/debug';
|
|
37
|
+
import { CALLSTACK_VIEW_ID, DEBUG_MEMORY_SCHEME, CONTEXT_DEBUG_TYPE, CONTEXT_DEBUG_STATE, CONTEXT_HAS_DEBUGGED, CONTEXT_IN_DEBUG_MODE, CONTEXT_DEBUG_UX, CONTEXT_BREAKPOINTS_EXIST, CONTEXT_DISASSEMBLY_VIEW_FOCUS, getStateLabel, debuggerDisabledMessage, VIEWLET_ID, REPL_VIEW_ID, DEBUG_SCHEME } from 'vscode/vscode/vs/workbench/contrib/debug/common/debug';
|
|
36
38
|
import { DebugCompoundRoot } from '../common/debugCompoundRoot.js';
|
|
37
39
|
import { DebugModel, Breakpoint, FunctionBreakpoint, DataBreakpoint, InstructionBreakpoint } from 'vscode/vscode/vs/workbench/contrib/debug/common/debugModel';
|
|
40
|
+
import { Source } from 'vscode/vscode/vs/workbench/contrib/debug/common/debugSource';
|
|
38
41
|
import { DebugStorage } from '../common/debugStorage.js';
|
|
39
42
|
import { DebugTelemetry } from '../common/debugTelemetry.js';
|
|
40
43
|
import { saveAllBeforeDebugStart, getExtensionHostDebugSession } from 'vscode/vscode/vs/workbench/contrib/debug/common/debugUtils';
|
|
@@ -71,6 +74,7 @@ let DebugService = class DebugService {
|
|
|
71
74
|
this.quickInputService = quickInputService;
|
|
72
75
|
this.workspaceTrustRequestService = workspaceTrustRequestService;
|
|
73
76
|
this.uriIdentityService = uriIdentityService;
|
|
77
|
+
this.restartingSessions = ( new Set());
|
|
74
78
|
this.disposables = ( new DisposableStore());
|
|
75
79
|
this.initializing = false;
|
|
76
80
|
this.sessionCancellationTokens = ( new Map());
|
|
@@ -417,7 +421,7 @@ let DebugService = class DebugService {
|
|
|
417
421
|
if (taskResult === 0 ) {
|
|
418
422
|
return false;
|
|
419
423
|
}
|
|
420
|
-
const cfg = await this.configurationManager.resolveDebugConfigurationWithSubstitutedVariables(launch && launch.workspace ? launch.workspace.uri : undefined, type, resolvedConfig, initCancellationToken.token);
|
|
424
|
+
const cfg = await this.configurationManager.resolveDebugConfigurationWithSubstitutedVariables(launch && launch.workspace ? launch.workspace.uri : undefined, resolvedConfig.type, resolvedConfig, initCancellationToken.token);
|
|
421
425
|
if (!cfg) {
|
|
422
426
|
if (launch && type && cfg === null && !initCancellationToken.token.isCancellationRequested) {
|
|
423
427
|
await launch.openConfigFile({ preserveFocus: true, type }, initCancellationToken.token);
|
|
@@ -571,12 +575,14 @@ let DebugService = class DebugService {
|
|
|
571
575
|
}
|
|
572
576
|
}
|
|
573
577
|
registerSessionListeners(session) {
|
|
574
|
-
const
|
|
578
|
+
const listenerDisposables = ( new DisposableStore());
|
|
579
|
+
this.disposables.add(listenerDisposables);
|
|
580
|
+
const sessionRunningScheduler = listenerDisposables.add(( new RunOnceScheduler(() => {
|
|
575
581
|
if (session.state === 3 && this.viewModel.focusedSession === session) {
|
|
576
582
|
this.viewModel.setFocus(undefined, this.viewModel.focusedThread, session, false);
|
|
577
583
|
}
|
|
578
|
-
}, 200));
|
|
579
|
-
|
|
584
|
+
}, 200)));
|
|
585
|
+
listenerDisposables.add(session.onDidChangeState(() => {
|
|
580
586
|
if (session.state === 3 && this.viewModel.focusedSession === session) {
|
|
581
587
|
sessionRunningScheduler.schedule();
|
|
582
588
|
}
|
|
@@ -584,7 +590,12 @@ let DebugService = class DebugService {
|
|
|
584
590
|
this.onStateChange();
|
|
585
591
|
}
|
|
586
592
|
}));
|
|
587
|
-
|
|
593
|
+
listenerDisposables.add(this.onDidEndSession(e => {
|
|
594
|
+
if (e.session === session && !e.restart) {
|
|
595
|
+
this.disposables.delete(listenerDisposables);
|
|
596
|
+
}
|
|
597
|
+
}));
|
|
598
|
+
listenerDisposables.add(session.onDidEndAdapter(async (adapterExitEvent) => {
|
|
588
599
|
if (adapterExitEvent) {
|
|
589
600
|
if (adapterExitEvent.error) {
|
|
590
601
|
this.notificationService.error(( localizeWithPath(
|
|
@@ -611,7 +622,13 @@ let DebugService = class DebugService {
|
|
|
611
622
|
}
|
|
612
623
|
this.endInitializingState();
|
|
613
624
|
this.cancelTokens(session.getId());
|
|
614
|
-
this.
|
|
625
|
+
if (this.configurationService.getValue('debug').closeReadonlyTabsOnEnd) {
|
|
626
|
+
const editorsToClose = this.editorService.getEditors(1 ).filter(({ editor }) => {
|
|
627
|
+
return editor.resource?.scheme === DEBUG_SCHEME && session.getId() === Source.getEncodedDebugData(editor.resource).sessionId;
|
|
628
|
+
});
|
|
629
|
+
this.editorService.closeEditors(editorsToClose);
|
|
630
|
+
}
|
|
631
|
+
this._onDidEndSession.fire({ session, restart: ( this.restartingSessions.has(session)) });
|
|
615
632
|
const focusedSession = this.viewModel.focusedSession;
|
|
616
633
|
if (focusedSession && focusedSession.getId() === session.getId()) {
|
|
617
634
|
const { session, thread, stackFrame } = getStackFrameThreadAndSessionToFocus(this.model, undefined, undefined, undefined, focusedSession);
|
|
@@ -690,39 +707,61 @@ let DebugService = class DebugService {
|
|
|
690
707
|
session.setConfiguration({ resolved, unresolved });
|
|
691
708
|
}
|
|
692
709
|
session.configuration.__restart = restartData;
|
|
710
|
+
const doRestart = async (fn) => {
|
|
711
|
+
this.restartingSessions.add(session);
|
|
712
|
+
let didRestart = false;
|
|
713
|
+
try {
|
|
714
|
+
didRestart = (await fn()) !== false;
|
|
715
|
+
}
|
|
716
|
+
catch (e) {
|
|
717
|
+
didRestart = false;
|
|
718
|
+
throw e;
|
|
719
|
+
}
|
|
720
|
+
finally {
|
|
721
|
+
this.restartingSessions.delete(session);
|
|
722
|
+
if (!didRestart) {
|
|
723
|
+
this._onDidEndSession.fire({ session, restart: false });
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
};
|
|
693
727
|
if (session.capabilities.supportsRestartRequest) {
|
|
694
728
|
const taskResult = await runTasks();
|
|
695
729
|
if (taskResult === 1 ) {
|
|
696
|
-
await
|
|
730
|
+
await doRestart(async () => {
|
|
731
|
+
await session.restart();
|
|
732
|
+
return true;
|
|
733
|
+
});
|
|
697
734
|
}
|
|
698
735
|
return;
|
|
699
736
|
}
|
|
700
737
|
const shouldFocus = !!this.viewModel.focusedSession && session.getId() === this.viewModel.focusedSession.getId();
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
738
|
+
return doRestart(async () => {
|
|
739
|
+
if (isAutoRestart) {
|
|
740
|
+
await session.disconnect(true);
|
|
741
|
+
}
|
|
742
|
+
else {
|
|
743
|
+
await session.terminate(true);
|
|
744
|
+
}
|
|
745
|
+
return ( new Promise((c, e) => {
|
|
746
|
+
setTimeout(async () => {
|
|
747
|
+
const taskResult = await runTasks();
|
|
748
|
+
if (taskResult !== 1 ) {
|
|
749
|
+
return c(false);
|
|
750
|
+
}
|
|
751
|
+
if (!resolved) {
|
|
752
|
+
return c(false);
|
|
753
|
+
}
|
|
754
|
+
try {
|
|
755
|
+
await this.launchOrAttachToSession(session, shouldFocus);
|
|
756
|
+
this._onDidNewSession.fire(session);
|
|
757
|
+
c(true);
|
|
758
|
+
}
|
|
759
|
+
catch (error) {
|
|
760
|
+
e(error);
|
|
761
|
+
}
|
|
762
|
+
}, 300);
|
|
763
|
+
}));
|
|
764
|
+
});
|
|
726
765
|
}
|
|
727
766
|
async stopSession(session, disconnect = false, suspend = false) {
|
|
728
767
|
if (session) {
|
|
@@ -843,6 +882,7 @@ let DebugService = class DebugService {
|
|
|
843
882
|
this.model.setEnablement(breakpoint, enable);
|
|
844
883
|
this.debugStorage.storeBreakpoints(this.model);
|
|
845
884
|
if (breakpoint instanceof Breakpoint) {
|
|
885
|
+
await this.makeTriggeredBreakpointsMatchEnablement(enable, breakpoint);
|
|
846
886
|
await this.sendBreakpoints(breakpoint.originalUri);
|
|
847
887
|
}
|
|
848
888
|
else if (breakpoint instanceof FunctionBreakpoint) {
|
|
@@ -893,7 +933,8 @@ let DebugService = class DebugService {
|
|
|
893
933
|
}
|
|
894
934
|
}
|
|
895
935
|
async removeBreakpoints(id) {
|
|
896
|
-
const
|
|
936
|
+
const breakpoints = this.model.getBreakpoints();
|
|
937
|
+
const toRemove = breakpoints.filter(bp => !id || bp.getId() === id);
|
|
897
938
|
toRemove.forEach(bp => status(( localizeWithPath(
|
|
898
939
|
'vs/workbench/contrib/debug/browser/debugService',
|
|
899
940
|
'breakpointRemoved',
|
|
@@ -901,10 +942,11 @@ let DebugService = class DebugService {
|
|
|
901
942
|
bp.lineNumber,
|
|
902
943
|
bp.uri.fsPath
|
|
903
944
|
))));
|
|
904
|
-
const urisToClear = (
|
|
945
|
+
const urisToClear = ( new Set(( toRemove.map(bp => ( bp.originalUri.toString())))));
|
|
905
946
|
this.model.removeBreakpoints(toRemove);
|
|
947
|
+
this.unlinkTriggeredBreakpoints(breakpoints, toRemove).forEach(uri => urisToClear.add(( uri.toString())));
|
|
906
948
|
this.debugStorage.storeBreakpoints(this.model);
|
|
907
|
-
await Promise.all(( urisToClear.map(uri => this.sendBreakpoints(uri))));
|
|
949
|
+
await Promise.all(( [...urisToClear].map(uri => this.sendBreakpoints(( URI.parse(uri))))));
|
|
908
950
|
}
|
|
909
951
|
setBreakpointsActivated(activated) {
|
|
910
952
|
this.model.setBreakpointsActivated(activated);
|
|
@@ -983,11 +1025,37 @@ let DebugService = class DebugService {
|
|
|
983
1025
|
await this.sendExceptionBreakpoints(session);
|
|
984
1026
|
}
|
|
985
1027
|
}
|
|
1028
|
+
unlinkTriggeredBreakpoints(allBreakpoints, removedBreakpoints) {
|
|
1029
|
+
const affectedUris = [];
|
|
1030
|
+
for (const removed of removedBreakpoints) {
|
|
1031
|
+
for (const existing of allBreakpoints) {
|
|
1032
|
+
if (!removedBreakpoints.includes(existing) && existing.triggeredBy === removed.getId()) {
|
|
1033
|
+
this.model.updateBreakpoints(( new Map([[existing.getId(), { triggeredBy: undefined }]])));
|
|
1034
|
+
affectedUris.push(existing.originalUri);
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
return affectedUris;
|
|
1039
|
+
}
|
|
1040
|
+
async makeTriggeredBreakpointsMatchEnablement(enable, breakpoint) {
|
|
1041
|
+
if (enable) {
|
|
1042
|
+
if (breakpoint.triggeredBy) {
|
|
1043
|
+
const trigger = this.model.getBreakpoints().find(bp => breakpoint.triggeredBy === bp.getId());
|
|
1044
|
+
if (trigger && !trigger.enabled) {
|
|
1045
|
+
await this.enableOrDisableBreakpoints(enable, trigger);
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
await Promise.all(( this.model.getBreakpoints()
|
|
1050
|
+
.filter(bp => bp.triggeredBy === breakpoint.getId() && bp.enabled !== enable)
|
|
1051
|
+
.map(bp => this.enableOrDisableBreakpoints(enable, bp))));
|
|
1052
|
+
}
|
|
986
1053
|
async sendBreakpoints(modelUri, sourceModified = false, session) {
|
|
987
1054
|
const breakpointsToSend = this.model.getBreakpoints({ originalUri: modelUri, enabledOnly: true });
|
|
988
1055
|
await sendToOneOrAllSessions(this.model, session, async (s) => {
|
|
989
1056
|
if (!s.configuration.noDebug) {
|
|
990
|
-
|
|
1057
|
+
const sessionBps = breakpointsToSend.filter(bp => !bp.triggeredBy || bp.getSessionDidTrigger(s.getId()));
|
|
1058
|
+
await s.sendBreakpoints(modelUri, sessionBps, sourceModified);
|
|
991
1059
|
}
|
|
992
1060
|
});
|
|
993
1061
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
2
|
import { status } from 'vscode/vscode/vs/base/browser/ui/aria/aria';
|
|
3
3
|
import { distinct } from 'vscode/vscode/vs/base/common/arrays';
|
|
4
|
-
import { RunOnceScheduler, Queue } from 'vscode/vscode/vs/base/common/async';
|
|
4
|
+
import { RunOnceScheduler, raceTimeout, Queue } from 'vscode/vscode/vs/base/common/async';
|
|
5
5
|
import { CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellation';
|
|
6
6
|
import { canceled } from 'vscode/vscode/vs/base/common/errors';
|
|
7
7
|
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
@@ -11,6 +11,7 @@ import { mixin } from 'vscode/vscode/vs/base/common/objects';
|
|
|
11
11
|
import { language } from 'vscode/vscode/vs/base/common/platform';
|
|
12
12
|
import { basenameOrAuthority } from 'vscode/vscode/vs/base/common/resources';
|
|
13
13
|
import Severity from 'vscode/vscode/vs/base/common/severity';
|
|
14
|
+
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
14
15
|
import { generateUuid } from 'vscode/vscode/vs/base/common/uuid';
|
|
15
16
|
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
16
17
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
@@ -26,7 +27,7 @@ import { IDebugService, VIEWLET_ID } from 'vscode/vscode/vs/workbench/contrib/de
|
|
|
26
27
|
import { MemoryRegion, ExpressionContainer, Thread } from 'vscode/vscode/vs/workbench/contrib/debug/common/debugModel';
|
|
27
28
|
import { Source } from 'vscode/vscode/vs/workbench/contrib/debug/common/debugSource';
|
|
28
29
|
import { filterExceptionsFromTelemetry } from 'vscode/vscode/vs/workbench/contrib/debug/common/debugUtils';
|
|
29
|
-
import { ReplModel } from '
|
|
30
|
+
import { ReplModel } from 'vscode/vscode/vs/workbench/contrib/debug/common/replModel';
|
|
30
31
|
import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService';
|
|
31
32
|
import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/host';
|
|
32
33
|
import { ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
|
|
@@ -34,6 +35,7 @@ import { IPaneCompositePartService } from 'vscode/vscode/vs/workbench/services/p
|
|
|
34
35
|
import { getActiveWindow } from 'vscode/vscode/vs/base/browser/dom';
|
|
35
36
|
import { mainWindow } from 'vscode/vscode/vs/base/browser/window';
|
|
36
37
|
|
|
38
|
+
const TRIGGERED_BREAKPOINT_MAX_DELAY = 1500;
|
|
37
39
|
let DebugSession = class DebugSession {
|
|
38
40
|
constructor(id, _configuration, root, model, options, debugService, telemetryService, hostService, configurationService, paneCompositeService, workspaceContextService, productService, notificationService, lifecycleService, uriIdentityService, instantiationService, customEndpointTelemetryService, workbenchEnvironmentService, logService) {
|
|
39
41
|
this.id = id;
|
|
@@ -59,7 +61,9 @@ let DebugSession = class DebugSession {
|
|
|
59
61
|
this.threadIds = [];
|
|
60
62
|
this.cancellationMap = ( new Map());
|
|
61
63
|
this.rawListeners = ( new DisposableStore());
|
|
64
|
+
this.globalDisposables = ( new DisposableStore());
|
|
62
65
|
this.stoppedDetails = [];
|
|
66
|
+
this.statusQueue = this.rawListeners.add(( new ThreadStatusScheduler()));
|
|
63
67
|
this._onDidChangeState = ( new Emitter());
|
|
64
68
|
this._onDidEndAdapter = ( new Emitter());
|
|
65
69
|
this._onDidLoadedSource = ( new Emitter());
|
|
@@ -78,7 +82,7 @@ let DebugSession = class DebugSession {
|
|
|
78
82
|
else {
|
|
79
83
|
this.repl = this.parentSession.repl;
|
|
80
84
|
}
|
|
81
|
-
const toDispose =
|
|
85
|
+
const toDispose = this.globalDisposables;
|
|
82
86
|
const replListener = toDispose.add(( new MutableDisposable()));
|
|
83
87
|
replListener.value = this.repl.onDidChangeElements(() => this._onDidChangeREPLElements.fire());
|
|
84
88
|
if (lifecycleService) {
|
|
@@ -499,6 +503,7 @@ let DebugSession = class DebugSession {
|
|
|
499
503
|
return this.raw.evaluate({ expression, frameId, context });
|
|
500
504
|
}
|
|
501
505
|
async restartFrame(frameId, threadId) {
|
|
506
|
+
await this.waitForTriggeredBreakpoints();
|
|
502
507
|
if (!this.raw) {
|
|
503
508
|
throw new Error(localizeWithPath('vs/workbench/contrib/debug/browser/debugSession', 'noDebugAdapter', "No debugger available, can not send '{0}'", 'restartFrame'));
|
|
504
509
|
}
|
|
@@ -511,6 +516,7 @@ let DebugSession = class DebugSession {
|
|
|
511
516
|
}
|
|
512
517
|
}
|
|
513
518
|
async next(threadId, granularity) {
|
|
519
|
+
await this.waitForTriggeredBreakpoints();
|
|
514
520
|
if (!this.raw) {
|
|
515
521
|
throw new Error(localizeWithPath('vs/workbench/contrib/debug/browser/debugSession', 'noDebugAdapter', "No debugger available, can not send '{0}'", 'next'));
|
|
516
522
|
}
|
|
@@ -518,6 +524,7 @@ let DebugSession = class DebugSession {
|
|
|
518
524
|
await this.raw.next({ threadId, granularity });
|
|
519
525
|
}
|
|
520
526
|
async stepIn(threadId, targetId, granularity) {
|
|
527
|
+
await this.waitForTriggeredBreakpoints();
|
|
521
528
|
if (!this.raw) {
|
|
522
529
|
throw new Error(localizeWithPath('vs/workbench/contrib/debug/browser/debugSession', 'noDebugAdapter', "No debugger available, can not send '{0}'", 'stepIn'));
|
|
523
530
|
}
|
|
@@ -525,6 +532,7 @@ let DebugSession = class DebugSession {
|
|
|
525
532
|
await this.raw.stepIn({ threadId, targetId, granularity });
|
|
526
533
|
}
|
|
527
534
|
async stepOut(threadId, granularity) {
|
|
535
|
+
await this.waitForTriggeredBreakpoints();
|
|
528
536
|
if (!this.raw) {
|
|
529
537
|
throw new Error(localizeWithPath('vs/workbench/contrib/debug/browser/debugSession', 'noDebugAdapter', "No debugger available, can not send '{0}'", 'stepOut'));
|
|
530
538
|
}
|
|
@@ -532,6 +540,7 @@ let DebugSession = class DebugSession {
|
|
|
532
540
|
await this.raw.stepOut({ threadId, granularity });
|
|
533
541
|
}
|
|
534
542
|
async stepBack(threadId, granularity) {
|
|
543
|
+
await this.waitForTriggeredBreakpoints();
|
|
535
544
|
if (!this.raw) {
|
|
536
545
|
throw new Error(localizeWithPath('vs/workbench/contrib/debug/browser/debugSession', 'noDebugAdapter', "No debugger available, can not send '{0}'", 'stepBack'));
|
|
537
546
|
}
|
|
@@ -539,12 +548,14 @@ let DebugSession = class DebugSession {
|
|
|
539
548
|
await this.raw.stepBack({ threadId, granularity });
|
|
540
549
|
}
|
|
541
550
|
async continue(threadId) {
|
|
551
|
+
await this.waitForTriggeredBreakpoints();
|
|
542
552
|
if (!this.raw) {
|
|
543
553
|
throw new Error(localizeWithPath('vs/workbench/contrib/debug/browser/debugSession', 'noDebugAdapter', "No debugger available, can not send '{0}'", 'continue'));
|
|
544
554
|
}
|
|
545
555
|
await this.raw.continue({ threadId });
|
|
546
556
|
}
|
|
547
557
|
async reverseContinue(threadId) {
|
|
558
|
+
await this.waitForTriggeredBreakpoints();
|
|
548
559
|
if (!this.raw) {
|
|
549
560
|
throw new Error(localizeWithPath('vs/workbench/contrib/debug/browser/debugSession', 'noDebugAdapter', "No debugger available, can not send '{0}'", 'reverse continue'));
|
|
550
561
|
}
|
|
@@ -776,6 +787,12 @@ let DebugSession = class DebugSession {
|
|
|
776
787
|
}
|
|
777
788
|
}
|
|
778
789
|
}
|
|
790
|
+
waitForTriggeredBreakpoints() {
|
|
791
|
+
if (!this._waitToResume) {
|
|
792
|
+
return;
|
|
793
|
+
}
|
|
794
|
+
return raceTimeout(this._waitToResume, TRIGGERED_BREAKPOINT_MAX_DELAY);
|
|
795
|
+
}
|
|
779
796
|
async fetchThreads(stoppedDetails) {
|
|
780
797
|
if (this.raw) {
|
|
781
798
|
const response = await this.raw.threads();
|
|
@@ -828,57 +845,8 @@ let DebugSession = class DebugSession {
|
|
|
828
845
|
await this.fetchThreads();
|
|
829
846
|
}
|
|
830
847
|
}));
|
|
831
|
-
const statusQueue = this.
|
|
832
|
-
this.rawListeners.add(this.raw.onDidStop(
|
|
833
|
-
this.passFocusScheduler.cancel();
|
|
834
|
-
this.stoppedDetails.push(event.body);
|
|
835
|
-
statusQueue.run(this.fetchThreads(event.body).then(() => event.body.threadId === undefined ? this.threadIds : [event.body.threadId]), async (threadId, token) => {
|
|
836
|
-
const hasLotsOfThreads = event.body.threadId === undefined && this.threadIds.length > 10;
|
|
837
|
-
const focusedThread = this.debugService.getViewModel().focusedThread;
|
|
838
|
-
const focusedThreadDoesNotExist = focusedThread !== undefined && focusedThread.session === this && !( this.threads.has(focusedThread.threadId));
|
|
839
|
-
if (focusedThreadDoesNotExist) {
|
|
840
|
-
this.debugService.focusStackFrame(undefined, undefined);
|
|
841
|
-
}
|
|
842
|
-
const thread = typeof threadId === 'number' ? this.getThread(threadId) : undefined;
|
|
843
|
-
if (thread) {
|
|
844
|
-
const promises = this.model.refreshTopOfCallstack(thread, !hasLotsOfThreads);
|
|
845
|
-
const focus = async () => {
|
|
846
|
-
if (focusedThreadDoesNotExist || (!event.body.preserveFocusHint && thread.getCallStack().length)) {
|
|
847
|
-
const focusedStackFrame = this.debugService.getViewModel().focusedStackFrame;
|
|
848
|
-
if (!focusedStackFrame || focusedStackFrame.thread.session === this) {
|
|
849
|
-
const preserveFocus = !this.configurationService.getValue('debug').focusEditorOnBreak;
|
|
850
|
-
await this.debugService.focusStackFrame(undefined, thread, undefined, { preserveFocus });
|
|
851
|
-
}
|
|
852
|
-
if (thread.stoppedDetails && !token.isCancellationRequested) {
|
|
853
|
-
if (thread.stoppedDetails.reason === 'breakpoint' && this.configurationService.getValue('debug').openDebug === 'openOnDebugBreak' && !this.suppressDebugView) {
|
|
854
|
-
await this.paneCompositeService.openPaneComposite(VIEWLET_ID, 0 );
|
|
855
|
-
}
|
|
856
|
-
if (this.configurationService.getValue('debug').focusWindowOnBreak && !this.workbenchEnvironmentService.extensionTestsLocationURI) {
|
|
857
|
-
const activeWindow = getActiveWindow();
|
|
858
|
-
if (!activeWindow.document.hasFocus()) {
|
|
859
|
-
await this.hostService.focus(mainWindow, { force: true });
|
|
860
|
-
}
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
}
|
|
864
|
-
};
|
|
865
|
-
await promises.topCallStack;
|
|
866
|
-
if (token.isCancellationRequested) {
|
|
867
|
-
return;
|
|
868
|
-
}
|
|
869
|
-
focus();
|
|
870
|
-
await promises.wholeCallStack;
|
|
871
|
-
if (token.isCancellationRequested) {
|
|
872
|
-
return;
|
|
873
|
-
}
|
|
874
|
-
const focusedStackFrame = this.debugService.getViewModel().focusedStackFrame;
|
|
875
|
-
if (!focusedStackFrame || !focusedStackFrame.source || focusedStackFrame.source.presentationHint === 'deemphasize' || focusedStackFrame.presentationHint === 'deemphasize') {
|
|
876
|
-
focus();
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
|
-
this._onDidChangeState.fire();
|
|
880
|
-
});
|
|
881
|
-
}));
|
|
848
|
+
const statusQueue = this.statusQueue;
|
|
849
|
+
this.rawListeners.add(this.raw.onDidStop(event => this.handleStop(event.body)));
|
|
882
850
|
this.rawListeners.add(this.raw.onDidThread(event => {
|
|
883
851
|
statusQueue.cancel([event.body.threadId]);
|
|
884
852
|
if (event.body.reason === 'started') {
|
|
@@ -1067,10 +1035,13 @@ let DebugSession = class DebugSession {
|
|
|
1067
1035
|
this._onDidInvalidMemory.fire(event);
|
|
1068
1036
|
}));
|
|
1069
1037
|
this.rawListeners.add(this.raw.onDidInvalidated(async (event) => {
|
|
1070
|
-
|
|
1038
|
+
const areas = event.body.areas || ['all'];
|
|
1039
|
+
if (areas.includes('threads') || areas.includes('stacks') || areas.includes('all')) {
|
|
1071
1040
|
this.cancelAllRequests();
|
|
1072
1041
|
this.model.clearThreads(this.getId(), true);
|
|
1073
|
-
|
|
1042
|
+
const details = this.stoppedDetails;
|
|
1043
|
+
this.stoppedDetails.length = 1;
|
|
1044
|
+
await Promise.all(( details.map(d => this.handleStop(d))));
|
|
1074
1045
|
}
|
|
1075
1046
|
const viewModel = this.debugService.getViewModel();
|
|
1076
1047
|
if (viewModel.focusedSession === this) {
|
|
@@ -1079,6 +1050,101 @@ let DebugSession = class DebugSession {
|
|
|
1079
1050
|
}));
|
|
1080
1051
|
this.rawListeners.add(this.raw.onDidExitAdapter(event => this.onDidExitAdapter(event)));
|
|
1081
1052
|
}
|
|
1053
|
+
async handleStop(event) {
|
|
1054
|
+
this.passFocusScheduler.cancel();
|
|
1055
|
+
this.stoppedDetails.push(event);
|
|
1056
|
+
if (event.hitBreakpointIds) {
|
|
1057
|
+
this._waitToResume = this.enableDependentBreakpoints(event.hitBreakpointIds);
|
|
1058
|
+
}
|
|
1059
|
+
this.statusQueue.run(this.fetchThreads(event).then(() => event.threadId === undefined ? this.threadIds : [event.threadId]), async (threadId, token) => {
|
|
1060
|
+
const hasLotsOfThreads = event.threadId === undefined && this.threadIds.length > 10;
|
|
1061
|
+
const focusedThread = this.debugService.getViewModel().focusedThread;
|
|
1062
|
+
const focusedThreadDoesNotExist = focusedThread !== undefined && focusedThread.session === this && !( this.threads.has(focusedThread.threadId));
|
|
1063
|
+
if (focusedThreadDoesNotExist) {
|
|
1064
|
+
this.debugService.focusStackFrame(undefined, undefined);
|
|
1065
|
+
}
|
|
1066
|
+
const thread = typeof threadId === 'number' ? this.getThread(threadId) : undefined;
|
|
1067
|
+
if (thread) {
|
|
1068
|
+
const promises = this.model.refreshTopOfCallstack(thread, !hasLotsOfThreads);
|
|
1069
|
+
const focus = async () => {
|
|
1070
|
+
if (focusedThreadDoesNotExist || (!event.preserveFocusHint && thread.getCallStack().length)) {
|
|
1071
|
+
const focusedStackFrame = this.debugService.getViewModel().focusedStackFrame;
|
|
1072
|
+
if (!focusedStackFrame || focusedStackFrame.thread.session === this) {
|
|
1073
|
+
const preserveFocus = !this.configurationService.getValue('debug').focusEditorOnBreak;
|
|
1074
|
+
await this.debugService.focusStackFrame(undefined, thread, undefined, { preserveFocus });
|
|
1075
|
+
}
|
|
1076
|
+
if (thread.stoppedDetails && !token.isCancellationRequested) {
|
|
1077
|
+
if (thread.stoppedDetails.reason === 'breakpoint' && this.configurationService.getValue('debug').openDebug === 'openOnDebugBreak' && !this.suppressDebugView) {
|
|
1078
|
+
await this.paneCompositeService.openPaneComposite(VIEWLET_ID, 0 );
|
|
1079
|
+
}
|
|
1080
|
+
if (this.configurationService.getValue('debug').focusWindowOnBreak && !this.workbenchEnvironmentService.extensionTestsLocationURI) {
|
|
1081
|
+
const activeWindow = getActiveWindow();
|
|
1082
|
+
if (!activeWindow.document.hasFocus()) {
|
|
1083
|
+
await this.hostService.focus(mainWindow, { force: true });
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
};
|
|
1089
|
+
await promises.topCallStack;
|
|
1090
|
+
if (!event.hitBreakpointIds) {
|
|
1091
|
+
this._waitToResume = this.enableDependentBreakpoints(thread);
|
|
1092
|
+
}
|
|
1093
|
+
if (token.isCancellationRequested) {
|
|
1094
|
+
return;
|
|
1095
|
+
}
|
|
1096
|
+
focus();
|
|
1097
|
+
await promises.wholeCallStack;
|
|
1098
|
+
if (token.isCancellationRequested) {
|
|
1099
|
+
return;
|
|
1100
|
+
}
|
|
1101
|
+
const focusedStackFrame = this.debugService.getViewModel().focusedStackFrame;
|
|
1102
|
+
if (!focusedStackFrame || !focusedStackFrame.source || focusedStackFrame.source.presentationHint === 'deemphasize' || focusedStackFrame.presentationHint === 'deemphasize') {
|
|
1103
|
+
focus();
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
this._onDidChangeState.fire();
|
|
1107
|
+
});
|
|
1108
|
+
}
|
|
1109
|
+
async enableDependentBreakpoints(hitBreakpointIdsOrThread) {
|
|
1110
|
+
let breakpoints;
|
|
1111
|
+
if (Array.isArray(hitBreakpointIdsOrThread)) {
|
|
1112
|
+
breakpoints = this.model.getBreakpoints().filter(bp => hitBreakpointIdsOrThread.includes(bp.getIdFromAdapter(this.id)));
|
|
1113
|
+
}
|
|
1114
|
+
else {
|
|
1115
|
+
const frame = hitBreakpointIdsOrThread.getTopStackFrame();
|
|
1116
|
+
if (frame === undefined) {
|
|
1117
|
+
return;
|
|
1118
|
+
}
|
|
1119
|
+
if (hitBreakpointIdsOrThread.stoppedDetails && hitBreakpointIdsOrThread.stoppedDetails.reason !== 'breakpoint') {
|
|
1120
|
+
return;
|
|
1121
|
+
}
|
|
1122
|
+
breakpoints = this.getBreakpointsAtPosition(frame.source.uri, frame.range.startLineNumber, frame.range.endLineNumber, frame.range.startColumn, frame.range.endColumn);
|
|
1123
|
+
}
|
|
1124
|
+
const urisToResend = ( new Set());
|
|
1125
|
+
this.model.getBreakpoints({ triggeredOnly: true, enabledOnly: true }).forEach(bp => {
|
|
1126
|
+
breakpoints.forEach(cbp => {
|
|
1127
|
+
if (bp.enabled && bp.triggeredBy === cbp.getId()) {
|
|
1128
|
+
bp.setSessionDidTrigger(this.getId());
|
|
1129
|
+
urisToResend.add(( bp.uri.toString()));
|
|
1130
|
+
}
|
|
1131
|
+
});
|
|
1132
|
+
});
|
|
1133
|
+
const results = [];
|
|
1134
|
+
urisToResend.forEach((uri) => results.push(this.debugService.sendBreakpoints(( URI.parse(uri)), undefined, this)));
|
|
1135
|
+
return Promise.all(results);
|
|
1136
|
+
}
|
|
1137
|
+
getBreakpointsAtPosition(uri, startLineNumber, endLineNumber, startColumn, endColumn) {
|
|
1138
|
+
return this.model.getBreakpoints({ uri: uri }).filter(bp => {
|
|
1139
|
+
if (bp.lineNumber < startLineNumber || bp.lineNumber > endLineNumber) {
|
|
1140
|
+
return false;
|
|
1141
|
+
}
|
|
1142
|
+
if (bp.column && (bp.column < startColumn || bp.column > endColumn)) {
|
|
1143
|
+
return false;
|
|
1144
|
+
}
|
|
1145
|
+
return true;
|
|
1146
|
+
});
|
|
1147
|
+
}
|
|
1082
1148
|
onDidExitAdapter(event) {
|
|
1083
1149
|
this.initialized = true;
|
|
1084
1150
|
this.model.setBreakpointSessionData(this.getId(), this.capabilities, undefined);
|
|
@@ -1102,6 +1168,7 @@ let DebugSession = class DebugSession {
|
|
|
1102
1168
|
dispose() {
|
|
1103
1169
|
this.cancelAllRequests();
|
|
1104
1170
|
this.rawListeners.dispose();
|
|
1171
|
+
this.globalDisposables.dispose();
|
|
1105
1172
|
}
|
|
1106
1173
|
getSourceForUri(uri) {
|
|
1107
1174
|
return this.sources.get(( this.uriIdentityService.asCanonicalUri(uri).toString()));
|
|
@@ -3,7 +3,7 @@ import { matchesFuzzy } from 'vscode/vscode/vs/base/common/filters';
|
|
|
3
3
|
import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
4
|
import { IDebugService, REPL_VIEW_ID } from 'vscode/vscode/vs/workbench/contrib/debug/common/debug';
|
|
5
5
|
import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput';
|
|
6
|
-
import { IViewsService } from 'vscode/vscode/vs/workbench/common/
|
|
6
|
+
import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService';
|
|
7
7
|
import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands';
|
|
8
8
|
|
|
9
9
|
async function showDebugSessionMenu(accessor, selectAndStartID) {
|
|
@@ -6,7 +6,7 @@ import { ITaskService } from 'vscode/vscode/vs/workbench/contrib/tasks/common/ta
|
|
|
6
6
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
7
7
|
import '../../../../../../../override/vs/platform/dialogs/common/dialogs.js';
|
|
8
8
|
import { MarkerSeverity, IMarkerService } from 'vscode/vscode/vs/platform/markers/common/markers';
|
|
9
|
-
import { IViewsService } from 'vscode/vscode/vs/workbench/common/
|
|
9
|
+
import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService';
|
|
10
10
|
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
11
11
|
import { createErrorWithActions } from 'vscode/vscode/vs/base/common/errorMessage';
|
|
12
12
|
import { Action } from 'vscode/vscode/vs/base/common/actions';
|
|
@@ -232,25 +232,26 @@ let DebugTaskRunner = class DebugTaskRunner {
|
|
|
232
232
|
))]));
|
|
233
233
|
}
|
|
234
234
|
let taskStarted = false;
|
|
235
|
-
const
|
|
235
|
+
const getTaskKey = (t) => t.getKey() ?? t.getMapKey();
|
|
236
|
+
const taskKey = getTaskKey(task);
|
|
236
237
|
const inactivePromise = ( new Promise((c) => once(e => {
|
|
237
238
|
return (e.kind === "inactive"
|
|
238
239
|
|| (e.kind === "processEnded" && e.exitCode === undefined))
|
|
239
|
-
&& e.__task
|
|
240
|
+
&& getTaskKey(e.__task) === taskKey;
|
|
240
241
|
}, this.taskService.onDidStateChange)(e => {
|
|
241
242
|
taskStarted = true;
|
|
242
243
|
c(e.kind === "processEnded" ? { exitCode: e.exitCode } : null);
|
|
243
244
|
})));
|
|
244
245
|
const promise = this.taskService.getActiveTasks().then(async (tasks) => {
|
|
245
|
-
if (tasks.find(t => t
|
|
246
|
+
if (tasks.find(t => getTaskKey(t) === taskKey)) {
|
|
246
247
|
const busyTasks = await this.taskService.getBusyTasks();
|
|
247
|
-
if (busyTasks.find(t => t
|
|
248
|
+
if (busyTasks.find(t => getTaskKey(t) === taskKey)) {
|
|
248
249
|
taskStarted = true;
|
|
249
250
|
return inactivePromise;
|
|
250
251
|
}
|
|
251
252
|
return Promise.resolve(null);
|
|
252
253
|
}
|
|
253
|
-
once(e => (((e.kind === "active") ) || ((e.kind === "dependsOnStarted") )) && e.__task
|
|
254
|
+
once(e => (((e.kind === "active") ) || ((e.kind === "dependsOnStarted") )) && getTaskKey(e.__task) === taskKey, this.taskService.onDidStateChange)(() => {
|
|
254
255
|
taskStarted = true;
|
|
255
256
|
});
|
|
256
257
|
const taskPromise = this.taskService.run(task);
|
|
@@ -261,7 +262,7 @@ let DebugTaskRunner = class DebugTaskRunner {
|
|
|
261
262
|
});
|
|
262
263
|
return ( new Promise((c, e) => {
|
|
263
264
|
const waitForInput = ( new Promise(
|
|
264
|
-
resolve => once(e => ((e.kind === "acquiredInput") ) && e.__task
|
|
265
|
+
resolve => once(e => ((e.kind === "acquiredInput") ) && getTaskKey(e.__task) === taskKey, this.taskService.onDidStateChange)(() => {
|
|
265
266
|
resolve();
|
|
266
267
|
})
|
|
267
268
|
));
|