Skip to content

Commit f4eab75

Browse files
committed
debug start language: store the value of the context key per workspace storage
microsoft#85548
1 parent 7d10b5a commit f4eab75

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/vs/workbench/contrib/debug/browser/startView.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,18 @@ import { WorkbenchStateContext } from 'vs/workbench/browser/contextkeys';
2222
import { OpenFolderAction, OpenFileAction, OpenFileFolderAction } from 'vs/workbench/browser/actions/workspaceActions';
2323
import { isMacintosh } from 'vs/base/common/platform';
2424
import { isCodeEditor } from 'vs/editor/browser/editorBrowser';
25+
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
2526

26-
const CONTEXT_DEBUG_START_LANGUAGE = new RawContextKey<string>('debugStartLanguage', undefined);
27+
const debugStartLanguageKey = 'debugStartLanguage';
28+
const CONTEXT_DEBUG_START_LANGUAGE = new RawContextKey<string>(debugStartLanguageKey, undefined);
2729
const CONTEXT_DEBUGGER_INTERESTED_IN_ACTIVE_EDITOR = new RawContextKey<boolean>('debuggerInterestedInActiveEditor', false);
2830

2931
export class StartView extends ViewPane {
3032

3133
static ID = 'workbench.debug.startView';
3234
static LABEL = localize('start', "Start");
3335

34-
private debugStartLanguageContext: IContextKey<string>;
36+
private debugStartLanguageContext: IContextKey<string | undefined>;
3537
private debuggerInterestedContext: IContextKey<boolean>;
3638

3739
constructor(
@@ -46,11 +48,15 @@ export class StartView extends ViewPane {
4648
@IInstantiationService instantiationService: IInstantiationService,
4749
@IViewDescriptorService viewDescriptorService: IViewDescriptorService,
4850
@IOpenerService openerService: IOpenerService,
51+
@IStorageService storageSevice: IStorageService
4952
) {
5053
super({ ...(options as IViewPaneOptions), ariaHeaderLabel: localize('debugStart', "Debug Start Section") }, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService);
5154

5255
this.debugStartLanguageContext = CONTEXT_DEBUG_START_LANGUAGE.bindTo(contextKeyService);
5356
this.debuggerInterestedContext = CONTEXT_DEBUGGER_INTERESTED_IN_ACTIVE_EDITOR.bindTo(contextKeyService);
57+
const lastSetLanguage = storageSevice.get(debugStartLanguageKey, StorageScope.WORKSPACE);
58+
this.debugStartLanguageContext.set(lastSetLanguage);
59+
5460
const setContextKey = () => {
5561
const editor = this.editorService.activeTextEditorWidget;
5662
if (isCodeEditor(editor)) {
@@ -59,6 +65,7 @@ export class StartView extends ViewPane {
5965
if (language && this.debugService.getConfigurationManager().isDebuggerInterestedInLanguage(language)) {
6066
this.debugStartLanguageContext.set(language);
6167
this.debuggerInterestedContext.set(true);
68+
storageSevice.store(debugStartLanguageKey, language, StorageScope.WORKSPACE);
6269
return;
6370
}
6471
}

0 commit comments

Comments
 (0)