Commit 3099f674 authored by Fangrui Song's avatar Fangrui Song

Use lsp-request and lsp-notify

parent caf5a334
......@@ -80,27 +80,25 @@
(let ((id (ccls-call-hierarchy-node-id (ccls-tree-node-data node))))
(--map (ccls-call-hierarchy--read-node it node)
(gethash "children"
(lsp--send-request
(lsp--make-request "$ccls/call"
`(:id ,id
:callee ,callee
:callType 3
:levels ,ccls-tree-initial-levels
:qualified ,(if ccls-call-hierarchy-qualified t :json-false)
:hierarchy t
)))))))
(lsp-request
"$ccls/call"
`(:id ,id
:callee ,callee
:callType 3
:levels ,ccls-tree-initial-levels
:qualified ,(if ccls-call-hierarchy-qualified t :json-false)
:hierarchy t))))))
(defun ccls-call-hierarchy--request-init (callee)
"."
(lsp--send-request
(lsp--make-request "$ccls/call"
`(:textDocument (:uri ,(concat lsp--uri-file-prefix buffer-file-name))
:position ,(lsp--cur-position)
:callee ,callee
:callType 3
:qualified ,(if ccls-call-hierarchy-qualified t :json-false)
:hierarchy t
))))
(lsp-request
"$ccls/call"
`(:textDocument (:uri ,(concat lsp--uri-file-prefix buffer-file-name))
:position ,(lsp--cur-position)
:callee ,callee
:callType 3
:qualified ,(if ccls-call-hierarchy-qualified t :json-false)
:hierarchy t)))
(defun ccls-call-hierarchy--make-string (node depth)
"Propertize the name of NODE with the correct properties"
......
......@@ -69,28 +69,26 @@
(kind (ccls-inheritance-hierarchy-node-kind (ccls-tree-node-data node))))
(--map (ccls-inheritance-hierarchy--read-node it node)
(gethash "children"
(lsp--send-request
(lsp--make-request "$ccls/inheritance"
`(:id ,id :kind ,kind
:derived ,derived
:qualified ,(if ccls-inheritance-hierarchy-qualified t :json-false)
:levels ,ccls-tree-initial-levels
:hierarchy t
)))))))
(lsp-request
"$ccls/inheritance"
`(:id ,id :kind ,kind
:derived ,derived
:qualified ,(if ccls-inheritance-hierarchy-qualified t :json-false)
:levels ,ccls-tree-initial-levels
:hierarchy t
))))))
(defun ccls-inheritance-hierarchy--request-init (derived)
"."
(lsp--send-request
(lsp--make-request "$ccls/inheritance"
`(
:textDocument (:uri ,(concat lsp--uri-file-prefix buffer-file-name))
:position ,(lsp--cur-position)
:derived ,derived
:qualified ,(if ccls-inheritance-hierarchy-qualified t :json-false)
:levels 1
:hierarchy t
))))
(lsp-request
"$ccls/inheritance"
`(:textDocument (:uri ,(concat lsp--uri-file-prefix buffer-file-name))
:position ,(lsp--cur-position)
:derived ,derived
:qualified ,(if ccls-inheritance-hierarchy-qualified t :json-false)
:levels 1
:hierarchy t)))
(defun ccls-inheritance-hierarchy--make-string (node _depth)
"Propertize the name of NODE with the correct properties"
......
......@@ -67,25 +67,24 @@
"."
(let ((id (ccls-member-hierarchy-node-id (ccls-tree-node-data node))))
(--map (ccls-member-hierarchy--read-node it node)
(gethash "children" (lsp--send-request
(lsp--make-request "$ccls/member"
`(:id ,id
:levels ,ccls-tree-initial-levels
:qualified ,(if ccls-member-hierarchy-qualified t :json-false)
:hierarchy t
)))))))
(gethash
"children"
(lsp-request "$ccls/member"
`(:id ,id
:levels ,ccls-tree-initial-levels
:qualified ,(if ccls-member-hierarchy-qualified t :json-false)
:hierarchy t
))))))
(defun ccls-member-hierarchy--request-init ()
"."
(lsp--send-request
(lsp--make-request "$ccls/member"
`(
:textDocument (:uri ,(concat lsp--uri-file-prefix buffer-file-name))
:position ,(lsp--cur-position)
:levels 1
:qualified ,(if ccls-member-hierarchy-qualified t :json-false)
:hierarchy t
))))
(lsp-request
"$ccls/member"
`(:textDocument (:uri ,(concat lsp--uri-file-prefix buffer-file-name))
:position ,(lsp--cur-position)
:levels 1
:qualified ,(if ccls-member-hierarchy-qualified t :json-false)
:hierarchy t)))
(defun ccls-member-hierarchy--make-string (node depth)
"Propertize the name of NODE with the correct properties"
......
......@@ -73,15 +73,11 @@
;; ---------------------------------------------------------------------
;;
(defun ccls-info ()
(lsp--cur-workspace-check)
(lsp--send-request
(lsp--make-request "$ccls/info")))
(lsp-request "$ccls/info" (make-hash-table)))
(defun ccls-file-info ()
(lsp--cur-workspace-check)
(lsp--send-request
(lsp--make-request "$ccls/fileInfo"
`(:textDocument ,(lsp--text-document-identifier)))))
(lsp-request "$ccls/fileInfo"
`(:textDocument ,(lsp--text-document-identifier))))
(defun ccls-preprocess-file (&optional output-buffer)
"Preprocess selected buffer."
......@@ -116,10 +112,7 @@
(defun ccls-reload ()
"Reset database and reload cached index files."
(interactive)
(lsp--cur-workspace-check)
(lsp--send-notification
(lsp--make-notification "$ccls/reload" (list :whitelist []
:blacklist []))))
(lsp-notify "$ccls/reload" (list :whitelist [] :blacklist [])))
(defun ccls-navigate (direction)
"Navigate to a nearby outline symbol.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment