Skip to content

Commit

Permalink
feat: allow setUseGlobalPicker to take a function
Browse files Browse the repository at this point in the history
  • Loading branch information
Loïc Mangeonjean committed Apr 16, 2024
1 parent 7572132 commit 5f85ba4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ export function registerFile (file: RegisteredFile): monaco.IDisposable {

const editorOpenHandlerRegistry = new EditorOpenHandlerRegistry()

let _useGlobalPicker: boolean = false
export function setUseGlobalPicker (useGlobalPicker: boolean = true): void {
let _useGlobalPicker: boolean | (() => boolean) = false
export function setUseGlobalPicker (useGlobalPicker: boolean | (() => boolean) = true): void {
_useGlobalPicker = useGlobalPicker
}

export function useGlobalPicker (): boolean {
// should picker and keybindings be global or per-editor
return _useGlobalPicker
return typeof _useGlobalPicker === 'function' ? _useGlobalPicker() : _useGlobalPicker
}

let services: monaco.editor.IEditorOverrideServices = {
Expand Down

0 comments on commit 5f85ba4

Please sign in to comment.