@@ -1338,26 +1338,29 @@ evaluate python in the context of the debugee, ...."
13381338(defun dap-ui-repl--calculate-candidates ()
13391339 " Calculate completion candidates.
13401340TEXT is the current input."
1341- (let ((text (comint-get-old-input-default ))
1342- (debug-session (dap--cur-active-session-or-die)))
1343- (if-let (frame-id (-some->> debug-session
1344- dap--debug-session-active-frame
1345- (gethash " id" )))
1346- (cons :async
1347- (lambda (callback )
1348- (dap--send-message
1349- (dap--make-request " completions"
1350- (list :frameId frame-id
1351- :text text
1352- :column (- (length text) (- (point-at-eol ) (point )))))
1353- (dap--resp-handler
1354- (lambda (result )
1355- (-if-let (targets (-some->> result (gethash " body" ) (gethash " targets" )))
1356- (funcall callback (-map (-lambda ((item &as &hash " label" " text" " type" ))
1357- (propertize label :text text :type type :dap-completion-item item))
1358- targets))
1359- (funcall callback ()))))
1360- debug-session))))))
1341+ (when (-some->> (dap--cur-session)
1342+ (dap--debug-session-current-capabilities)
1343+ (gethash " supportsCompletionsRequest" ))
1344+ (let ((text (comint-get-old-input-default ))
1345+ (debug-session (dap--cur-active-session-or-die)))
1346+ (if-let (frame-id (-some->> debug-session
1347+ dap--debug-session-active-frame
1348+ (gethash " id" )))
1349+ (cons :async
1350+ (lambda (callback )
1351+ (dap--send-message
1352+ (dap--make-request " completions"
1353+ (list :frameId frame-id
1354+ :text text
1355+ :column (- (length text) (- (point-at-eol ) (point )))))
1356+ (dap--resp-handler
1357+ (lambda (result )
1358+ (-if-let (targets (-some->> result (gethash " body" ) (gethash " targets" )))
1359+ (funcall callback (-map (-lambda ((item &as &hash " label" " text" " type" ))
1360+ (propertize label :text text :type type :dap-completion-item item))
1361+ targets))
1362+ (funcall callback ()))))
1363+ debug-session)))))))
13611364
13621365(defun dap-ui-repl--post-completion (candidate )
13631366 " Post completion handling for CANDIDATE."
0 commit comments