Skip to content

Commit

Permalink
re-run-file
Browse files Browse the repository at this point in the history
  • Loading branch information
TeamSPoon committed Nov 28, 2024
1 parent ece74bf commit 7857b45
Showing 1 changed file with 26 additions and 12 deletions.
38 changes: 26 additions & 12 deletions src/packs/lsp_server_metta/lsp-callbacks.metta
Original file line number Diff line number Diff line change
Expand Up @@ -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)))



0 comments on commit 7857b45

Please sign in to comment.