@@ -307,35 +307,36 @@ GHC's options, and language extensions, but not identifiers."
307
307
(let ((prefix (haskell-completions-grab-prefix)))
308
308
(haskell-completions--simple-completions prefix)))
309
309
310
- (defun haskell-completions-sync-completions -at-point ()
310
+ (defun haskell-completions-sync-repl-completion -at-point ()
311
311
" A `completion-at-point' function using the current haskell process.
312
312
Returns nil if no completions available."
313
313
(let ((prefix-data (haskell-completions-grab-prefix)))
314
314
(when prefix-data
315
315
(cl-destructuring-bind (beg end pfx typ) prefix-data
316
- (let ((imp (eql typ 'haskell-completions-module-name-prefix ))
317
- lst)
318
- (setq lst
319
- (cl-case typ
320
- ; ; non-interactive completions first
321
- ('haskell-completions-pragma-name-prefix
322
- haskell-completions--pragma-names)
323
- ('haskell-completions-ghc-option-prefix
324
- haskell-ghc-supported-options)
325
- ('haskell-completions-language-extension-prefix
326
- haskell-ghc-supported-extensions)
327
- (otherwise
328
- (when (and
329
- (not (eql typ 'haskell-completions-general-prefix ))
330
- (haskell-session-maybe )
331
- (not
332
- (haskell-process-cmd (haskell-interactive-process))))
333
- ; ; if REPL is available and not busy try to query it
334
- ; ; for completions list in case of module name or
335
- ; ; identifier prefixes
336
- (haskell-completions-sync-complete-repl pfx imp)))))
337
- (when lst
338
- (list beg end lst)))))))
316
+ (when (not (eql typ 'haskell-completions-general-prefix ))
317
+ ; ; do not complete things in comments
318
+ (if (cl-member
319
+ typ
320
+ '(haskell-completions-pragma-name-prefix
321
+ haskell-completions-ghc-option-prefix
322
+ haskell-completions-language-extension-prefix))
323
+ ; ; provide simple completions
324
+ (haskell-completions--simple-completions prefix-data)
325
+ ; ; only two cases left: haskell-completions-module-name-prefix
326
+ ; ; and haskell-completions-identifier-prefix
327
+ (let* ((is-import (eql typ 'haskell-completions-module-name-prefix ))
328
+ (candidates
329
+ (when (and (haskell-session-maybe )
330
+ (not (haskell-process-cmd
331
+ (haskell-interactive-process))))
332
+ ; ; if REPL is available and not busy try to query it for
333
+ ; ; completions list in case of module name or identifier
334
+ ; ; prefixes
335
+ (haskell-completions-sync-complete-repl pfx is-import))))
336
+ ; ; append candidates with keywords
337
+ (list beg end (append
338
+ candidates
339
+ haskell-completions--keywords)))))))))
339
340
340
341
(defun haskell-completions-sync-complete-repl (prefix &optional import )
341
342
" Return completion list for given PREFIX querying REPL synchronously.
0 commit comments