Giter VIP home page Giter VIP logo

Comments (10)

MaskRay avatar MaskRay commented on July 29, 2024

from emacs-ccls.

zaidmsh avatar zaidmsh commented on July 29, 2024

Thank you for your replay

Can you elaborate the files you have? Is there a declaration in a.h and a corresponding definition in a.c?

yes there is and are all in under the same directory src/

On a reference, textDocument/definition should bring you to the definition if a.c is indexed

how can I make sure it is indexed? I have compile_commands.json in my project root.

Another thing Im not sure if the problem is from ccls or lsp-mode.

from emacs-ccls.

MaskRay avatar MaskRay commented on July 29, 2024

Please dump the files. Without concrete examples it is hard to tell what goes wrong.

from emacs-ccls.

zaidmsh avatar zaidmsh commented on July 29, 2024

This happens in every c/c++ project. For example I have the ccls source project when I try jumping to definitions it jumps to the header files.

from emacs-ccls.

zaidmsh avatar zaidmsh commented on July 29, 2024

executing xref-find-references gives this error message "lsp--location-to-td-position: Wrong type argument: hash-table-p, nil"

from emacs-ccls.

zaidmsh avatar zaidmsh commented on July 29, 2024

I went back to cquery and deleted compile_commands.json and it worked perfectly. I think the problem is from compile_commands.json because I reproduced the json file and the problem came back.

from emacs-ccls.

MaskRay avatar MaskRay commented on July 29, 2024

The problem is not clearly specified. Please describe a.c a.h compile_commands.json you have. If you suspect your compile_commands.json is illformed you may switch to .ccls

wiki/FAQ describes how to add -log-file= to get more diagnostics.

from emacs-ccls.

myrgy avatar myrgy commented on July 29, 2024

Hello guys,

That's strange, but I got error: (wrong-type-argument hash-table-p nil)
That's in my doom-emacs config. While spacemacs works fine.

here it the backtrace from doom-emacs

Debugger entered--Lisp error: (wrong-type-argument hash-table-p nil)
  gethash("uri" nil)
  lsp--location-to-td-position(nil)
  lsp--symbol-info-to-identifier(#<hash-table equal 6/65 0x3053b4d>)
  mapcar(lsp--symbol-info-to-identifier (#<hash-table equal 6/65 0x3053b4d> #<hash-table equal 6/65 0x306f2f1> #<hash-table equal 6/65 0x3098775> #<hash-table equal 6/65 0x30eef85> #<hash-table equal 6/65 0x314ff81> #<hash-table equal 6/65 0x31a976d>))
  #f(compiled-function (function sequence) #<bytecode 0x52e3c1>)(lsp--symbol-info-to-identifier (#<hash-table equal 6/65 0x3053b4d> #<hash-table equal 6/65 0x306f2f1> #<hash-table equal 6/65 0x3098775> #<hash-table equal 6/65 0x30eef85> #<hash-table equal 6/65 0x314ff81> #<hash-table equal 6/65 0x31a976d>))
  apply(#f(compiled-function (function sequence) #<bytecode 0x52e3c1>) lsp--symbol-info-to-identifier (#<hash-table equal 6/65 0x3053b4d> #<hash-table equal 6/65 0x306f2f1> #<hash-table equal 6/65 0x3098775> #<hash-table equal 6/65 0x30eef85> #<hash-table equal 6/65 0x314ff81> #<hash-table equal 6/65 0x31a976d>) nil)
  seq-map(lsp--symbol-info-to-identifier (#<hash-table equal 6/65 0x3053b4d> #<hash-table equal 6/65 0x306f2f1> #<hash-table equal 6/65 0x3098775> #<hash-table equal 6/65 0x30eef85> #<hash-table equal 6/65 0x314ff81> #<hash-table equal 6/65 0x31a976d>))
  #f(compiled-function (backend) #<bytecode 0x155360d>)(xref-lsp)
  apply(#f(compiled-function (backend) #<bytecode 0x155360d>) xref-lsp nil)
  xref-backend-identifier-completion-table(xref-lsp)
  xref--read-identifier("Find references of: ")
  byte-code("\300\301!C\207" [xref--read-identifier "Find references of: "] 2)
  call-interactively(xref-find-references nil nil)
  command-execute(xref-find-references)

UPD: btw, usual lsp-ui-peek-find-references works fine.
UPD2: xref-find-references works fine. So seems like only default xref-finf-references doesn't work.

from emacs-ccls.

MaskRay avatar MaskRay commented on July 29, 2024

@zaidmsh Please the close the issue if you believe it is resolved.

@myrgy See xref-prompt-for-identifier in https://github.com/MaskRay/ccls/wiki/Emacs#find-definitionsreferences

from emacs-ccls.

fleutot avatar fleutot commented on July 29, 2024

This happens to me regularly, but not always. I think I had the issue before using LSP, though, so it's probably a problem with xref.

from emacs-ccls.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.