From 7857b45b9e810c7c04f25c45ac7006e548220452 Mon Sep 17 00:00:00 2001 From: logicmoo Date: Thu, 28 Nov 2024 07:00:44 -0800 Subject: [PATCH] re-run-file --- .../lsp_server_metta/lsp-callbacks.metta | 38 +++++++++++++------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/src/packs/lsp_server_metta/lsp-callbacks.metta b/src/packs/lsp_server_metta/lsp-callbacks.metta index 291cfafcaf6..b48be57c23f 100644 --- a/src/packs/lsp_server_metta/lsp-callbacks.metta +++ b/src/packs/lsp_server_metta/lsp-callbacks.metta @@ -3,28 +3,42 @@ ;; !(bind! file-context &lsp-server) !(add-atom &lsp-server - (= (hook-hover-string $Path $Loc $Term $Arity) - (format-args "Looking at {}" ($Term)))) + (= (hook-hover-string $path $loc $term $arity) + (format-args "looking at {}" ($term)))) !(add-atom &lsp-server - (= (hook-hover-print $Path $Loc $Term $Arity) - (println! (format-args "Printing {}" ($Term))))) - + (= (hook-hover-print $path $loc $term $arity) + (println! (format-args "printing {}" ($term))))) +;; code lenses appear inline as to what is available even without user asking !(add-atom &lsp-server - (= (compute-typed-code-action $ObjectType $Uri $Range $Object) + (= (compute-each-code-lens $uri $lvl $ord $kind $what $vl $path $range) (sequential - ((fail) - (lsp-debug! todo (quote (compute-typed-code-action $ObjectType $Uri $Range $Object))))))) - + ( ;; (fail) + (lsp-debug! todo (quote (compute-each-code-lens $uri $lvl $ord $kind $what $vl $path $range))))))) +;; code actions appear only when user asks what they can do !(add-atom &lsp-server - (= (compute-each-code-lens $Uri $Lvl $Ord $Kind $What $VL $Path $Range) + (= (compute-typed-code-action $objecttype $uri $range $object) (sequential ( ;; (fail) - (lsp-debug! todo (quote (compute-each-code-lens $Uri $Lvl $Ord $Kind $What $VL $Path $Range))))))) - + (lsp-debug! todo (quote (compute-typed-code-action $objecttype $uri $range $object))))))) + +;; code lenses and actions have almost the same json format +(registered-every-file + ((range + ((start (line 0) (character 0)) + (end (line 0) (character 1)))) + (command + ((title "Run File At Toplevel") + (command re-run-file) + (arguments ($Uri)))))) + +;; example of an action +!(add-atom &lsp-server + (= (re-run-file $path) + (include $path)))