forked from jeapostrophe/racket-langserver
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautocomplete.rkt
More file actions
25 lines (19 loc) · 795 Bytes
/
autocomplete.rkt
File metadata and controls
25 lines (19 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#lang racket/base
(provide walk
walk-online)
;; powered by https://github.com/yjqww6/drcomplete
(require racket/set
(prefix-in user-defined: "autocomplete/user-defined.rkt")
(prefix-in required: "autocomplete/required.rkt")
(prefix-in module-name: "autocomplete/module.rkt"))
;; Get completions that will be cached for every successful expand.
;; Syntax -> (Listof Symbol)
(define (walk stx)
(append
(set->list (user-defined:walk stx))
(with-handlers ([exn:fail? (λ (_) '())])
(set->list (required:walk-module stx)))))
;; Get completions that will be computed for every text change.
;; String -> (Listof Symbol)
(define (walk-online str-before-cursor)
(map string->symbol (set->list (module-name:get-completions str-before-cursor))))