emacs-lsp / lsp-ui

UI integrations for lsp-mode
https://emacs-lsp.github.io/lsp-ui
GNU General Public License v3.0
1.03k stars 141 forks source link

Minor fix(?) for `lsp-ui-imenu--visit` and `lsp-ui-imenu--view` #274

Open emacksnotes opened 5 years ago

emacksnotes commented 5 years ago

In lsp-ui-imenu--visit and lsp-ui-imenu--view, replace

(goto-char marker)

with

(goto-char (overlay-start marker))

Without the above changes I get the following error

funcall-interactively: Wrong type argument: integer-or-marker-p, #<overlay from 16721 to 16752 in xdisp.c>
c02y commented 3 years ago

@emacksnotes Agree, I got the same problem, your code line fixes it.

It's over a year, maybe post a PR?

UPDATE: I was wrong, the fix-code works only for some simple file such as a source not managed by ccls/lsp, for projects(compile_commands.json), it doesn't work.

Without the fix, In lsp-ui-imenu--visit and lsp-ui-imenu--view works without problem.

jcs090218 commented 3 years ago

@emacksnotes @c02y Feel free to open a PR! There will be people reviewing it! 😄

c02y commented 3 years ago

@jcs090218 I added an update, this fix will break those two functions.

But for a simple source file, lsp-ui-imenu--visit and lsp-ui-imenu--view functions should work too. It still needs update, just not simple (goto-char (overlay-start marker))