(module language mzscheme
(require (lib "list.ss")
(lib "class.ss")
(lib "etc.ss")
(lib "framework.ss" "framework")
(lib "contract.ss")
"utilities.ss")
(provide initialize-get-language)
(define get-settings-preferences-symbol #f)
(define language-settings-language #f)
(define capability-registered? #f)
(define (initialize-get-language
drscheme:language-configuration:get-settings-preferences-symbol
drscheme:language-configuration:language-settings-language
drscheme:language:capability-registered?)
(set! get-settings-preferences-symbol
drscheme:language-configuration:get-settings-preferences-symbol)
(set! language-settings-language
drscheme:language-configuration:language-settings-language)
(set! capability-registered?
drscheme:language:capability-registered?))
(define (get-language)
(let* ([language-settings
(preferences:get (get-settings-preferences-symbol))]
[language
(language-settings-language language-settings)])
language))
(define (get-language-name)
(local ((define language (get-language))
(define name1 (send language get-language-name))
(define name2 (first (last-pair (send language get-language-position)))))
name2))
(define (get-language-autocompletes)
(define (return-defaults)
(map symbol->string (get-mzscheme-mapped-symbols)))
(cond
[(capability-registered? 'drscheme:autocomplete-words)
(with-handlers ([exn:fail? (lambda (exn) (return-defaults))])
(send (get-language) capability-value 'drscheme:autocomplete-words))]
[else
(return-defaults)]))
(provide/contract [get-language-name (-> string?)]
[get-language-autocompletes (-> (listof string?))]))