Skip to content

Commit

Permalink
Add screenshot
Browse files Browse the repository at this point in the history
  • Loading branch information
yyoncho committed Jan 4, 2019
1 parent 1a2c91e commit 01c9220
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 15 deletions.
10 changes: 8 additions & 2 deletions README.org
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#+TITLE: Helm lsp integration

This package provides alternative of the build-in ~lsp-mode~ operations.
This package provides alternative of the build-in ~lsp-mode~ ~xref-appropos~
which provides as you type completion.

* Screenshot
#+caption: Demo
[[file:demo.png]]

* Commands
- `helm-lsp-workspace-symbol`
- ~helm-lsp-workspace-symbol~ - workspace symbols for the current workspace
- ~helm-lsp-global-workspace-symbol~ - workspace symbols from all of the active workspaces.
Binary file added demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 14 additions & 13 deletions helm-lsp.el
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
;;; Code:

(require 'helm)
(require 'helm-imenu)
(require 'dash)
(require 'lsp-mode)

Expand All @@ -38,19 +39,13 @@
(defun helm-lsp-workspace-symbol-action (candidate)
"Action for helm workspace symbol.
CANDIDATE is the selected item in the helm menu."
(-let* (((&hash "uri" "range" (&hash "line" "character")) (gethash "location" candidate)))
(-let* (((&hash "uri" "range" (&hash "start" (&hash "line" "character"))) (gethash "location" candidate)))
(find-file (lsp--uri-to-path uri))
(goto-char (point-min))
(forward-line line)
(forward-char character)))


(defmacro with-lsp-workspaces (workspaces &rest body)
"Helper macro for invoking BODY against WORKSPACES."
(declare (debug (form body))
(indent 1))
`(let ((lsp--buffer-workspaces ,workspaces)) ,@body))

(defun help-lsp--workspace-symbol (workspaces name input)
"Search against WORKSPACES NAME with default INPUT."
(if workspaces
Expand Down Expand Up @@ -83,13 +78,19 @@ CANDIDATE is the selected item in the helm menu."
:volatile t
:keymap helm-map
:candidate-transformer (lambda (candidates)
(cl-loop for c in candidates
collect (cons (format "%s.%s"
(gethash "containerName" c)
(gethash "name" c))
c)))
(-map
(-lambda ((candidate &as &hash "containerName" container-name "name" "kind"))
(let ((type (or (alist-get kind lsp--symbol-kind) "Unknown")))
(cons
(concat (if (s-blank? container-name)
name
(concat container-name "." name))
" "
(propertize (concat "(" type ")") 'face 'font-lock-keyword-face))
candidate)))
candidates))
:candidate-number-limit nil
:requires-pattern 1)
:requires-pattern 0)
:input input)
(user-error "No LSP workspace active")))

Expand Down

0 comments on commit 01c9220

Please sign in to comment.