import { workspace , WorkspaceConfiguration , ConfigurationTarget } from "vscode" ; import { DescriptionConfiguration } from "../shared" ; export function getWorkspaceConfiguration ( ) { return workspace . getConfiguration ( "interview" ) ; } export function shouldUpdateNotification ( ) { if ( getWorkspaceConfiguration ( ) . get ( "updateNotification" ) ) { getWorkspaceConfiguration ( ) . update ( "updateNotification" , + new Date ( ) , ConfigurationTarget . Global ) ; } return getWorkspaceConfiguration ( ) . get < number > ( "updateNotification" , 0 ) ; } export function setShouldUpdateNotification ( ) { getWorkspaceConfiguration ( ) . update ( "updateNotification" , + new Date ( ) , ConfigurationTarget . Global ) ; } export function shouldHideSolvedProblem ( ) { return getWorkspaceConfiguration ( ) . get < boolean > ( "hideSolved" , false ) ; } export function getWorkspaceFolder ( ) { return getWorkspaceConfiguration ( ) . get < string > ( "workspaceFolder" , "" ) ; } export function getEditorShortcuts ( ) { return getWorkspaceConfiguration ( ) . get < string [ ] > ( "editor.shortcuts" , [ "submit" , "test" , ] ) ; } export function hasStarShortcut ( ) { const shortcuts = getWorkspaceConfiguration ( ) . get < string [ ] > ( "editor.shortcuts" , [ "submit" , "test" ] ) ; return shortcuts . indexOf ( "star" ) >= 0 ; } export function getDescriptionConfiguration ( ) { const setting = getWorkspaceConfiguration ( ) . get < string > ( "showDescription" , DescriptionConfiguration . InWebView ) ; const config = { showInComment : false , showInWebview : true , } ; switch ( setting ) { case DescriptionConfiguration . Both : config . showInComment = true ; config . showInWebview = true ; break ; case DescriptionConfiguration . None : config . showInComment = false ; config . showInWebview = false ; break ; case DescriptionConfiguration . InFileComment : config . showInComment = true ; config . showInWebview = false ; break ; case DescriptionConfiguration . InWebView : config . showInComment = false ; config . showInWebview = true ; break ; } if ( getWorkspaceConfiguration ( ) . get < boolean > ( "showCommentDescription" ) ) { config . showInComment = true ; } return config ; } export interface IDescriptionConfiguration { showInComment : boolean ; showInWebview : boolean ; }