@@ -220,6 +220,41 @@ result only if prefix length is not less than MINLEN."
220
220
prefix))
221
221
(prefix prefix)))))
222
222
223
+
224
+ (defun haskell-completions-sync-completions-at-point ()
225
+ " A `completion-at-point' function using the current haskell process.
226
+ Returns nil if no completions available."
227
+ (let ((prefix-data (haskell-completions-grab-prefix)))
228
+ (when prefix-data
229
+ (cl-destructuring-bind (beg end pfx typ) prefix-data
230
+ (let ((imp (eql typ 'haskell-completions-module-name-prefix ))
231
+ lst)
232
+ (setq lst
233
+ (cl-case typ
234
+ ; ; non-interactive completions first
235
+ ('haskell-completions-pragma-name-prefix
236
+ haskell-completions-pragma-names)
237
+ ('haskell-completions-ghc-option-prefix
238
+ haskell-ghc-supported-options)
239
+ ('haskell-completions-language-extension-prefix
240
+ haskell-ghc-supported-extensions)
241
+ (otherwise
242
+ (when (and
243
+ (not (eql typ 'haskell-completions-general-prefix ))
244
+ (haskell-session-maybe )
245
+ (not
246
+ (haskell-process-cmd (haskell-interactive-process))))
247
+ ; ; if REPL is available and not busy try to query it
248
+ ; ; for completions list in case of module name or
249
+ ; ; identifier prefixes
250
+ (haskell-completions-sync-complete-repl pfx imp)))))
251
+ (when (or (equal '(" " ) lst)
252
+ (eql nil lst))
253
+ ; ; complete things using dabbrev
254
+ (setq lst (haskell-completions-dabbrev-completions pfx)))
255
+ (when lst
256
+ (list beg end lst)))))))
257
+
223
258
(defun haskell-completions-sync-complete-repl (prefix &optional import )
224
259
" Return completion list for given PREFIX quering REPL synchronously.
225
260
When optional IMPORT argument is non-nil complete PREFIX
0 commit comments